/** * AddressManager - Manages yours receive addresses using BRC-29 derivation format. * * Yours receive addresses are fixed, public addresses that users share publicly. * They are derived deterministically from the identity key using: * - derivationPrefix: "yours receive" (fixed) * - derivationSuffix: "0", "1", "2", ... (sequential counter) * - senderIdentityKey: our own identity public key (self-referential derivation) * * This allows: * 1. Deterministic regeneration on wallet restore * 2. Syncing external payments to these addresses * 3. Auto-signing via BRC-29/ScriptTemplateBRC29 (wallet knows the derivation info) * * Address derivation is done externally (in yours-wallet) and passed to this class. */ import { type WalletProtocol } from "@bsv/sdk"; /** Fixed prefix for yours receive addresses */ export declare const YOURS_PREFIX = "yours"; /** BRC-29 protocol ID - used by wallet-toolbox for key derivation and signing */ export declare const BRC29_PROTOCOL_ID: WalletProtocol; /** * Derivation info for a yours receive address. * This is what's needed for internalizeAction's paymentRemittance. */ export interface AddressDerivation { /** The Bitcoin address (base58check) */ address: string; /** The key index (0, 1, 2, etc.) for internal lookups */ index: number; /** Base64-encoded derivation prefix (e.g., base64("yours receive")) */ derivationPrefix: string; /** Base64-encoded derivation suffix (e.g., base64("0"), base64("1"), etc.) */ derivationSuffix: string; /** Our own identity public key (self-referential) */ senderIdentityKey: string; /** The public key for this address */ publicKey: string; } /** * AddressManager manages yours receive addresses. * Accepts pre-derived addresses - derivation is done externally. */ export declare class AddressManager { private addressMap; private maxKeyIndex; /** * @param derivations - Pre-derived address derivations */ constructor(derivations: AddressDerivation[]); /** * Add a new address derivation. */ addAddress(derivation: AddressDerivation): void; /** * Get the current max key index. * This should be persisted to chrome.storage. */ getMaxKeyIndex(): number; /** * Get all known addresses. */ getAddresses(): string[]; /** * Get derivation info for an address, or undefined if not ours. */ getDerivation(address: string): AddressDerivation | undefined; /** * Check if an address belongs to this wallet. */ isOurAddress(address: string): boolean; /** * Get the primary receive address (index 0). */ getPrimaryAddress(): string | undefined; /** * Get address at a specific index. */ getAddressAtIndex(index: number): AddressDerivation | undefined; /** * Build the locking script for an address at a specific index. * Useful for verifying outputs match expected scripts. */ getLockingScriptAtIndex(index: number): string | undefined; }