@bitgo/wasm-utxo 1.21.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,236 @@
1
+ /**
2
+ * BIP-0322 Generic Signed Message Format
3
+ *
4
+ * This module implements BIP-0322 for BitGo fixed-script wallets.
5
+ * It allows proving control of wallet addresses by signing arbitrary messages.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { bip322, fixedScriptWallet } from '@bitgo/wasm-utxo';
10
+ *
11
+ * // Create wallet keys
12
+ * const walletKeys = fixedScriptWallet.RootWalletKeys.from([userXpub, backupXpub, bitgoXpub]);
13
+ *
14
+ * // Create an empty PSBT for BIP-0322 (version 0 required)
15
+ * const psbt = BitGoPsbt.createEmpty("bitcoin", walletKeys, { version: 0 });
16
+ *
17
+ * // Add BIP-0322 inputs
18
+ * const idx0 = bip322.addBip322Input(psbt, {
19
+ * message: "Hello, World!",
20
+ * scriptId: { chain: 10, index: 0 },
21
+ * rootWalletKeys: walletKeys,
22
+ * });
23
+ *
24
+ * // Sign the input
25
+ * psbt.sign(idx0, userXpriv);
26
+ * psbt.sign(idx0, bitgoXpriv);
27
+ *
28
+ * // Verify the input
29
+ * bip322.verifyBip322PsbtInput(psbt, idx0, {
30
+ * message: "Hello, World!",
31
+ * scriptId: { chain: 10, index: 0 },
32
+ * rootWalletKeys: walletKeys,
33
+ * });
34
+ * ```
35
+ */
36
+ import { BitGoPsbt, type NetworkName, type ScriptId, type SignPath } from "../fixedScriptWallet/BitGoPsbt.js";
37
+ import { type WalletKeysArg } from "../fixedScriptWallet/RootWalletKeys.js";
38
+ import { type OutputScriptType } from "../fixedScriptWallet/scriptType.js";
39
+ import { Transaction } from "../transaction.js";
40
+ export type { OutputScriptType };
41
+ /**
42
+ * Parameters for adding a BIP-0322 input to a PSBT
43
+ */
44
+ export type AddBip322InputParams = {
45
+ /** The message to sign (UTF-8 string) */
46
+ message: string;
47
+ /** The wallet script location (chain and index) */
48
+ scriptId: ScriptId;
49
+ /** The wallet's root keys */
50
+ rootWalletKeys: WalletKeysArg;
51
+ /**
52
+ * Sign path for taproot inputs (required for p2tr/p2trMusig2).
53
+ * Specifies which two keys will sign the message.
54
+ */
55
+ signPath?: SignPath;
56
+ /** Custom tag for message hashing (default: "BIP0322-signed-message") */
57
+ tag?: string;
58
+ };
59
+ /**
60
+ * Parameters for verifying a BIP-0322 input
61
+ */
62
+ export type VerifyBip322InputParams = {
63
+ /** The message that was signed */
64
+ message: string;
65
+ /** The wallet script location (chain and index) */
66
+ scriptId: ScriptId;
67
+ /** The wallet's root keys */
68
+ rootWalletKeys: WalletKeysArg;
69
+ /** Custom tag if one was used during signing */
70
+ tag?: string;
71
+ };
72
+ /**
73
+ * Parameters for verifying a BIP-0322 transaction input
74
+ */
75
+ export type VerifyBip322TxInputParams = VerifyBip322InputParams & {
76
+ /** Network name (default: "bitcoin") */
77
+ network?: NetworkName;
78
+ };
79
+ /**
80
+ * Add a BIP-0322 message input to an existing BitGoPsbt
81
+ *
82
+ * The PSBT must have version 0 per BIP-0322 specification. Use
83
+ * `BitGoPsbt.createEmpty(network, walletKeys, { version: 0 })` to create one.
84
+ *
85
+ * On the first input added, this also adds the required OP_RETURN output.
86
+ *
87
+ * @param psbt - The BitGoPsbt to add the input to (must have version 0)
88
+ * @param params - Input parameters including message, scriptId, and wallet keys
89
+ * @returns The index of the added input
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * // Create a BIP-0322 PSBT
94
+ * const psbt = BitGoPsbt.createEmpty("bitcoin", walletKeys, { version: 0 });
95
+ *
96
+ * // Add inputs
97
+ * const idx0 = bip322.addBip322Input(psbt, {
98
+ * message: "I control this address",
99
+ * scriptId: { chain: 10, index: 5 },
100
+ * rootWalletKeys: walletKeys,
101
+ * });
102
+ *
103
+ * // Sign with user and bitgo keys
104
+ * psbt.sign(idx0, userXpriv);
105
+ * psbt.sign(idx0, bitgoXpriv);
106
+ * ```
107
+ */
108
+ export declare function addBip322Input(psbt: BitGoPsbt, params: AddBip322InputParams): number;
109
+ /**
110
+ * Verify a single input of a BIP-0322 transaction proof
111
+ *
112
+ * This verifies that the specified input correctly proves control of the
113
+ * wallet address corresponding to the given message.
114
+ *
115
+ * @param tx - The signed transaction
116
+ * @param inputIndex - The index of the input to verify
117
+ * @param params - Verification parameters including message, scriptId, and wallet keys
118
+ * @throws Error if verification fails
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * // Extract and verify the transaction
123
+ * psbt.finalizeAllInputs();
124
+ * const txBytes = psbt.extractTransaction();
125
+ * const tx = Transaction.fromBytes(txBytes, "bitcoin");
126
+ *
127
+ * bip322.verifyBip322TxInput(tx, 0, {
128
+ * message: "Hello, World!",
129
+ * scriptId: { chain: 10, index: 0 },
130
+ * rootWalletKeys: walletKeys,
131
+ * network: "bitcoin",
132
+ * });
133
+ * ```
134
+ */
135
+ export declare function verifyBip322TxInput(tx: Transaction, inputIndex: number, params: VerifyBip322TxInputParams): void;
136
+ /** Signer key name */
137
+ export type SignerName = "user" | "backup" | "bitgo";
138
+ /** Triple of hex-encoded pubkeys [user, backup, bitgo] */
139
+ export type PubkeyTriple = [string, string, string];
140
+ /**
141
+ * Parameters for verifying a BIP-0322 input with pubkeys
142
+ */
143
+ export type VerifyBip322WithPubkeysParams = {
144
+ /** The message that was signed */
145
+ message: string;
146
+ /** Hex-encoded pubkeys [user, backup, bitgo] */
147
+ pubkeys: PubkeyTriple;
148
+ /** Script type */
149
+ scriptType: OutputScriptType;
150
+ /** For taproot types, whether script path was used */
151
+ isScriptPath?: boolean;
152
+ /** Custom tag if one was used during signing */
153
+ tag?: string;
154
+ };
155
+ /**
156
+ * Parameters for verifying a BIP-0322 transaction input with pubkeys
157
+ */
158
+ export type VerifyBip322TxWithPubkeysParams = VerifyBip322WithPubkeysParams;
159
+ /**
160
+ * Verify a single input of a BIP-0322 PSBT proof
161
+ *
162
+ * This verifies that the specified input correctly proves control of the
163
+ * wallet address by checking:
164
+ * - The PSBT structure follows BIP-0322 (version 0, OP_RETURN output)
165
+ * - The input references the correct virtual to_spend transaction
166
+ * - At least one valid signature exists from the wallet keys
167
+ *
168
+ * @param psbt - The signed PSBT
169
+ * @param inputIndex - The index of the input to verify
170
+ * @param params - Verification parameters including message, scriptId, and wallet keys
171
+ * @returns An array of signer names ("user", "backup", "bitgo") that have valid signatures
172
+ * @throws Error if verification fails or no valid signatures found
173
+ *
174
+ * @example
175
+ * ```typescript
176
+ * // Verify the signed PSBT input
177
+ * const signers = bip322.verifyBip322PsbtInput(psbt, 0, {
178
+ * message: "Hello, World!",
179
+ * scriptId: { chain: 10, index: 0 },
180
+ * rootWalletKeys: walletKeys,
181
+ * });
182
+ * console.log(signers); // ["user", "bitgo"]
183
+ * ```
184
+ */
185
+ export declare function verifyBip322PsbtInput(psbt: BitGoPsbt, inputIndex: number, params: VerifyBip322InputParams): SignerName[];
186
+ /**
187
+ * Verify a single input of a BIP-0322 PSBT proof using pubkeys directly
188
+ *
189
+ * This verifies that the specified input correctly proves control of the
190
+ * wallet address by checking:
191
+ * - The PSBT structure follows BIP-0322 (version 0, OP_RETURN output)
192
+ * - The input references the correct virtual to_spend transaction
193
+ * - At least one valid signature exists from the provided pubkeys
194
+ *
195
+ * @param psbt - The signed PSBT
196
+ * @param inputIndex - The index of the input to verify
197
+ * @param params - Verification parameters including message, pubkeys, and script type
198
+ * @returns An array of pubkey indices (0, 1, 2) that have valid signatures
199
+ * @throws Error if verification fails or no valid signatures found
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * // Verify the signed PSBT input with pubkeys
204
+ * const signerIndices = bip322.verifyBip322PsbtInputWithPubkeys(psbt, 0, {
205
+ * message: "Hello, World!",
206
+ * pubkeys: [userPubkey, backupPubkey, bitgoPubkey],
207
+ * scriptType: "p2shP2wsh",
208
+ * });
209
+ * console.log(signerIndices); // [0, 2] for user+bitgo
210
+ * ```
211
+ */
212
+ export declare function verifyBip322PsbtInputWithPubkeys(psbt: BitGoPsbt, inputIndex: number, params: VerifyBip322WithPubkeysParams): number[];
213
+ /**
214
+ * Verify a single input of a BIP-0322 transaction proof using pubkeys directly
215
+ *
216
+ * This verifies that the specified input correctly proves control of the
217
+ * wallet address corresponding to the given message.
218
+ *
219
+ * @param tx - The signed transaction
220
+ * @param inputIndex - The index of the input to verify
221
+ * @param params - Verification parameters including message, pubkeys, and script type
222
+ * @returns An array of pubkey indices (0, 1, 2) that have valid signatures
223
+ * @throws Error if verification fails
224
+ *
225
+ * @example
226
+ * ```typescript
227
+ * // Verify the signed transaction input with pubkeys
228
+ * const signerIndices = bip322.verifyBip322TxInputWithPubkeys(tx, 0, {
229
+ * message: "Hello, World!",
230
+ * pubkeys: [userPubkey, backupPubkey, bitgoPubkey],
231
+ * scriptType: "p2wsh",
232
+ * });
233
+ * console.log(signerIndices); // [0, 2] for user+bitgo
234
+ * ```
235
+ */
236
+ export declare function verifyBip322TxInputWithPubkeys(tx: Transaction, inputIndex: number, params: VerifyBip322TxWithPubkeysParams): number[];
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ /**
3
+ * BIP-0322 Generic Signed Message Format
4
+ *
5
+ * This module implements BIP-0322 for BitGo fixed-script wallets.
6
+ * It allows proving control of wallet addresses by signing arbitrary messages.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { bip322, fixedScriptWallet } from '@bitgo/wasm-utxo';
11
+ *
12
+ * // Create wallet keys
13
+ * const walletKeys = fixedScriptWallet.RootWalletKeys.from([userXpub, backupXpub, bitgoXpub]);
14
+ *
15
+ * // Create an empty PSBT for BIP-0322 (version 0 required)
16
+ * const psbt = BitGoPsbt.createEmpty("bitcoin", walletKeys, { version: 0 });
17
+ *
18
+ * // Add BIP-0322 inputs
19
+ * const idx0 = bip322.addBip322Input(psbt, {
20
+ * message: "Hello, World!",
21
+ * scriptId: { chain: 10, index: 0 },
22
+ * rootWalletKeys: walletKeys,
23
+ * });
24
+ *
25
+ * // Sign the input
26
+ * psbt.sign(idx0, userXpriv);
27
+ * psbt.sign(idx0, bitgoXpriv);
28
+ *
29
+ * // Verify the input
30
+ * bip322.verifyBip322PsbtInput(psbt, idx0, {
31
+ * message: "Hello, World!",
32
+ * scriptId: { chain: 10, index: 0 },
33
+ * rootWalletKeys: walletKeys,
34
+ * });
35
+ * ```
36
+ */
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.addBip322Input = addBip322Input;
39
+ exports.verifyBip322TxInput = verifyBip322TxInput;
40
+ exports.verifyBip322PsbtInput = verifyBip322PsbtInput;
41
+ exports.verifyBip322PsbtInputWithPubkeys = verifyBip322PsbtInputWithPubkeys;
42
+ exports.verifyBip322TxInputWithPubkeys = verifyBip322TxInputWithPubkeys;
43
+ const wasm_utxo_js_1 = require("../wasm/wasm_utxo.js");
44
+ const RootWalletKeys_js_1 = require("../fixedScriptWallet/RootWalletKeys.js");
45
+ /**
46
+ * Add a BIP-0322 message input to an existing BitGoPsbt
47
+ *
48
+ * The PSBT must have version 0 per BIP-0322 specification. Use
49
+ * `BitGoPsbt.createEmpty(network, walletKeys, { version: 0 })` to create one.
50
+ *
51
+ * On the first input added, this also adds the required OP_RETURN output.
52
+ *
53
+ * @param psbt - The BitGoPsbt to add the input to (must have version 0)
54
+ * @param params - Input parameters including message, scriptId, and wallet keys
55
+ * @returns The index of the added input
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * // Create a BIP-0322 PSBT
60
+ * const psbt = BitGoPsbt.createEmpty("bitcoin", walletKeys, { version: 0 });
61
+ *
62
+ * // Add inputs
63
+ * const idx0 = bip322.addBip322Input(psbt, {
64
+ * message: "I control this address",
65
+ * scriptId: { chain: 10, index: 5 },
66
+ * rootWalletKeys: walletKeys,
67
+ * });
68
+ *
69
+ * // Sign with user and bitgo keys
70
+ * psbt.sign(idx0, userXpriv);
71
+ * psbt.sign(idx0, bitgoXpriv);
72
+ * ```
73
+ */
74
+ function addBip322Input(psbt, params) {
75
+ const keys = RootWalletKeys_js_1.RootWalletKeys.from(params.rootWalletKeys);
76
+ return wasm_utxo_js_1.Bip322Namespace.add_bip322_input(psbt.wasm, params.message, params.scriptId.chain, params.scriptId.index, keys.wasm, params.signPath?.signer, params.signPath?.cosigner, params.tag);
77
+ }
78
+ /**
79
+ * Verify a single input of a BIP-0322 transaction proof
80
+ *
81
+ * This verifies that the specified input correctly proves control of the
82
+ * wallet address corresponding to the given message.
83
+ *
84
+ * @param tx - The signed transaction
85
+ * @param inputIndex - The index of the input to verify
86
+ * @param params - Verification parameters including message, scriptId, and wallet keys
87
+ * @throws Error if verification fails
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * // Extract and verify the transaction
92
+ * psbt.finalizeAllInputs();
93
+ * const txBytes = psbt.extractTransaction();
94
+ * const tx = Transaction.fromBytes(txBytes, "bitcoin");
95
+ *
96
+ * bip322.verifyBip322TxInput(tx, 0, {
97
+ * message: "Hello, World!",
98
+ * scriptId: { chain: 10, index: 0 },
99
+ * rootWalletKeys: walletKeys,
100
+ * network: "bitcoin",
101
+ * });
102
+ * ```
103
+ */
104
+ function verifyBip322TxInput(tx, inputIndex, params) {
105
+ const keys = RootWalletKeys_js_1.RootWalletKeys.from(params.rootWalletKeys);
106
+ const network = params.network ?? "bitcoin";
107
+ wasm_utxo_js_1.Bip322Namespace.verify_bip322_tx_input(tx.wasm, inputIndex, params.message, params.scriptId.chain, params.scriptId.index, keys.wasm, network, params.tag);
108
+ }
109
+ /**
110
+ * Verify a single input of a BIP-0322 PSBT proof
111
+ *
112
+ * This verifies that the specified input correctly proves control of the
113
+ * wallet address by checking:
114
+ * - The PSBT structure follows BIP-0322 (version 0, OP_RETURN output)
115
+ * - The input references the correct virtual to_spend transaction
116
+ * - At least one valid signature exists from the wallet keys
117
+ *
118
+ * @param psbt - The signed PSBT
119
+ * @param inputIndex - The index of the input to verify
120
+ * @param params - Verification parameters including message, scriptId, and wallet keys
121
+ * @returns An array of signer names ("user", "backup", "bitgo") that have valid signatures
122
+ * @throws Error if verification fails or no valid signatures found
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * // Verify the signed PSBT input
127
+ * const signers = bip322.verifyBip322PsbtInput(psbt, 0, {
128
+ * message: "Hello, World!",
129
+ * scriptId: { chain: 10, index: 0 },
130
+ * rootWalletKeys: walletKeys,
131
+ * });
132
+ * console.log(signers); // ["user", "bitgo"]
133
+ * ```
134
+ */
135
+ function verifyBip322PsbtInput(psbt, inputIndex, params) {
136
+ const keys = RootWalletKeys_js_1.RootWalletKeys.from(params.rootWalletKeys);
137
+ return wasm_utxo_js_1.Bip322Namespace.verify_bip322_psbt_input(psbt.wasm, inputIndex, params.message, params.scriptId.chain, params.scriptId.index, keys.wasm, params.tag);
138
+ }
139
+ /**
140
+ * Verify a single input of a BIP-0322 PSBT proof using pubkeys directly
141
+ *
142
+ * This verifies that the specified input correctly proves control of the
143
+ * wallet address by checking:
144
+ * - The PSBT structure follows BIP-0322 (version 0, OP_RETURN output)
145
+ * - The input references the correct virtual to_spend transaction
146
+ * - At least one valid signature exists from the provided pubkeys
147
+ *
148
+ * @param psbt - The signed PSBT
149
+ * @param inputIndex - The index of the input to verify
150
+ * @param params - Verification parameters including message, pubkeys, and script type
151
+ * @returns An array of pubkey indices (0, 1, 2) that have valid signatures
152
+ * @throws Error if verification fails or no valid signatures found
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * // Verify the signed PSBT input with pubkeys
157
+ * const signerIndices = bip322.verifyBip322PsbtInputWithPubkeys(psbt, 0, {
158
+ * message: "Hello, World!",
159
+ * pubkeys: [userPubkey, backupPubkey, bitgoPubkey],
160
+ * scriptType: "p2shP2wsh",
161
+ * });
162
+ * console.log(signerIndices); // [0, 2] for user+bitgo
163
+ * ```
164
+ */
165
+ function verifyBip322PsbtInputWithPubkeys(psbt, inputIndex, params) {
166
+ return Array.from(wasm_utxo_js_1.Bip322Namespace.verify_bip322_psbt_input_with_pubkeys(psbt.wasm, inputIndex, params.message, params.pubkeys, params.scriptType, params.isScriptPath, params.tag));
167
+ }
168
+ /**
169
+ * Verify a single input of a BIP-0322 transaction proof using pubkeys directly
170
+ *
171
+ * This verifies that the specified input correctly proves control of the
172
+ * wallet address corresponding to the given message.
173
+ *
174
+ * @param tx - The signed transaction
175
+ * @param inputIndex - The index of the input to verify
176
+ * @param params - Verification parameters including message, pubkeys, and script type
177
+ * @returns An array of pubkey indices (0, 1, 2) that have valid signatures
178
+ * @throws Error if verification fails
179
+ *
180
+ * @example
181
+ * ```typescript
182
+ * // Verify the signed transaction input with pubkeys
183
+ * const signerIndices = bip322.verifyBip322TxInputWithPubkeys(tx, 0, {
184
+ * message: "Hello, World!",
185
+ * pubkeys: [userPubkey, backupPubkey, bitgoPubkey],
186
+ * scriptType: "p2wsh",
187
+ * });
188
+ * console.log(signerIndices); // [0, 2] for user+bitgo
189
+ * ```
190
+ */
191
+ function verifyBip322TxInputWithPubkeys(tx, inputIndex, params) {
192
+ return Array.from(wasm_utxo_js_1.Bip322Namespace.verify_bip322_tx_input_with_pubkeys(tx.wasm, inputIndex, params.message, params.pubkeys, params.scriptType, params.isScriptPath, params.tag));
193
+ }
@@ -1,5 +1,6 @@
1
1
  export * as address from "./address.js";
2
2
  export * as ast from "./ast/index.js";
3
+ export * as bip322 from "./bip322/index.js";
3
4
  export * as utxolibCompat from "./utxolibCompat.js";
4
5
  export * as fixedScriptWallet from "./fixedScriptWallet/index.js";
5
6
  export * as bip32 from "./bip32.js";
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ZcashTransaction = exports.Transaction = exports.DashTransaction = exports.Psbt = exports.Miniscript = exports.Descriptor = exports.Dimensions = exports.BIP32 = exports.ECPair = exports.ecpair = exports.bip32 = exports.fixedScriptWallet = exports.utxolibCompat = exports.ast = exports.address = void 0;
36
+ exports.ZcashTransaction = exports.Transaction = exports.DashTransaction = exports.Psbt = exports.Miniscript = exports.Descriptor = exports.Dimensions = exports.BIP32 = exports.ECPair = exports.ecpair = exports.bip32 = exports.fixedScriptWallet = exports.utxolibCompat = exports.bip322 = exports.ast = exports.address = void 0;
37
37
  const wasm = __importStar(require("./wasm/wasm_utxo.js"));
38
38
  // we need to access the wasm module here, otherwise webpack gets all weird
39
39
  // and forgets to include it in the bundle
@@ -42,6 +42,7 @@ void wasm;
42
42
  // and to make imports more explicit (e.g., `import { address } from '@bitgo/wasm-utxo'`)
43
43
  exports.address = __importStar(require("./address.js"));
44
44
  exports.ast = __importStar(require("./ast/index.js"));
45
+ exports.bip322 = __importStar(require("./bip322/index.js"));
45
46
  exports.utxolibCompat = __importStar(require("./utxolibCompat.js"));
46
47
  exports.fixedScriptWallet = __importStar(require("./fixedScriptWallet/index.js"));
47
48
  exports.bip32 = __importStar(require("./bip32.js"));
@@ -9,6 +9,106 @@ export class AddressNamespace {
9
9
  static from_output_script_with_coin(script: Uint8Array, coin: string, format?: string | null): string;
10
10
  }
11
11
 
12
+ export class Bip322Namespace {
13
+ private constructor();
14
+ free(): void;
15
+ [Symbol.dispose](): void;
16
+ /**
17
+ * Add a BIP-0322 message input to an existing BitGoPsbt
18
+ *
19
+ * If this is the first input, also adds the OP_RETURN output.
20
+ * The PSBT must have version 0 per BIP-0322 specification.
21
+ *
22
+ * # Arguments
23
+ * * `psbt` - The BitGoPsbt to add the input to
24
+ * * `message` - The message to sign
25
+ * * `chain` - The wallet chain (e.g., 10 for external, 20 for internal)
26
+ * * `index` - The address index
27
+ * * `wallet_keys` - The wallet's root keys
28
+ * * `signer` - Optional signer key name for taproot (e.g., "user", "backup", "bitgo")
29
+ * * `cosigner` - Optional cosigner key name for taproot
30
+ * * `tag` - Optional custom tag for message hashing
31
+ *
32
+ * # Returns
33
+ * The index of the added input
34
+ */
35
+ static add_bip322_input(psbt: BitGoPsbt, message: string, chain: number, index: number, wallet_keys: WasmRootWalletKeys, signer?: string | null, cosigner?: string | null, tag?: string | null): number;
36
+ /**
37
+ * Verify a single input of a BIP-0322 transaction proof
38
+ *
39
+ * # Arguments
40
+ * * `tx` - The signed transaction
41
+ * * `input_index` - The index of the input to verify
42
+ * * `message` - The message that was signed
43
+ * * `chain` - The wallet chain
44
+ * * `index` - The address index
45
+ * * `wallet_keys` - The wallet's root keys
46
+ * * `network` - Network name
47
+ * * `tag` - Optional custom tag for message hashing
48
+ *
49
+ * # Throws
50
+ * Throws an error if verification fails
51
+ */
52
+ static verify_bip322_tx_input(tx: WasmTransaction, input_index: number, message: string, chain: number, index: number, wallet_keys: WasmRootWalletKeys, network: string, tag?: string | null): void;
53
+ /**
54
+ * Verify a single input of a BIP-0322 PSBT proof
55
+ *
56
+ * # Arguments
57
+ * * `psbt` - The signed BitGoPsbt
58
+ * * `input_index` - The index of the input to verify
59
+ * * `message` - The message that was signed
60
+ * * `chain` - The wallet chain
61
+ * * `index` - The address index
62
+ * * `wallet_keys` - The wallet's root keys
63
+ * * `tag` - Optional custom tag for message hashing
64
+ *
65
+ * # Returns
66
+ * An array of signer names ("user", "backup", "bitgo") that have valid signatures
67
+ *
68
+ * # Throws
69
+ * Throws an error if verification fails or no valid signatures found
70
+ */
71
+ static verify_bip322_psbt_input(psbt: BitGoPsbt, input_index: number, message: string, chain: number, index: number, wallet_keys: WasmRootWalletKeys, tag?: string | null): string[];
72
+ /**
73
+ * Verify a single input of a BIP-0322 transaction proof using pubkeys directly
74
+ *
75
+ * # Arguments
76
+ * * `tx` - The signed transaction
77
+ * * `input_index` - The index of the input to verify
78
+ * * `message` - The message that was signed
79
+ * * `pubkeys` - Array of 3 hex-encoded pubkeys [user, backup, bitgo]
80
+ * * `script_type` - One of: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
81
+ * * `is_script_path` - For taproot types, whether script path was used
82
+ * * `tag` - Optional custom tag for message hashing
83
+ *
84
+ * # Returns
85
+ * An array of pubkey indices (0, 1, 2) that have valid signatures
86
+ *
87
+ * # Throws
88
+ * Throws an error if verification fails
89
+ */
90
+ static verify_bip322_tx_input_with_pubkeys(tx: WasmTransaction, input_index: number, message: string, pubkeys: string[], script_type: string, is_script_path?: boolean | null, tag?: string | null): Uint32Array;
91
+ /**
92
+ * Verify a single input of a BIP-0322 PSBT proof using pubkeys directly
93
+ *
94
+ * # Arguments
95
+ * * `psbt` - The signed BitGoPsbt
96
+ * * `input_index` - The index of the input to verify
97
+ * * `message` - The message that was signed
98
+ * * `pubkeys` - Array of 3 hex-encoded pubkeys [user, backup, bitgo]
99
+ * * `script_type` - One of: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
100
+ * * `is_script_path` - For taproot types, whether script path was used
101
+ * * `tag` - Optional custom tag for message hashing
102
+ *
103
+ * # Returns
104
+ * An array of pubkey indices (0, 1, 2) that have valid signatures
105
+ *
106
+ * # Throws
107
+ * Throws an error if verification fails or no valid signatures found
108
+ */
109
+ static verify_bip322_psbt_input_with_pubkeys(psbt: BitGoPsbt, input_index: number, message: string, pubkeys: string[], script_type: string, is_script_path?: boolean | null, tag?: string | null): Uint32Array;
110
+ }
111
+
12
112
  export class BitGoPsbt {
13
113
  private constructor();
14
114
  free(): void;