UNPKG

@lightninglabs/lnc-web

Version:

Lightning Node Connect npm module for web

54 lines 2.06 kB
import { UnlockOptions } from '../types/lightningNodeConnect'; import { AuthStrategy } from './authStrategy'; /** * Passkey-based authentication strategy. * Handles WebAuthn passkey encryption/decryption and IndexedDB persistence. */ export declare class PasskeyStrategy implements AuthStrategy { readonly method: "passkey"; private repository; constructor(namespace: string, displayName: string); /** * Return true if this strategy can be used in the current environment, * i.e. when WebAuthn platform authenticators are available. */ get isSupported(): boolean; /** * Returns true when the underlying repository is unlocked. */ get isUnlocked(): boolean; /** * Attempt to unlock this strategy using a passkey credential. * Returns false if the method is not `passkey` or unlock fails. */ unlock(options: UnlockOptions): Promise<boolean>; /** * Return true if this strategy has any stored credentials in its backing store. */ get hasAnyCredentials(): boolean; /** * Return true if this strategy has stored authentication data (credential ID) * and can likely perform a passkey-based unlock. */ hasStoredAuthData(): boolean; /** * Return the stored passkey credential ID, if any. Allows consumer apps * to pass this ID when persisting credentials for a different namespace. */ getCredentialId(): string | undefined; /** * Get a decrypted credential value by key from the backing store, * or undefined if the strategy is not unlocked or the value is missing. */ getCredential(key: string): Promise<string | undefined>; /** * Encrypt and persist a credential value in the backing store. * Logs and returns without throwing if the strategy is not unlocked. */ setCredential(key: string, value: string): Promise<void>; /** * Clear all data managed by this strategy from its backing store. */ clear(): void; } //# sourceMappingURL=passkeyStrategy.d.ts.map