import type { UnlockKdf } from '../keyring/kdf.js'; import type { UnlockClientIdentity } from '../unlock/standingClient.js'; /** * The byte length of a recovery code: 16 random bytes is ~128 bits, enough * that the unlock derivation is a single expansion rather than a stretched * KDF (there is nothing to stretch -- the code is already uniform). */ export declare const RECOVERY_CODE_BYTES = 16; /** * HKDF parameters for the recovery-code unlock derivation * (`unlockSeed = HKDF(codeBytes)`). The salt differs from every other unlock * method's salt, so a code and a passphrase that stringify alike can never * derive the same unlock Space; as with the other unlock KDFs, `version` pins * the parameter set and the salt is permanent. */ export declare const RECOVERY_KDF: UnlockKdf; /** * Thrown for text that is not a well-formed recovery code (characters outside * the base58 alphabet, or the wrong decoded length). Deliberately distinct * from "no account found for this code" -- a malformed code was mistyped; a * well-formed code that resolves to nothing was never issued or has been * revoked. */ export declare class RecoveryCodeInvalidError extends Error { constructor(message?: string); } /** * Generates a fresh recovery code: 16 random bytes, base58-encoded. * * @returns {string} */ export declare function generateRecoveryCode(): string; /** * Renders a recovery code in dash-separated groups of four for display * ("6yCL-Ho5s-..."). Purely cosmetic; `normalizeRecoveryCode` strips the * grouping back out on entry. * * @param options {object} * @param options.code {string} * @returns {string} */ export declare function formatRecoveryCode({ code }: { code: string; }): string; /** * Normalizes user-entered recovery code text: strips whitespace and the * display dashes. Base58 is case-sensitive, so casing is preserved. * * @param options {object} * @param options.input {string} * @returns {string} */ export declare function normalizeRecoveryCode({ input }: { input: string; }): string; /** * Decodes a (possibly formatted) recovery code back to its 16 bytes, * throwing `RecoveryCodeInvalidError` on anything malformed. * * @param options {object} * @param options.code {string} the user-entered code (grouping tolerated) * @returns {Uint8Array} */ export declare function decodeRecoveryCode({ code }: { code: string; }): Uint8Array; /** * The code's full client identity, derived deterministically from its bytes: * the 32-byte client seed (behind the code's Ed25519 signing pair and X25519 * key-agreement twin), the ladder seed behind its update authority, the * derived agents, and the public multibases / ids the issuance and recovery * flows publish and look up. */ export interface RecoveryClient extends UnlockClientIdentity { codeBytes: Uint8Array; /** * The code's update-key ladder seed. Its VM is what signs the code's own * bridge delegation, and its rung 0 is the code's committed update key, so * the spend's reveal-and-commit entry is the ordinary ladder reveal. A code * is spent on use and never self-rotates, so no rung past 0 is ever * revealed; the ladder is what gives the code a verification method of its * own beside that single rung. */ ladderSeed: Uint8Array; /** * Rung 0's 32-byte update-key seed -- the key the code's committed hash * stands for, and the one the reveal-and-commit entry signs with. */ updateSeed: Uint8Array; /** * The symmetric key that MACs the recovery record's account binding: * computed at issuance, verified at recovery before the pointer is trusted. * Derived from the code bytes, so the storage host never holds it. */ bindingMacKey: Uint8Array; /** * Rung 0's public multibase: the code's `updateKeyMultibase` as the * registry records it and the document commits its hash. */ updateKeyMultibase: string; /** * The ladder VM's public multibase, as the account document publishes it * under `assertionMethod` and `capabilityDelegation`. */ ladderVmKeyMultibase: string; } /** * Derives the code's whole client identity from a (possibly formatted) code. * Deterministic: the same code always yields the same key set. Throws * `RecoveryCodeInvalidError` on malformed text; whether the derived identity * actually unlocks anything is the caller's question. * * @param options {object} * @param options.code {string} the recovery code (grouping tolerated) * @returns {Promise} */ export declare function recoveryClientFromCode({ code }: { code: string; }): Promise; //# sourceMappingURL=recoveryCode.d.ts.map