import { PowerAuthRawNativeObject } from './PowerAuthNativeTypes'; /** * Base interface for objects that use releasable underlying native object. */ export interface BaseReleasableObject { /** * Release the underlying native object. */ release(): Promise; } /** * Internal class that implements automatic native object re-creation. */ export declare class BaseNativeObject implements BaseReleasableObject { private objectId; /** * Construct object with optional object identifier. If identifier is not provided, * then it's created in the next call to `withObjectId()` method. * @param objectId Optional object identifier. */ constructor(objectId?: string | undefined); /** * Function called when native object needs to be initialized. The derived class must * override this function. The function must return native object identifier. */ protected onCreate(): Promise; /** * Function called when native object is manually released by the application. The derived class must * override this function. * @param _objectId Native object identifier. */ protected onRelease(_objectId: string): Promise; /** * Function called when native object is re-created after automatic native object cleanup. The default * implementation does nothing, so the derived class can override it and implement its own functionality. */ protected onAutomaticCleanup(): void; /** * Acquire native object ID and execute action with this identifier. * @param action Action to execute after objectId is acquired. * @param recoveringFromError If true, then this is 2nd attempt to execute action after recovery from action. * @returns Promise result type. */ protected withObjectId(action: (objectId: string) => Promise, recoveringFromError?: boolean): Promise; /** * Initialize native object if it's not initialized yet and convert this object into `RawNativeObject` * that is passable to the native code. */ protected resolveRawObject(): Promise; /** * Convert instance of this object into `RawNativeObject` that is passable to the native code. * Be aware that this function throws an exception if object identifier is not available. */ protected toRawObject(): PowerAuthRawNativeObject; release(): Promise; }