@lightninglabs/lnc-web
Version:
Lightning Node Connect npm module for web
39 lines • 1.55 kB
TypeScript
import { PasswordEncryptionService } from '../encryption/passwordEncryptionService';
import { UnlockOptions } from '../types/lightningNodeConnect';
import { BaseCredentialRepository } from './credentialRepository';
/**
* Password-based credential repository.
* Uses localStorage for storage and PasswordEncryptionService for encryption.
*/
export declare class PasswordCredentialRepository extends BaseCredentialRepository {
private encryption;
constructor(namespace: string, encryption: PasswordEncryptionService);
/**
* Returns true when the underlying encryption service is unlocked.
*/
get isUnlocked(): boolean;
/**
* Check if this repository has stored authentication data (salt/cipher)
*/
get hasStoredAuthData(): boolean;
/**
* Unlock the underlying encryption service using the provided password,
* loading any stored salt/cipher from localStorage.
*/
unlock(options: UnlockOptions): Promise<void>;
/**
* Load and decrypt a credential value by key, or return undefined
* if no value is stored or decryption fails.
*/
getCredential(key: string): Promise<string | undefined>;
/**
* Encrypt and persist a credential value under the given key.
* Throws if the repository has not been unlocked.
*/
setCredential(key: string, value: string): Promise<void>;
/**
* Lock the underlying encryption service and clear in-memory key material.
*/
lock(): void;
}
//# sourceMappingURL=passwordCredentialRepository.d.ts.map