/** * Paper key interfaces for the BrightChain identity system. * * Paper keys are 24-word BIP39 mnemonics used for account backup, * device provisioning, and recovery. These interfaces define the * metadata tracked for each paper key and the printable template * generated for secure offline storage. * * All data interfaces are generic over TId so the same interface * can serve as a DTO for React clients (string) and as the concrete * type used inside Node services (GuidV4Buffer / Uint8Array). * * Requirements: 1.4, 1.5 */ import { PaperKeyPurpose } from '../../enumerations/paperKeyPurpose'; /** * Metadata tracked for each paper key throughout its lifecycle. * * @remarks * Every generated paper key has an associated metadata record that * tracks creation, usage, revocation, and purpose. This enables * audit logging and lifecycle management per Requirements 1.5, 1.6, 1.7. * * @example * ```typescript * const metadata: IPaperKeyMetadata = { * id: 'pk-abc-123', * createdAt: new Date(), * purpose: PaperKeyPurpose.BACKUP, * }; * ``` */ export interface IPaperKeyMetadata { /** Unique identifier for this paper key record */ id: TId; /** Timestamp when the paper key was generated */ createdAt: Date; /** * Timestamp when the paper key was used (e.g. for device provisioning) * @remarks Set by markPaperKeyUsed() after successful use */ usedAt?: Date; /** * Timestamp when the paper key was revoked * @remarks Once revoked, the paper key can no longer be used for recovery */ revokedAt?: Date; /** The intended purpose of this paper key */ purpose: PaperKeyPurpose; /** * Identifier of the device provisioned with this paper key * @remarks Only set when purpose is DEVICE_PROVISIONING */ deviceId?: TId; } /** * Printable paper key template for secure offline storage. * * @remarks * Generated by the Paper Key Service, this template contains everything * needed to produce a physical backup: the mnemonic words, a QR code * for mobile scanning, and security warnings per Requirements 1.4, 1.8, 1.10. * * The template is intended to be rendered once and printed—never stored * digitally after generation. * * @example * ```typescript * const template: IPaperKeyTemplate = { * words: ['abandon', 'ability', ...], // 24 words * qrCode: 'data:image/png;base64,...', * createdAt: new Date(), * memberId: 'member-xyz', * instructions: 'Store this paper key in a secure location.', * warnings: [ * 'Anyone with this paper key can access your account', * 'Do not store digitally or photograph', * 'Consider splitting among trusted parties', * ], * }; * ``` */ export interface IPaperKeyTemplate { /** The 24 BIP39 mnemonic words comprising the paper key */ words: string[]; /** QR code encoding the mnemonic, as a data URL for printing/scanning */ qrCode: string; /** Timestamp when this template was generated */ createdAt: Date; /** Identifier of the member this paper key belongs to */ memberId: TId; /** Human-readable instructions for storing the paper key */ instructions: string; /** Security warnings to display on the printed template */ warnings: string[]; } //# sourceMappingURL=paperKey.d.ts.map