import type { EncryptedData } from "./encryption.js"; import type { Network } from "../config/networks.js"; /** * Common address fields for wallet-related types. */ export interface WalletAddresses { /** Stacks L2 address */ address: string; /** Bitcoin L1 address (P2WPKH - native SegWit) */ btcAddress?: string; /** Bitcoin L1 Taproot address (P2TR - for receiving inscriptions) */ taprootAddress?: string; /** Sponsor relay API key (optional, per-wallet) */ sponsorApiKey?: string; } /** * Wallet metadata (stored in index, no sensitive data) */ export interface WalletMetadata extends WalletAddresses { id: string; name: string; network: Network; createdAt: string; lastUsed?: string; } /** * Wallet index file structure */ export interface WalletIndex { version: number; wallets: WalletMetadata[]; } /** * App configuration */ export interface AppConfig { version: number; activeWalletId: string | null; autoLockTimeout: number; hiroApiKey?: string; stacksApiUrl?: string; } /** * Keystore file structure (contains encrypted mnemonic) */ export interface KeystoreFile { version: number; encrypted: EncryptedData; addressIndex: number; } /** * Get storage directory path */ export declare function getStorageDir(): string; /** * Check if storage directory exists */ export declare function storageExists(): Promise; /** * Initialize storage directory structure */ export declare function initializeStorage(): Promise; /** * Read wallet index */ export declare function readWalletIndex(): Promise; /** * Write wallet index (atomic write with temp file) */ export declare function writeWalletIndex(index: WalletIndex): Promise; /** * Read app config */ export declare function readAppConfig(): Promise; /** * Write app config (atomic write) */ export declare function writeAppConfig(config: AppConfig): Promise; /** * Get keystore file path for a wallet */ export declare function getKeystorePath(walletId: string): string; /** * Read keystore for a wallet */ export declare function readKeystore(walletId: string): Promise; /** * Write keystore for a wallet (creates directory if needed) */ export declare function writeKeystore(walletId: string, keystore: KeystoreFile): Promise; /** * Delete a wallet directory and its contents */ export declare function deleteWalletStorage(walletId: string): Promise; /** * Update wallet metadata in index */ export declare function updateWalletMetadata(walletId: string, updates: Partial): Promise; /** * Add wallet to index */ export declare function addWalletToIndex(wallet: WalletMetadata): Promise; /** * Remove wallet from index */ export declare function removeWalletFromIndex(walletId: string): Promise; /** * Backup keystore file for a wallet (atomic: temp write + rename) */ export declare function backupKeystore(walletId: string): Promise; /** * Restore keystore from backup (atomic: temp write + rename, then delete backup) */ export declare function restoreKeystoreBackup(walletId: string): Promise; /** * Delete keystore backup file (idempotent — ignores missing file) */ export declare function deleteKeystoreBackup(walletId: string): Promise; /** * Get stored Hiro API key (cached in memory after first read). * Returns empty string if no key is stored. */ export declare function getHiroApiKey(): Promise; /** * Save Hiro API key to config and update in-memory cache. */ export declare function setHiroApiKey(key: string): Promise; /** * Remove Hiro API key from config and clear in-memory cache. */ export declare function clearHiroApiKey(): Promise; /** * Get stored custom Stacks API URL (cached in memory after first read). * Returns empty string if no custom URL is stored. */ export declare function getStacksApiUrl(): Promise; /** * Save custom Stacks API URL to config and update in-memory cache. */ export declare function setStacksApiUrl(url: string): Promise; /** * Remove custom Stacks API URL from config and clear in-memory cache. */ export declare function clearStacksApiUrl(): Promise; //# sourceMappingURL=storage.d.ts.map