UNPKG

@lightninglabs/lnc-web

Version:

Lightning Node Connect npm module for web

44 lines 1.63 kB
import { UnlockMethod, UnlockOptions } from '../types/lightningNodeConnect'; import { AuthStrategy } from './authStrategy'; /** * Password-based authentication strategy. * Handles password encryption/decryption and localStorage persistence. */ export declare class PasswordStrategy implements AuthStrategy { readonly method: UnlockMethod; private repository; constructor(namespace: string); /** * Return true if this strategy can be used in the current environment. * Password auth is always supported. */ get isSupported(): boolean; /** * Returns true when the underlying repository is unlocked. */ get isUnlocked(): boolean; /** * Return true if this strategy has any stored credentials in its backing store. */ get hasAnyCredentials(): boolean; /** * Attempt to unlock this strategy using the provided password. * Returns false if the method is not `password` or unlock fails. */ unlock(options: UnlockOptions): Promise<boolean>; /** * 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=passwordStrategy.d.ts.map