import type { PasswordStrength } from '../interfaces/PasswordStrength.mjs'; import type { PlatformProviders } from '../interfaces/PlatformProviders.mjs'; import type CryptoLib from '../interfaces/CryptoLib.mjs'; import type { EncryptedSecretKeys, EncryptedSymmetricKey, MacKey, Password, PublicKey, Salt, SigningPublicKey } from '../interfaces/CryptoLib.mjs'; import type { DeviceType } from '../interfaces/SyncTypes.mjs'; import FavaLib from '../FavaLib.mjs'; import { type KdfParameters } from './canonical.mjs'; import LibraryLoader from '../subclasses/LibraryLoader.mjs'; import type { LockedRepresentationString, UnlockedSessionString, VaultSyncStateWithServerUrl } from '../interfaces/Vault.mjs'; import type { PasswordExtraDict } from '../interfaces/PasswordExtraDict.js'; import { SaveFunction } from '../interfaces/SaveFunction.mjs'; export interface LoadFavaLibOptions { /** Whether to connect to the configured sync server while loading. */ connectToSyncServer?: boolean; /** * Overrides the stored connection settings before any socket opens, keeping * paired devices and pending commands. Included in subsequent vault saves. */ syncServer?: Pick; } /** * Draws a fresh vault salt. * * Note what a Salt is here: the base64 STRING of the random bytes, and that * string is what argon2id receives -- 24 UTF-8 bytes, not the 16 raw ones. * * Shared with PersistentStorageManager.changePassword so the two cannot drift: * a salt length is a security parameter, and a constant differing between paths * has bitten this code before (the 12-vs-16-byte nonce). * Deliberately not a CryptoLib method -- that interface is public API and a * consumer may supply their own provider, so a new required member is a break * for them, and there is nothing platform-specific to implement above the * getRandomBytes that interface already has. * @param cryptoLib - The crypto provider to draw randomness from. * @returns A promise resolving to the new salt. */ export declare const generateSalt: (cryptoLib: CryptoLib) => Promise; /** * Evaluates the strength of a password. * @param libraryLoader - An instance of LibraryLoader. * @param passwordExtraDict - Additional words to be used for password strength evaluation. * @param password - The password to evaluate. * @returns Promise resolving to the password strength result. */ export declare const getPasswordStrength: (libraryLoader: LibraryLoader, passwordExtraDict: PasswordExtraDict, password: Password) => Promise; /** * Validates the strength of a password. * @param libraryLoader - An instance of LibraryLoader. * @param passwordExtraDict - Additional words to be used for password strength evaluation. * @param password - The password to validate. * @throws {InitializationError} If the password is too weak. */ export declare const validatePasswordStrength: (libraryLoader: LibraryLoader, passwordExtraDict: PasswordExtraDict, password: Password) => Promise; /** * Returns utility functions useful in creating a new favaLib vault * @param platformProviders - The platform-specific providers containing CryptoLib and other providers. * @param deviceType - A unique identifier for this device type (e.g. 2fa-cli). * @param passwordExtraDict - Additional words to be used for password strength evaluation. * @param saveFunction - The function to save the data. * @returns An object with methods to evaluate password strength and create a new FavaLib vault. */ export declare const getFavaLibVaultCreationUtils: (platformProviders: PlatformProviders, deviceType: DeviceType, passwordExtraDict: PasswordExtraDict, saveFunction?: SaveFunction) => { getPasswordStrength: (password: Password) => Promise; createNewFavaLibVault: (password: Password) => Promise<{ favaLib: FavaLib; publicKey: PublicKey; signingPublicKey: SigningPublicKey; encryptedSecretKeys: EncryptedSecretKeys; encryptedSymmetricKey: EncryptedSymmetricKey; salt: Salt; macKey: MacKey; kdf: KdfParameters; }>; loadFavaLibFromLockedRepesentation: (lockedRepresentationString: LockedRepresentationString, password: Password, options?: LoadFavaLibOptions | undefined) => Promise; loadFavaLibFromUnlockedSession: (lockedRepresentationString: LockedRepresentationString, unlockedSessionString: UnlockedSessionString, options?: LoadFavaLibOptions | undefined) => Promise; };