/** * Delegated-claim (depositor-as-claimer) assembly surface. * * EXPERIMENTAL. Under test, exercised on signet only. Every export here can * change shape in a minor release. The bytes they produce are not * provisional — those come from the pinned vault-wasm facade. * * These wrap the `vault-wasm` exports that let a browser produce the two * files the `vaultd vp wt` watchtower CLI consumes — `artifacts.json` and * `wots_keypair.json` — without the vault provider's cooperation, and then * run the claim from those same two files. * * Claim-time execution is part of this surface: `pinPegoutProof` verifies * the prover's Groth16 proof into the artifacts, `attachFinalizedAssert` * finalizes the Assert from it, and `finalizePayout` and * `finalizeWronglyChallenged` return broadcastable transactions. Two things * stay outside: the proof comes from the prover service, and nothing here * watches the chain for a ChallengeAssert. * * Every graph-taking export fails closed on an unsupported graph version with * `unsupported tx graph version: (supported: …)`. * * @see btc-vault docs/operations/delegated_claim.md */ import type * as VaultWasm from '../dist/generated/vault_wasm.js'; import type { WatchtowerArtifactsInputs, WotsKeypairDerivation, WronglyChallengedPsbts } from './types.js'; /** * Loads the wasm-bindgen surface. The browser and Node entries each pass * their own loader, so this surface has one implementation rather than one * copy per entry point. */ type GetWasmBindings = () => Promise; export declare function createDelegatedClaimApi(getWasmBindings: GetWasmBindings): { /** Depositor's Claim signing PSBT (base64) — spends PegIn:1, script path. */ buildClaimPsbt(txGraphVersion: number, graphJson: string): Promise; /** Claimer's Assert signing PSBT (base64) — the single WOTS input. */ buildAssertClaimerPsbt(txGraphVersion: number, graphJson: string): Promise; /** Claimer's Payout signing PSBT (base64) — input 1, Assert connector path. */ buildPayoutClaimerPsbt(txGraphVersion: number, graphJson: string): Promise; /** * Depositor's Payout signing PSBT (base64) — input 0, the PegIn UTXO * spend. Always signed: the builder no longer reads a presign-phase * depositor Payout signature off the graph, so this PSBT rides in the * same batch as the rest rather than costing a second wallet prompt. */ buildPayoutDepositorPsbt(txGraphVersion: number, graphJson: string): Promise; /** * Claimer's WronglyChallenged signing PSBTs, keyed by hex challenger * pubkey and ordered by garbled-circuit index. One signature per entry * answers one challenger's fraudulent ChallengeAssert. */ buildWronglyChallengedPsbts(txGraphVersion: number, graphJson: string): Promise; /** * Applies the depositor's signature to the Claim transaction and returns * the fully signed consensus hex — the `claim_tx` the artifacts carry. * The signature is verified before the witness is populated, so a * wrong-key signature fails here rather than at broadcast. */ finalizeClaimTx(txGraphVersion: number, graphJson: string, depositorSigHex: string): Promise; /** * Extracts the single taproot script-path signature from a signed PSBT * input, enforcing the 64-byte SIGHASH_DEFAULT form. Version-agnostic. */ extractTapScriptSig(psbtBase64: string, inputIndex: number): Promise; /** * Derives the depositor's WOTS keypair from the 64-byte `wotsSeed`. * * `keypair` is exactly the `wots_keypair.json` the watchtower CLI * accepts. The secret chains are single-use: never persist them beyond * the claim, and never reuse them — reuse leaks the WOTS key. * * @stability frozen — `HASH160(seed || block index)` is an on-chain * binding through `depositorWotsPkHash`; rotating it severs existing * vaults from their claim path. */ wotsKeypairFromSeed(wotsSeed: Uint8Array): Promise; /** * Throws unless the keypair's public keys match the ones the graph's * Claim commits to. This is the gate before WOTS secrets leave the * browser: an unbound keypair produces an Assert witness no verifier * accepts. */ validateWotsKeypairAgainstGraph(txGraphVersion: number, keypair: unknown, graphJson: string): Promise; /** * Assembles the watchtower `artifacts.json` content and returns it as the * JSON string to write verbatim — re-encoding it risks drifting from the * schema the CLI reads. * * Every claimer-side signature and the graph's own presign set are * verified before bundling, so a broken artifact surfaces here, while the * signer is still on the page, instead of months later at claim time. * * `babeSessionsJson` and `verifyingKeyHex` pass through opaquely. The * builder accepts either `{}`, an unjoined file whose sessions are joined * downstream, or a map keyed by exactly the graph's challengers * (`validate_babe_sessions` @ b534ff9e). `vaultd vp wt start-claim` * refuses an unjoined file. * * `depositorPayoutSigHex` is always signed fresh and required — the * upstream binding no longer reads a presigned one off the graph. * `expectedVaultCoreVersion` comes from the finalized `PegInSubmitted` * event and must equal the version the graph records. */ buildWatchtowerArtifacts(inputs: WatchtowerArtifactsInputs): Promise; /** * Re-verifies every claimer-side signature inside an `artifacts.json` * against its own embedded graph. Use it on a file that arrives from disk * before relying on it for a claim — an artifacts file is only as good as * the signatures in it, and nothing else checks them until the CLI runs. */ verifyWatchtowerArtifacts(txGraphVersion: number, artifactsJson: string): Promise; /** * Verifies every presigning-phase signature in a vault provider's served * graph: the VP, vault keeper and universal challenger signatures on the * Assert and Payout, and the claimer signature on each NoPayout. Resolves * only if all verify. Each signature is checked against the key the graph * carries, so binding those keys to the vault is the caller's job. */ verifyGraphPresignatures(txGraphVersion: number, graphJson: string): Promise; /** * Verifies the Groth16 pegout proof against the artifacts' verifying key * and pins it into the artifacts, returning the updated artifacts JSON. * * Persist the returned JSON before the Assert is broadcast, and finalize * the Assert from that copy only: the depositor's one-time WOTS keypair * must sign exactly one π₁, so a second, different proof is refused once * one is pinned. Re-pinning the same proof is a no-op. */ pinPegoutProof(txGraphVersion: number, artifactsJson: string, proofHex: string): Promise; /** * Finalizes the Assert from the pinned proof and the depositor's WOTS * keypair, writes it into the artifacts as `assert_tx_hex` and returns * the updated artifacts JSON. * * Hand exactly that JSON to `vaultd vp wt start-claim`: it verifies the * attached Assert instead of signing one, so the keypair never leaves * the browser. Errors when no proof is pinned. */ attachFinalizedAssert(txGraphVersion: number, artifactsJson: string, keypairJson: string): Promise; /** * Finalizes the Payout from the depositor and claimer Payout signatures * the artifacts carry, and returns the transaction hex. Broadcastable * only after the Assert relative timelock expires. */ finalizePayout(txGraphVersion: number, artifactsJson: string): Promise; /** * Finalizes one WronglyChallenged transaction from the artifacts — the * answer to a ChallengeAssert. It must confirm inside * `timelock_challenge_assert` or the challenger's NoPayout takes the * vault. */ finalizeWronglyChallenged(txGraphVersion: number, artifactsJson: string, challengerPkHex: string, gcIndex: number, preimageHex: string): Promise; }; export {}; //# sourceMappingURL=delegatedClaim.d.ts.map