/** * Independent BIP-340 verification of a wallet-returned Taproot script-path * Schnorr signature against an independently-recomputed sighash. * * Critical Path #7 (CLAUDE.md): the SDK requests script-path signatures with * `useTweakedSigner: false, autoFinalized: false`. Wallet support for the * untweaked-key flag is inconsistent — older OKX / mobile bridges silently sign * with the *tweaked* key, Keystone ignores the flag — and a compromised * extension can stuff a 64-byte stub into `tapScriptSig`. A bad signature that * the SDK forwards is only caught on broadcast; in the worst case it passes the * VP off-chain but Bitcoin rejects it, leaving the depositor's BTC locked in the * HTLC until `timelockRefund` matures. This guard rejects such signatures before * they are trusted. * * Why verify against the *locally-built* PSBT, not the wallet-returned one: * `assertPsbtUnsignedTxMatches` pins the unsigned transaction but deliberately * skips per-input metadata (`witnessUtxo`, `tapLeafScript`). A malicious wallet * could rewrite those consistently in the returned PSBT so a wrong-message * signature self-validates. The trusted prevout scripts/values and leaf script * therefore come from the PSBT we built ourselves (derived from on-chain / WASM * sources); only the 64-byte signature comes from the wallet. * * Reuses the exact primitives `bip322Verify.ts` already depends on — no new * dependency: * - `@bitcoin-js/tiny-secp256k1-asmjs` → `verifySchnorr` * - `bitcoinjs-lib` → `Transaction.hashForWitnessV1` * - `../utils/taproot` → `computeTapLeafHash` * * @module tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature */ export interface VerifyScriptPathSchnorrSignatureParams { /** * Hex of the PSBT we built locally and sent to the wallet (the trusted * source of prevout scripts/values and the leaf script). NOT the * wallet-returned PSBT. */ requestedPsbtHex: string; /** The 64-byte Schnorr signature extracted from the wallet's response (128 hex chars). */ signatureHex: string; /** X-only public key (64 hex chars) the wallet signed the script-path leaf with. */ signerXOnlyPubkeyHex: string; /** Index of the input the signature is for. */ inputIndex: number; } /** * Assert that `signatureHex` is a valid BIP-340 Schnorr signature by the * `signerXOnlyPubkeyHex` key over the Taproot script-path sighash of * `requestedPsbtHex` input `inputIndex` (SIGHASH_DEFAULT). * * @throws If the requested PSBT is malformed, lacks the prevout/leaf data needed * to recompute the sighash, or the signature does not verify. */ export declare function assertScriptPathSchnorrSignature(params: VerifyScriptPathSchnorrSignatureParams): void; //# sourceMappingURL=verifyScriptPathSchnorrSignature.d.ts.map