UNPKG

@convo-lang/convo-lang

Version:
38 lines (37 loc) 1.59 kB
import { ReadonlySubject } from "@iyio/common"; import { PromiseResultType } from "../result-type.js"; import { ConvoEmailOtpSignRequest, ConvoEmailPasswordSignRequest, ConvoSignInJwt } from "./convo-db-auth-types.js"; import { ConvoDb } from "./convo-db-types.js"; /** * An auth helper class. Auth is not directly handled by ConvoDbAuth, it relies on stored database * function for auth operations. */ export declare class ConvoDbAuthManager { private readonly _jwt; get jwtSubject(): ReadonlySubject<ConvoSignInJwt | null>; get jwt(): { id: string; identityPaths: string[]; claims: Record<string, any>; dbName: string; jwt: string; } | null; private readonly db; constructor(db: ConvoDb); signOutAsync(): Promise<void>; signInEmailOtpAsync(request: ConvoEmailOtpSignRequest): PromiseResultType<ConvoSignInJwt>; signInEmailPasswordAsync(request: ConvoEmailPasswordSignRequest): PromiseResultType<ConvoSignInJwt>; setJwt(jwt: ConvoSignInJwt | null): void; private maxCachedBoundaries; private boundaryCacheDropRatio; private boundaryCacheCount; private readonly boundaryCache; /** * Create a proxy db with all public methods permissions scoped to the given `permissionFrom` * argument. * @param permissionFrom The node path where to scope permissions from * @param byPass If true no proxy will be created and the db of the auth manager will be returned. */ createBoundary(permissionFrom: string, byPass?: boolean): ConvoDb; private _createBoundary; }