import { PublicKey, Keypair, Connection, TransactionInstruction } from '@solana/web3.js'; import type { NonceAccountInfo, NonceAccountCacheEntry, CreateNonceAccountOptions, OfflineTransaction } from '../types/nonceAccount'; import type { TossUser } from '../types/tossUser'; /** * NonceAccountManager * Manages durable nonce accounts for secure offline transactions * with biometric protection and encrypted storage */ export declare class NonceAccountManager { private cache; private connection; constructor(connection: Connection); /** * Create a new durable nonce account for a user * Securely stores the nonce account with biometric protection */ createNonceAccount(user: TossUser, nonceAuthorityKeypair: Keypair, owner: PublicKey, options?: CreateNonceAccountOptions): Promise; /** * Store nonce account securely in device's secure enclave * Encrypted and protected by biometric authentication */ private storeNonceAccountSecurely; /** * Retrieve nonce account from secure storage * Requires biometric verification */ getNonceAccountSecure(userId: string, authenticator?: () => Promise): Promise; /** * Cache nonce account info for quick access */ private cacheNonceAccount; /** * Get cached nonce account info */ getCachedNonceAccount(userId: string): NonceAccountCacheEntry | null; /** * Prepare offline transaction using nonce account * Creates a transaction that can be signed and executed offline */ prepareOfflineTransaction(user: TossUser, _instructions: TransactionInstruction[], nonceAccountInfo: NonceAccountInfo): Promise; /** * Renew nonce account (refresh blockhash and nonce state) */ renewNonceAccount(userId: string, _nonceAccountAddress: PublicKey): Promise; /** * Revoke nonce account (mark as unusable) */ revokeNonceAccount(userId: string, _nonceAccountAddress: PublicKey): Promise; /** * Clean up expired nonce accounts from cache */ cleanupExpiredCache(): void; /** * Validate nonce account status */ isNonceAccountValid(nonceAccountInfo: NonceAccountInfo): boolean; /** * GAP #6 FIX: Initialize a durable nonce account onchain * Per TOSS Paper Section 4.2: "Replay-protected" nonces * This creates the actual SystemProgram nonce account on the blockchain */ initializeDurableNonceAccountOnchain(authority: PublicKey, nonceAccountKeypair: Keypair, payer: PublicKey, minRentLamports: number): Promise; /** * GAP #6 FIX: Consume (advance) a nonce account after successful transaction * Per TOSS Paper Section 9: Nonce advancement for replay protection */ consumeNonceAccount(nonceAccountAddress: PublicKey, nonceAuthority: PublicKey): Promise; /** * GAP #6 FIX: Validate nonce account state on chain * Checks that nonce account exists and is properly configured */ validateNonceAccountOnchain(nonceAccountAddress: PublicKey, _expectedAuthority?: PublicKey): Promise<{ valid: boolean; error?: string; }>; /** * GAP #6 FIX: Get current nonce value from blockchain * Reads the actual nonce state from the nonce account */ getCurrentNonceFromChain(nonceAccountAddress: PublicKey): Promise; } //# sourceMappingURL=NonceAccountManager.d.ts.map