@bitgo/wasm-utxo 1.11.0 → 1.13.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.
Binary file
@@ -1,33 +1,36 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const __wbg_addressnamespace_free: (a: number, b: number) => void;
5
+ export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
6
+ export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
4
7
  export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
5
- export const __wbg_wasmbip32_free: (a: number, b: number) => void;
6
8
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
9
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
7
10
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
8
11
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
12
+ export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
13
+ export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
14
+ export const bitgopsbt_add_paygo_attestation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
15
+ export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
16
+ export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
17
+ export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
18
+ export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
19
+ export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
20
+ export const bitgopsbt_network: (a: number, b: number) => void;
21
+ export const bitgopsbt_parse_outputs_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
22
+ export const bitgopsbt_parse_transaction_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
23
+ export const bitgopsbt_serialize: (a: number, b: number) => void;
24
+ export const bitgopsbt_sign_with_privkey: (a: number, b: number, c: number, d: number) => void;
25
+ export const bitgopsbt_sign_with_xpriv: (a: number, b: number, c: number, d: number) => void;
26
+ export const bitgopsbt_unsigned_txid: (a: number, b: number) => void;
27
+ export const bitgopsbt_verify_replay_protection_signature: (a: number, b: number, c: number, d: number) => void;
28
+ export const bitgopsbt_verify_signature_with_pub: (a: number, b: number, c: number, d: number) => void;
29
+ export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: number, d: number) => void;
30
+ export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
31
+ export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
9
32
  export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
10
33
  export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
11
- export const wasmbip32_chain_code: (a: number) => number;
12
- export const wasmbip32_depth: (a: number) => number;
13
- export const wasmbip32_derive: (a: number, b: number, c: number) => void;
14
- export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
15
- export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
16
- export const wasmbip32_fingerprint: (a: number) => number;
17
- export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
18
- export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
19
- export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
20
- export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
21
- export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
22
- export const wasmbip32_identifier: (a: number) => number;
23
- export const wasmbip32_index: (a: number) => number;
24
- export const wasmbip32_is_neutered: (a: number) => number;
25
- export const wasmbip32_neutered: (a: number) => number;
26
- export const wasmbip32_parent_fingerprint: (a: number) => number;
27
- export const wasmbip32_private_key: (a: number) => number;
28
- export const wasmbip32_public_key: (a: number) => number;
29
- export const wasmbip32_to_base58: (a: number, b: number) => void;
30
- export const wasmbip32_to_wif: (a: number, b: number) => void;
31
34
  export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
32
35
  export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
33
36
  export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
@@ -38,6 +41,9 @@ export const wasmecpair_public_key: (a: number) => number;
38
41
  export const wasmecpair_to_wif: (a: number, b: number) => void;
39
42
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
40
43
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
44
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
45
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
46
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
41
47
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
42
48
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
43
49
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
@@ -51,35 +57,29 @@ export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number)
51
57
  export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
52
58
  export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
53
59
  export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
54
- export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
55
- export const __wbg_addressnamespace_free: (a: number, b: number) => void;
56
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
57
- export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
58
- export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
59
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
60
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
61
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
62
- export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
63
- export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
60
+ export const __wbg_wasmbip32_free: (a: number, b: number) => void;
64
61
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
65
62
  export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
66
- export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
67
- export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
68
- export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
69
- export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
70
- export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
71
- export const bitgopsbt_network: (a: number, b: number) => void;
72
- export const bitgopsbt_parse_outputs_with_wallet_keys: (a: number, b: number, c: number) => void;
73
- export const bitgopsbt_parse_transaction_with_wallet_keys: (a: number, b: number, c: number, d: number) => void;
74
- export const bitgopsbt_serialize: (a: number, b: number) => void;
75
- export const bitgopsbt_sign_with_privkey: (a: number, b: number, c: number, d: number) => void;
76
- export const bitgopsbt_sign_with_xpriv: (a: number, b: number, c: number, d: number) => void;
77
- export const bitgopsbt_unsigned_txid: (a: number, b: number) => void;
78
- export const bitgopsbt_verify_replay_protection_signature: (a: number, b: number, c: number, d: number) => void;
79
- export const bitgopsbt_verify_signature_with_pub: (a: number, b: number, c: number, d: number) => void;
80
- export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: number, d: number) => void;
81
- export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
82
- export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
63
+ export const wasmbip32_chain_code: (a: number) => number;
64
+ export const wasmbip32_depth: (a: number) => number;
65
+ export const wasmbip32_derive: (a: number, b: number, c: number) => void;
66
+ export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
67
+ export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
68
+ export const wasmbip32_fingerprint: (a: number) => number;
69
+ export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
70
+ export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
71
+ export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
72
+ export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
73
+ export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
74
+ export const wasmbip32_identifier: (a: number) => number;
75
+ export const wasmbip32_index: (a: number) => number;
76
+ export const wasmbip32_is_neutered: (a: number) => number;
77
+ export const wasmbip32_neutered: (a: number) => number;
78
+ export const wasmbip32_parent_fingerprint: (a: number) => number;
79
+ export const wasmbip32_private_key: (a: number) => number;
80
+ export const wasmbip32_public_key: (a: number) => number;
81
+ export const wasmbip32_to_base58: (a: number, b: number) => void;
82
+ export const wasmbip32_to_wif: (a: number, b: number) => void;
83
83
  export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
84
84
  export const wrapdescriptor_descType: (a: number, b: number) => void;
85
85
  export const wrapdescriptor_encode: (a: number, b: number) => void;
@@ -97,12 +97,13 @@ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: num
97
97
  export const wrapminiscript_node: (a: number, b: number) => void;
98
98
  export const wrapminiscript_toAsmString: (a: number, b: number) => void;
99
99
  export const wrapminiscript_toString: (a: number, b: number) => void;
100
+ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
100
101
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
101
102
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
102
103
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
103
104
  export const rustsecp256k1_v0_10_0_default_illegal_callback_fn: (a: number, b: number) => void;
104
- export const __wbindgen_export_0: (a: number) => void;
105
- export const __wbindgen_export_1: (a: number, b: number) => number;
106
- export const __wbindgen_export_2: (a: number, b: number, c: number, d: number) => number;
105
+ export const __wbindgen_export: (a: number, b: number) => number;
106
+ export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
107
+ export const __wbindgen_export3: (a: number) => void;
107
108
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
108
- export const __wbindgen_export_3: (a: number, b: number, c: number) => void;
109
+ export const __wbindgen_export4: (a: number, b: number, c: number) => void;
@@ -27,6 +27,7 @@ export type ParsedOutput = {
27
27
  script: Uint8Array;
28
28
  value: bigint;
29
29
  scriptId: ScriptId | null;
30
+ paygo: boolean;
30
31
  };
31
32
  export type ParsedTransaction = {
32
33
  inputs: ParsedInput[];
@@ -54,9 +55,10 @@ export declare class BitGoPsbt {
54
55
  * Parse transaction with wallet keys to identify wallet inputs/outputs
55
56
  * @param walletKeys - The wallet keys to use for identification
56
57
  * @param replayProtection - Scripts that are allowed as inputs without wallet validation
58
+ * @param payGoPubkeys - Optional public keys for PayGo attestation verification
57
59
  * @returns Parsed transaction information
58
60
  */
59
- parseTransactionWithWalletKeys(walletKeys: WalletKeysArg, replayProtection: ReplayProtectionArg): ParsedTransaction;
61
+ parseTransactionWithWalletKeys(walletKeys: WalletKeysArg, replayProtection: ReplayProtectionArg, payGoPubkeys?: ECPairArg[]): ParsedTransaction;
60
62
  /**
61
63
  * Parse outputs with wallet keys to identify which outputs belong to a wallet
62
64
  * with the given wallet keys.
@@ -65,10 +67,23 @@ export declare class BitGoPsbt {
65
67
  * wallet than the inputs.
66
68
  *
67
69
  * @param walletKeys - The wallet keys to use for identification
70
+ * @param payGoPubkeys - Optional public keys for PayGo attestation verification
68
71
  * @returns Array of parsed outputs
69
72
  * @note This method does NOT validate wallet inputs. It only parses outputs.
70
73
  */
71
- parseOutputsWithWalletKeys(walletKeys: WalletKeysArg): ParsedOutput[];
74
+ parseOutputsWithWalletKeys(walletKeys: WalletKeysArg, payGoPubkeys?: ECPairArg[]): ParsedOutput[];
75
+ /**
76
+ * Add a PayGo attestation to a PSBT output
77
+ *
78
+ * This adds a cryptographic proof that the output address was authorized by a signing authority.
79
+ * The attestation is stored in PSBT proprietary key-values and can be verified later.
80
+ *
81
+ * @param outputIndex - The index of the output to add the attestation to
82
+ * @param entropy - 64 bytes of entropy (must be exactly 64 bytes)
83
+ * @param signature - ECDSA signature bytes (typically 65 bytes in recoverable format)
84
+ * @throws Error if output index is out of bounds or entropy is not 64 bytes
85
+ */
86
+ addPayGoAttestation(outputIndex: number, entropy: Uint8Array, signature: Uint8Array): void;
72
87
  /**
73
88
  * Verify if a valid signature exists for a given key at the specified input index.
74
89
  *
@@ -29,12 +29,14 @@ export class BitGoPsbt {
29
29
  * Parse transaction with wallet keys to identify wallet inputs/outputs
30
30
  * @param walletKeys - The wallet keys to use for identification
31
31
  * @param replayProtection - Scripts that are allowed as inputs without wallet validation
32
+ * @param payGoPubkeys - Optional public keys for PayGo attestation verification
32
33
  * @returns Parsed transaction information
33
34
  */
34
- parseTransactionWithWalletKeys(walletKeys, replayProtection) {
35
+ parseTransactionWithWalletKeys(walletKeys, replayProtection, payGoPubkeys) {
35
36
  const keys = RootWalletKeys.from(walletKeys);
36
37
  const rp = ReplayProtection.from(replayProtection, this.wasm.network());
37
- return this.wasm.parse_transaction_with_wallet_keys(keys.wasm, rp.wasm);
38
+ const pubkeys = payGoPubkeys?.map((arg) => ECPair.from(arg).wasm);
39
+ return this.wasm.parse_transaction_with_wallet_keys(keys.wasm, rp.wasm, pubkeys);
38
40
  }
39
41
  /**
40
42
  * Parse outputs with wallet keys to identify which outputs belong to a wallet
@@ -44,12 +46,28 @@ export class BitGoPsbt {
44
46
  * wallet than the inputs.
45
47
  *
46
48
  * @param walletKeys - The wallet keys to use for identification
49
+ * @param payGoPubkeys - Optional public keys for PayGo attestation verification
47
50
  * @returns Array of parsed outputs
48
51
  * @note This method does NOT validate wallet inputs. It only parses outputs.
49
52
  */
50
- parseOutputsWithWalletKeys(walletKeys) {
53
+ parseOutputsWithWalletKeys(walletKeys, payGoPubkeys) {
51
54
  const keys = RootWalletKeys.from(walletKeys);
52
- return this.wasm.parse_outputs_with_wallet_keys(keys.wasm);
55
+ const pubkeys = payGoPubkeys?.map((arg) => ECPair.from(arg).wasm);
56
+ return this.wasm.parse_outputs_with_wallet_keys(keys.wasm, pubkeys);
57
+ }
58
+ /**
59
+ * Add a PayGo attestation to a PSBT output
60
+ *
61
+ * This adds a cryptographic proof that the output address was authorized by a signing authority.
62
+ * The attestation is stored in PSBT proprietary key-values and can be verified later.
63
+ *
64
+ * @param outputIndex - The index of the output to add the attestation to
65
+ * @param entropy - 64 bytes of entropy (must be exactly 64 bytes)
66
+ * @param signature - ECDSA signature bytes (typically 65 bytes in recoverable format)
67
+ * @throws Error if output index is out of bounds or entropy is not 64 bytes
68
+ */
69
+ addPayGoAttestation(outputIndex, entropy, signature) {
70
+ this.wasm.add_paygo_attestation(outputIndex, entropy, signature);
53
71
  }
54
72
  /**
55
73
  * Verify if a valid signature exists for a given key at the specified input index.
@@ -1,5 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+
3
4
  export class AddressNamespace {
4
5
  private constructor();
5
6
  free(): void;
@@ -7,6 +8,7 @@ export class AddressNamespace {
7
8
  static to_output_script_with_coin(address: string, coin: string): Uint8Array;
8
9
  static from_output_script_with_coin(script: Uint8Array, coin: string, format?: string | null): string;
9
10
  }
11
+
10
12
  export class BitGoPsbt {
11
13
  private constructor();
12
14
  free(): void;
@@ -81,6 +83,19 @@ export class BitGoPsbt {
81
83
  * - `Err(WasmUtxoError)` if any input failed to finalize
82
84
  */
83
85
  finalize_all_inputs(): void;
86
+ /**
87
+ * Add a PayGo attestation to a PSBT output
88
+ *
89
+ * # Arguments
90
+ * - `output_index`: The index of the output to add the attestation to
91
+ * - `entropy`: 64 bytes of entropy
92
+ * - `signature`: ECDSA signature bytes
93
+ *
94
+ * # Returns
95
+ * - `Ok(())` if the attestation was successfully added
96
+ * - `Err(WasmUtxoError)` if the output index is out of bounds or entropy is invalid
97
+ */
98
+ add_paygo_attestation(output_index: number, entropy: Uint8Array, signature: Uint8Array): void;
84
99
  /**
85
100
  * Combine/merge data from another PSBT into this one
86
101
  *
@@ -171,11 +186,11 @@ export class BitGoPsbt {
171
186
  *
172
187
  * Note: This method does NOT validate wallet inputs. It only parses outputs.
173
188
  */
174
- parse_outputs_with_wallet_keys(wallet_keys: WasmRootWalletKeys): any;
189
+ parse_outputs_with_wallet_keys(wallet_keys: WasmRootWalletKeys, paygo_pubkeys?: WasmECPair[] | null): any;
175
190
  /**
176
191
  * Parse transaction with wallet keys to identify wallet inputs/outputs
177
192
  */
178
- parse_transaction_with_wallet_keys(wallet_keys: WasmRootWalletKeys, replay_protection: WasmReplayProtection): any;
193
+ parse_transaction_with_wallet_keys(wallet_keys: WasmRootWalletKeys, replay_protection: WasmReplayProtection, paygo_pubkeys?: WasmECPair[] | null): any;
179
194
  /**
180
195
  * Verify if a replay protection input has a valid signature
181
196
  *
@@ -206,6 +221,7 @@ export class BitGoPsbt {
206
221
  */
207
222
  serialize(): Uint8Array;
208
223
  }
224
+
209
225
  export class FixedScriptWalletNamespace {
210
226
  private constructor();
211
227
  free(): void;
@@ -213,6 +229,7 @@ export class FixedScriptWalletNamespace {
213
229
  static output_script(keys: WasmRootWalletKeys, chain: number, index: number, network: any): Uint8Array;
214
230
  static address(keys: WasmRootWalletKeys, chain: number, index: number, network: any, address_format?: string | null): string;
215
231
  }
232
+
216
233
  export class UtxolibCompatNamespace {
217
234
  private constructor();
218
235
  free(): void;
@@ -236,10 +253,7 @@ export class UtxolibCompatNamespace {
236
253
  */
237
254
  static from_output_script(script: Uint8Array, network: any, format?: string | null): string;
238
255
  }
239
- /**
240
- * WASM wrapper for BIP32 extended keys (Xpub/Xpriv)
241
- * Implements the BIP32Interface TypeScript interface
242
- */
256
+
243
257
  export class WasmBIP32 {
244
258
  private constructor();
245
259
  free(): void;
@@ -332,9 +346,7 @@ export class WasmBIP32 {
332
346
  */
333
347
  readonly index: number;
334
348
  }
335
- /**
336
- * WASM wrapper for elliptic curve key pairs (always uses compressed keys)
337
- */
349
+
338
350
  export class WasmECPair {
339
351
  private constructor();
340
352
  free(): void;
@@ -380,9 +392,7 @@ export class WasmECPair {
380
392
  */
381
393
  readonly private_key: Uint8Array | undefined;
382
394
  }
383
- /**
384
- * WASM wrapper for ReplayProtection
385
- */
395
+
386
396
  export class WasmReplayProtection {
387
397
  private constructor();
388
398
  free(): void;
@@ -400,10 +410,7 @@ export class WasmReplayProtection {
400
410
  */
401
411
  static from_output_scripts(output_scripts: Uint8Array[]): WasmReplayProtection;
402
412
  }
403
- /**
404
- * WASM wrapper for RootWalletKeys
405
- * Represents a set of three extended public keys with their derivation prefixes
406
- */
413
+
407
414
  export class WasmRootWalletKeys {
408
415
  free(): void;
409
416
  [Symbol.dispose](): void;
@@ -442,6 +449,7 @@ export class WasmRootWalletKeys {
442
449
  */
443
450
  bitgo_key(): WasmBIP32;
444
451
  }
452
+
445
453
  export class WrapDescriptor {
446
454
  private constructor();
447
455
  free(): void;
@@ -456,6 +464,7 @@ export class WrapDescriptor {
456
464
  descType(): any;
457
465
  toString(): string;
458
466
  }
467
+
459
468
  export class WrapMiniscript {
460
469
  private constructor();
461
470
  free(): void;
@@ -465,6 +474,7 @@ export class WrapMiniscript {
465
474
  encode(): Uint8Array;
466
475
  toString(): string;
467
476
  }
477
+
468
478
  export class WrapPsbt {
469
479
  private constructor();
470
480
  free(): void;