@lightninglabs/lnc-web
Version:
Lightning Node Connect npm module for web
51 lines • 1.75 kB
TypeScript
import { UnlockMethod, UnlockOptions } from '../types/lightningNodeConnect';
import { EncryptionService } from './encryptionService';
/**
* Pure password-based encryption service.
* No storage dependencies - just crypto operations.
*/
export declare class PasswordEncryptionService implements EncryptionService {
private password?;
private salt?;
private isUnlockedState;
/**
* Get the unlock method handled by this service (`password`).
*/
get method(): UnlockMethod;
/**
* Returns true when a password and salt are set and the service is unlocked.
*/
get isUnlocked(): boolean;
/**
* Encrypt a plaintext string using the currently unlocked password and salt.
* Throws if the service has not been unlocked.
*/
encrypt(data: string): Promise<string>;
/**
* Decrypt a ciphertext string using the currently unlocked password and salt.
* Throws if the service has not been unlocked.
*/
decrypt(data: string): Promise<string>;
/**
* Unlock the service with the given password (and optional salt/cipher).
* For existing users, verifies the password using the stored test cipher.
*/
unlock(options: UnlockOptions): Promise<void>;
/**
* Clear all in-memory password material and reset the unlocked state.
*/
lock(): void;
/**
* Return true if this service can handle the provided unlock method.
*/
canHandle(method: UnlockMethod): boolean;
/**
* Get the current salt (for storage by repository)
*/
getSalt(): string;
/**
* Generate a test cipher (for storage by repository)
*/
createTestCipher(): string;
}
//# sourceMappingURL=passwordEncryptionService.d.ts.map