@starknetfoundation/krusty-kms-wasm 0.13.0 → 0.15.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.
package/README.md CHANGED
@@ -40,6 +40,15 @@ import init from "@starknetfoundation/krusty-kms-wasm";
40
40
  export const krustyReady = init();
41
41
  ```
42
42
 
43
+ ## Secrets
44
+
45
+ Exports that take a secret (mnemonic, passphrase, password, private key,
46
+ seed, symmetric key, plaintext) wipe their WASM copy of it when the call
47
+ returns. They cannot wipe your JavaScript string, and a non-ASCII string can
48
+ leave a partial copy in freed WASM memory. Secrets an export returns (derived
49
+ or decrypted keys, mnemonics, plaintexts, viewing keys) are plain JavaScript
50
+ strings: keep them out of logs and persistent storage.
51
+
43
52
  This package is generated with `wasm-pack --target web` and is intended for
44
53
  browser-oriented ESM toolchains that support loading WebAssembly modules.
45
54
 
@@ -115,6 +115,38 @@ export class WasmAccountState {
115
115
  pending_balance: string;
116
116
  }
117
117
 
118
+ /**
119
+ * BIP-84 mainnet P2WPKH keypair.
120
+ *
121
+ * # Security / threat model
122
+ *
123
+ * `private_key` is a plain hex string in the JS heap and cannot be reliably
124
+ * wiped. The copy this object owns in WASM memory is zeroized when the
125
+ * object is freed, as for [`crate::WasmKeypair`]. `Debug` redacts the
126
+ * private key; default `Serialize` omits it.
127
+ */
128
+ export class WasmBitcoinP2wpkhKeypair {
129
+ private constructor();
130
+ free(): void;
131
+ [Symbol.dispose](): void;
132
+ /**
133
+ * Lowercase `bc1q…` P2WPKH address.
134
+ */
135
+ address: string;
136
+ /**
137
+ * Derivation path, e.g. `m/84'/0'/0'/0/0`.
138
+ */
139
+ path: string;
140
+ /**
141
+ * Private key as 64 hex chars (no 0x prefix). Treat as secret.
142
+ */
143
+ private_key: string;
144
+ /**
145
+ * Compressed SEC1 public key as 66 hex chars (no 0x prefix).
146
+ */
147
+ public_key: string;
148
+ }
149
+
118
150
  /**
119
151
  * ElGamal ciphertext (L, R points).
120
152
  */
@@ -398,6 +430,44 @@ export class WasmPublicKey {
398
430
  public_key_y: string;
399
431
  }
400
432
 
433
+ /**
434
+ * The public commitments of one vault and their root.
435
+ */
436
+ export class WasmQsbCommitments {
437
+ private constructor();
438
+ free(): void;
439
+ [Symbol.dispose](): void;
440
+ /**
441
+ * The commitment root `R[v]` (64 lowercase hex chars).
442
+ */
443
+ root: string;
444
+ /**
445
+ * The 150 round-0 commitments `c[v][0][i]`, in index order (40 lowercase hex chars each).
446
+ */
447
+ round0: string[];
448
+ /**
449
+ * The 150 round-1 commitments `c[v][1][i]`, in index order (40 lowercase hex chars each).
450
+ */
451
+ round1: string[];
452
+ }
453
+
454
+ /**
455
+ * The transaction binding of a disclosure request.
456
+ */
457
+ export class WasmQsbRevealDigest {
458
+ private constructor();
459
+ free(): void;
460
+ [Symbol.dispose](): void;
461
+ /**
462
+ * `B = SHA256(T)` (64 lowercase hex chars).
463
+ */
464
+ binding: string;
465
+ /**
466
+ * `D = SHA256("QSB-HORS-v1/reveal" || I || B)` (64 lowercase hex chars).
467
+ */
468
+ digest: string;
469
+ }
470
+
401
471
  /**
402
472
  * Parameters for generating a ragequit proof.
403
473
  */
@@ -1102,6 +1172,23 @@ export function deriveArgentLegacyKeypair(mnemonic: string, address_index: numbe
1102
1172
  */
1103
1173
  export function deriveArgentLegacyPublicKey(mnemonic: string, address_index: number, account_index: number): WasmStarkXOnlyPublicKey;
1104
1174
 
1175
+ /**
1176
+ * Derive the BIP-84 mainnet P2WPKH keypair at
1177
+ * `m/84'/0'/{account_index}'/{change}/{address_index}`.
1178
+ *
1179
+ * # Security / threat model
1180
+ *
1181
+ * Returns the private key as a hex string in the JS heap.
1182
+ *
1183
+ * # Arguments
1184
+ * * `mnemonic` - BIP-39 mnemonic
1185
+ * * `account_index` - hardened account index, an integer below 2^31
1186
+ * * `change` - 0 for receiving, 1 for change
1187
+ * * `address_index` - address index, an integer below 2^31
1188
+ * * `passphrase` - Optional BIP-39 passphrase
1189
+ */
1190
+ export function deriveBitcoinP2wpkhKeypair(mnemonic: string, account_index: number, change: number, address_index: number, passphrase?: string | null): WasmBitcoinP2wpkhKeypair;
1191
+
1105
1192
  /**
1106
1193
  * Derive a Braavos account contract address from a public key.
1107
1194
  *
@@ -1235,6 +1322,21 @@ export function deriveOzAccountAddress(public_key_x: string, class_hash: string,
1235
1322
  */
1236
1323
  export function derivePublicKey(mnemonic: string, address_index: number, account_index: number, passphrase?: string | null): WasmPublicKey;
1237
1324
 
1325
+ /**
1326
+ * Derive the 2 × 150 commitments and the root of a QSB vault.
1327
+ *
1328
+ * `net` is `0` (Bitcoin mainnet) or `1` (shared test namespace) and
1329
+ * `vault_index` is below `2^31`; both are validated before the mnemonic is
1330
+ * read. Deriving commitments does not allocate the vault.
1331
+ *
1332
+ * # Arguments
1333
+ * * `mnemonic` - BIP-39 mnemonic of the dedicated QSB phrase
1334
+ * * `net` - Derivation namespace
1335
+ * * `vault_index` - Vault index `v`
1336
+ * * `passphrase` - Optional BIP-39 passphrase
1337
+ */
1338
+ export function deriveQsbCommitments(mnemonic: string, net: number, vault_index: number, passphrase?: string | null): WasmQsbCommitments;
1339
+
1238
1340
  /**
1239
1341
  * Derive a chain- and pool-scoped STRK20 viewing key.
1240
1342
  */
@@ -1769,6 +1871,17 @@ export function poseidonHash(a: string, b: string): string;
1769
1871
  */
1770
1872
  export function poseidonHashMany(inputs: string[]): string;
1771
1873
 
1874
+ /**
1875
+ * Compute `B` and `D` for a disclosure request.
1876
+ *
1877
+ * `transaction_hex` is the BIP's `T` as lowercase hex: the full legacy
1878
+ * serialization with every scriptSig empty and no witness. Krusty parses it
1879
+ * and refuses anything else; it never accepts a caller-supplied hash.
1880
+ * `round0` must hold 8 and `round1` 7 distinct indices below 150, in the
1881
+ * order the spend reveals them.
1882
+ */
1883
+ export function qsbRevealDigest(transaction_hex: string, round0: number[], round1: number[]): WasmQsbRevealDigest;
1884
+
1772
1885
  /**
1773
1886
  * Generate random bytes and return them as a hex string.
1774
1887
  *
@@ -1789,6 +1902,20 @@ export function randomBytesHex(length: number): string;
1789
1902
  */
1790
1903
  export function randomFelt(): string;
1791
1904
 
1905
+ /**
1906
+ * Reveal the 15 preimages a disclosure request names.
1907
+ *
1908
+ * Returns 15 lowercase hex strings: round 0's then round 1's, in the given
1909
+ * order. Every parameter is validated before the mnemonic is read.
1910
+ *
1911
+ * # Security / threat model
1912
+ *
1913
+ * Call only after durably recording this request as `exposed`. The returned
1914
+ * preimages are spending secrets. The Rust-side preimages and their hex
1915
+ * encoding are wiped before returning; the JS strings cannot be wiped.
1916
+ */
1917
+ export function revealQsbPreimages(mnemonic: string, net: number, vault_index: number, round0: number[], round1: number[], passphrase?: string | null): string[];
1918
+
1792
1919
  /**
1793
1920
  * Multiply a point by a scalar.
1794
1921
  *
@@ -1825,6 +1952,42 @@ export function scalarMulGenerator(scalar: string): WasmPoint;
1825
1952
  */
1826
1953
  export function serializePublicKey(x: string, y: string): string;
1827
1954
 
1955
+ /**
1956
+ * Sign a UTF-8 message with a BIP-322 "simple" signature for this key's
1957
+ * P2WPKH address.
1958
+ *
1959
+ * Returns the `smp`-prefixed base64 witness that BIP-322 requires of
1960
+ * signers. Pass `legacy_unprefixed = true` only for a verifier that predates
1961
+ * the prefix (for example `bip322-js` 4.0.0); strict verifiers may reject the
1962
+ * unprefixed form.
1963
+ *
1964
+ * # Arguments
1965
+ * * `private_key` - 64 hex chars (no 0x prefix), secp256k1 private key
1966
+ * * `address` - must be this key's mainnet P2WPKH address
1967
+ * * `message` - the message; signed as its UTF-8 bytes
1968
+ * * `legacy_unprefixed` - optional boolean, `false` when omitted
1969
+ */
1970
+ export function signBip322Simple(private_key: string, address: string, message: string, legacy_unprefixed?: boolean): string;
1971
+
1972
+ /**
1973
+ * Add this key's SIGHASH_ALL partial signature to the listed inputs of a
1974
+ * base64 PSBT (version 0) and return the PSBT as base64. Signatures are
1975
+ * low-R and low-S, as Bitcoin Core signs: at most 71 bytes each.
1976
+ *
1977
+ * Each listed input must be this key's P2WPKH coin, proven by a
1978
+ * `witness_utxo` that matches the spent output of its full
1979
+ * `non_witness_utxo`, and must not request a sighash type other than
1980
+ * SIGHASH_ALL. Every other input and field is returned byte-identical. The
1981
+ * PSBT is not finalized or broadcast.
1982
+ *
1983
+ * # Arguments
1984
+ * * `private_key` - 64 hex chars (no 0x prefix), secp256k1 private key
1985
+ * * `psbt_base64` - the PSBT, standard base64 with padding
1986
+ * * `input_indices` - a plain array of input numbers to sign; non-empty,
1987
+ * distinct and in range (typed arrays are refused)
1988
+ */
1989
+ export function signBitcoinPsbtInputs(private_key: string, psbt_base64: string, input_indices: number[]): string;
1990
+
1828
1991
  /**
1829
1992
  * Sign a 32-byte Nostr event id using BIP-340 Schnorr.
1830
1993
  *
@@ -2236,41 +2399,16 @@ export interface InitOutput {
2236
2399
  readonly __wbg_get_wasmstarkxonlykeypair_private_key: (a: number) => [number, number];
2237
2400
  readonly __wbg_get_wasmstarkxonlykeypair_public_key_x: (a: number) => [number, number];
2238
2401
  readonly __wbg_get_wasmstarkxonlypublickey_public_key_x: (a: number) => [number, number];
2239
- readonly deserializePublicKey: (a: number, b: number) => [number, number, number];
2240
- readonly getBuildInfo: () => any;
2241
- readonly getGenerator: () => number;
2242
- readonly getVersion: () => [number, number];
2243
- readonly grindKey: (a: number, b: number) => [number, number, number, number];
2244
- readonly init: () => void;
2245
- readonly isValidFelt: (a: number, b: number) => number;
2246
- readonly isValidStarkPrivateKey: (a: number, b: number) => number;
2247
- readonly nostrPublicKey: (a: number, b: number) => [number, number, number, number];
2248
- readonly pointAdd: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
2249
- readonly poseidonHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2250
- readonly poseidonHashMany: (a: number, b: number) => [number, number, number, number];
2251
- readonly randomBytesHex: (a: number) => [number, number, number, number];
2252
- readonly randomFelt: () => [number, number, number, number];
2253
- readonly scalarMul: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
2254
- readonly scalarMulGenerator: (a: number, b: number) => [number, number, number];
2255
- readonly serializePublicKey: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2256
- readonly signNostrEventId: (a: number, b: number, c: number, d: number) => [number, number, number];
2257
- readonly signNostrMessage: (a: number, b: number, c: number, d: number) => [number, number, number];
2258
- readonly signStarkHash: (a: number, b: number, c: number, d: number) => [number, number, number];
2259
- readonly starkPublicKey: (a: number, b: number) => [number, number, number, number];
2260
- readonly openNostrApplicationData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
2261
- readonly wrapNostrApplicationData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
2262
2402
  readonly calculateContractAddress: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
2263
2403
  readonly deriveArgentAccountAddress: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2264
2404
  readonly deriveArgentAccountAddressWithGuardian: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
2265
2405
  readonly deriveBraavosAccountAddress: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2266
2406
  readonly deriveOzAccountAddress: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
2267
- readonly deriveScopedStrk20ViewingKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
2268
- readonly deriveStrk20ViewingKey: (a: number, b: number) => [number, number, number, number];
2269
- readonly foldStrk20ViewingKey: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
2270
2407
  readonly getAccountClassHashes: () => [number, number];
2271
2408
  readonly getAccountClassRegistry: () => [number, number, number, number];
2272
2409
  readonly inspectAccountDeployment: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
2273
- readonly strk20ViewingKeyMessageHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2410
+ readonly openNostrApplicationData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
2411
+ readonly wrapNostrApplicationData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
2274
2412
  readonly computeDeclareTransactionHashV2: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
2275
2413
  readonly computeDeclareTransactionHashV3: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: any, n: number, o: number, p: number, q: number, r: number, s: number) => [number, number, number, number];
2276
2414
  readonly computeDeployAccountTransactionHashV1: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => [number, number, number, number];
@@ -2278,50 +2416,66 @@ export interface InitOutput {
2278
2416
  readonly computeInvokeTransactionHashV1: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number, number];
2279
2417
  readonly computeInvokeTransactionHashV3: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: any, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number) => [number, number, number, number];
2280
2418
  readonly computeTypedDataMessageHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2281
- readonly getSelectorFromName: (a: number, b: number) => [number, number, number, number];
2282
- readonly pedersenHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2283
- readonly pedersenHashMany: (a: number, b: number) => [number, number, number, number];
2284
- readonly starknetKeccak: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2285
- readonly compileCalls: (a: number, b: number) => [number, number, number, number];
2286
- readonly decodeShortString: (a: number, b: number) => [number, number, number, number];
2287
- readonly encodeFelt: (a: number, b: number) => [number, number, number, number];
2288
- readonly encodeShortString: (a: number, b: number) => [number, number, number, number];
2419
+ readonly __wbg_get_wasmbitcoinp2wpkhkeypair_address: (a: number) => [number, number];
2420
+ readonly __wbg_get_wasmbitcoinp2wpkhkeypair_path: (a: number) => [number, number];
2421
+ readonly __wbg_get_wasmbitcoinp2wpkhkeypair_private_key: (a: number) => [number, number];
2422
+ readonly __wbg_get_wasmbitcoinp2wpkhkeypair_public_key: (a: number) => [number, number];
2423
+ readonly __wbg_set_wasmbitcoinp2wpkhkeypair_address: (a: number, b: number, c: number) => void;
2424
+ readonly __wbg_set_wasmbitcoinp2wpkhkeypair_path: (a: number, b: number, c: number) => void;
2425
+ readonly __wbg_set_wasmbitcoinp2wpkhkeypair_private_key: (a: number, b: number, c: number) => void;
2426
+ readonly __wbg_set_wasmbitcoinp2wpkhkeypair_public_key: (a: number, b: number, c: number) => void;
2427
+ readonly __wbg_wasmbitcoinp2wpkhkeypair_free: (a: number, b: number) => void;
2428
+ readonly __wbg_wasmencryptedkey_free: (a: number, b: number) => void;
2429
+ readonly __wbg_wasmencryptedpayload_free: (a: number, b: number) => void;
2430
+ readonly decryptEthersKeystore: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2431
+ readonly decryptKeystore: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2432
+ readonly decryptPrivateKey: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
2433
+ readonly decryptWithKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
2289
2434
  readonly deriveArgentLegacyKeypair: (a: number, b: number, c: number, d: number) => [number, number, number];
2290
2435
  readonly deriveArgentLegacyPublicKey: (a: number, b: number, c: number, d: number) => [number, number, number];
2291
- readonly deriveDiscoveryKeypairs: (a: number, b: number, c: number) => [number, number, number, number];
2292
- readonly deriveDiscoveryKeypairsWithSecrets: (a: number, b: number, c: number) => [number, number, number, number];
2436
+ readonly deriveBitcoinP2wpkhKeypair: (a: number, b: number, c: any, d: any, e: any, f: number, g: number) => [number, number, number];
2293
2437
  readonly deriveKeypair: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
2294
2438
  readonly derivePublicKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
2295
2439
  readonly deriveStarknetKeypair: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
2296
2440
  readonly deriveStarknetPublicKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
2297
- readonly discoverAccountsFromMnemonic: (a: number, b: number, c: number) => [number, number, number, number];
2298
- readonly discoverAccountsFromMnemonicWithSecrets: (a: number, b: number, c: number) => [number, number, number, number];
2299
- readonly generateAccountAddresses: (a: number, b: number, c: number) => [number, number, number, number];
2300
- readonly generateAccountCandidates: (a: number, b: number, c: number) => [number, number, number, number];
2301
- readonly generateAccountCandidatesWithSecrets: (a: number, b: number, c: number) => [number, number, number, number];
2441
+ readonly encryptKeystore: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
2442
+ readonly encryptPrivateKey: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
2443
+ readonly encryptWithKey: (a: number, b: number, c: number, d: number) => [number, number, number];
2302
2444
  readonly generateMnemonic: (a: number) => [number, number, number, number];
2303
2445
  readonly getNostrCoinType: () => number;
2304
2446
  readonly getStarknetCoinType: () => number;
2305
2447
  readonly getTongoCoinType: () => number;
2448
+ readonly signBip322Simple: (a: number, b: number, c: number, d: number, e: number, f: number, g: any) => [number, number, number, number];
2449
+ readonly signBitcoinPsbtInputs: (a: number, b: number, c: number, d: number, e: any) => [number, number, number, number];
2306
2450
  readonly validateMnemonic: (a: number, b: number) => number;
2307
- readonly __wbg_get_wasmencryptedkey_encryptedKey: (a: number) => [number, number];
2308
- readonly __wbg_get_wasmencryptedkey_nonce: (a: number) => [number, number];
2309
- readonly __wbg_get_wasmencryptedkey_salt: (a: number) => [number, number];
2310
2451
  readonly __wbg_set_wasmencryptedkey_encryptedKey: (a: number, b: number, c: number) => void;
2311
2452
  readonly __wbg_set_wasmencryptedkey_nonce: (a: number, b: number, c: number) => void;
2312
2453
  readonly __wbg_set_wasmencryptedkey_salt: (a: number, b: number, c: number) => void;
2313
- readonly __wbg_wasmaccount_free: (a: number, b: number) => void;
2314
- readonly __wbg_wasmencryptedkey_free: (a: number, b: number) => void;
2315
- readonly __wbg_wasmencryptedpayload_free: (a: number, b: number) => void;
2316
- readonly decryptEthersKeystore: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2317
- readonly decryptKeystore: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2318
- readonly decryptPrivateKey: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
2319
- readonly decryptWithKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
2454
+ readonly __wbg_set_wasmencryptedpayload_ciphertext: (a: number, b: number, c: number) => void;
2455
+ readonly __wbg_set_wasmencryptedpayload_nonce: (a: number, b: number, c: number) => void;
2456
+ readonly __wbg_get_wasmencryptedkey_encryptedKey: (a: number) => [number, number];
2457
+ readonly __wbg_get_wasmencryptedkey_nonce: (a: number) => [number, number];
2458
+ readonly __wbg_get_wasmencryptedkey_salt: (a: number) => [number, number];
2459
+ readonly __wbg_get_wasmencryptedpayload_ciphertext: (a: number) => [number, number];
2460
+ readonly __wbg_get_wasmencryptedpayload_nonce: (a: number) => [number, number];
2461
+ readonly compileCalls: (a: number, b: number) => [number, number, number, number];
2462
+ readonly decodeShortString: (a: number, b: number) => [number, number, number, number];
2463
+ readonly encodeFelt: (a: number, b: number) => [number, number, number, number];
2464
+ readonly encodeShortString: (a: number, b: number) => [number, number, number, number];
2320
2465
  readonly deriveNostrKeypair: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
2321
2466
  readonly deriveNostrPublicKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
2322
- readonly encryptKeystore: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
2323
- readonly encryptPrivateKey: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
2324
- readonly encryptWithKey: (a: number, b: number, c: number, d: number) => [number, number, number];
2467
+ readonly getSelectorFromName: (a: number, b: number) => [number, number, number, number];
2468
+ readonly pedersenHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2469
+ readonly pedersenHashMany: (a: number, b: number) => [number, number, number, number];
2470
+ readonly starknetKeccak: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2471
+ readonly __wbg_wasmaccount_free: (a: number, b: number) => void;
2472
+ readonly deriveDiscoveryKeypairs: (a: number, b: number, c: number) => [number, number, number, number];
2473
+ readonly deriveDiscoveryKeypairsWithSecrets: (a: number, b: number, c: number) => [number, number, number, number];
2474
+ readonly discoverAccountsFromMnemonic: (a: number, b: number, c: number) => [number, number, number, number];
2475
+ readonly discoverAccountsFromMnemonicWithSecrets: (a: number, b: number, c: number) => [number, number, number, number];
2476
+ readonly generateAccountAddresses: (a: number, b: number, c: number) => [number, number, number, number];
2477
+ readonly generateAccountCandidates: (a: number, b: number, c: number) => [number, number, number, number];
2478
+ readonly generateAccountCandidatesWithSecrets: (a: number, b: number, c: number) => [number, number, number, number];
2325
2479
  readonly wasmaccount_contractAddress: (a: number) => [number, number];
2326
2480
  readonly wasmaccount_decryptBalance: (a: number, b: number, c: number, d: bigint) => [number, number, number, number];
2327
2481
  readonly wasmaccount_decryptToPoint: (a: number, b: number) => [number, number, number];
@@ -2332,10 +2486,46 @@ export interface InitOutput {
2332
2486
  readonly wasmaccount_ownerPublicKeyHex: (a: number) => [number, number, number, number];
2333
2487
  readonly wasmaccount_totalBalance: (a: number) => [number, number, number, number];
2334
2488
  readonly wasmaccount_updateState: (a: number, b: number) => [number, number];
2335
- readonly __wbg_set_wasmencryptedpayload_ciphertext: (a: number, b: number, c: number) => void;
2336
- readonly __wbg_set_wasmencryptedpayload_nonce: (a: number, b: number, c: number) => void;
2337
- readonly __wbg_get_wasmencryptedpayload_ciphertext: (a: number) => [number, number];
2338
- readonly __wbg_get_wasmencryptedpayload_nonce: (a: number) => [number, number];
2489
+ readonly __wbg_get_wasmqsbcommitments_root: (a: number) => [number, number];
2490
+ readonly __wbg_get_wasmqsbcommitments_round0: (a: number) => [number, number];
2491
+ readonly __wbg_get_wasmqsbcommitments_round1: (a: number) => [number, number];
2492
+ readonly __wbg_get_wasmqsbrevealdigest_binding: (a: number) => [number, number];
2493
+ readonly __wbg_get_wasmqsbrevealdigest_digest: (a: number) => [number, number];
2494
+ readonly __wbg_set_wasmqsbcommitments_root: (a: number, b: number, c: number) => void;
2495
+ readonly __wbg_set_wasmqsbcommitments_round0: (a: number, b: number, c: number) => void;
2496
+ readonly __wbg_set_wasmqsbcommitments_round1: (a: number, b: number, c: number) => void;
2497
+ readonly __wbg_set_wasmqsbrevealdigest_binding: (a: number, b: number, c: number) => void;
2498
+ readonly __wbg_set_wasmqsbrevealdigest_digest: (a: number, b: number, c: number) => void;
2499
+ readonly __wbg_wasmqsbcommitments_free: (a: number, b: number) => void;
2500
+ readonly __wbg_wasmqsbrevealdigest_free: (a: number, b: number) => void;
2501
+ readonly deriveQsbCommitments: (a: number, b: number, c: any, d: any, e: number, f: number) => [number, number, number];
2502
+ readonly deriveScopedStrk20ViewingKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
2503
+ readonly deriveStrk20ViewingKey: (a: number, b: number) => [number, number, number, number];
2504
+ readonly foldStrk20ViewingKey: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
2505
+ readonly qsbRevealDigest: (a: any, b: any, c: any) => [number, number, number];
2506
+ readonly revealQsbPreimages: (a: number, b: number, c: any, d: any, e: any, f: any, g: number, h: number) => [number, number, number];
2507
+ readonly strk20ViewingKeyMessageHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2508
+ readonly deserializePublicKey: (a: number, b: number) => [number, number, number];
2509
+ readonly getBuildInfo: () => any;
2510
+ readonly getGenerator: () => number;
2511
+ readonly getVersion: () => [number, number];
2512
+ readonly grindKey: (a: number, b: number) => [number, number, number, number];
2513
+ readonly init: () => void;
2514
+ readonly isValidFelt: (a: number, b: number) => number;
2515
+ readonly isValidStarkPrivateKey: (a: number, b: number) => number;
2516
+ readonly nostrPublicKey: (a: number, b: number) => [number, number, number, number];
2517
+ readonly pointAdd: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
2518
+ readonly poseidonHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2519
+ readonly poseidonHashMany: (a: number, b: number) => [number, number, number, number];
2520
+ readonly randomBytesHex: (a: number) => [number, number, number, number];
2521
+ readonly randomFelt: () => [number, number, number, number];
2522
+ readonly scalarMul: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
2523
+ readonly scalarMulGenerator: (a: number, b: number) => [number, number, number];
2524
+ readonly serializePublicKey: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2525
+ readonly signNostrEventId: (a: number, b: number, c: number, d: number) => [number, number, number];
2526
+ readonly signNostrMessage: (a: number, b: number, c: number, d: number) => [number, number, number];
2527
+ readonly signStarkHash: (a: number, b: number, c: number, d: number) => [number, number, number];
2528
+ readonly starkPublicKey: (a: number, b: number) => [number, number, number, number];
2339
2529
  readonly __wbindgen_malloc: (a: number, b: number) => number;
2340
2530
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
2341
2531
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -360,6 +360,136 @@ export class WasmAccountState {
360
360
  }
361
361
  if (Symbol.dispose) WasmAccountState.prototype[Symbol.dispose] = WasmAccountState.prototype.free;
362
362
 
363
+ /**
364
+ * BIP-84 mainnet P2WPKH keypair.
365
+ *
366
+ * # Security / threat model
367
+ *
368
+ * `private_key` is a plain hex string in the JS heap and cannot be reliably
369
+ * wiped. The copy this object owns in WASM memory is zeroized when the
370
+ * object is freed, as for [`crate::WasmKeypair`]. `Debug` redacts the
371
+ * private key; default `Serialize` omits it.
372
+ */
373
+ export class WasmBitcoinP2wpkhKeypair {
374
+ static __wrap(ptr) {
375
+ const obj = Object.create(WasmBitcoinP2wpkhKeypair.prototype);
376
+ obj.__wbg_ptr = ptr;
377
+ WasmBitcoinP2wpkhKeypairFinalization.register(obj, obj.__wbg_ptr, obj);
378
+ return obj;
379
+ }
380
+ __destroy_into_raw() {
381
+ const ptr = this.__wbg_ptr;
382
+ this.__wbg_ptr = 0;
383
+ WasmBitcoinP2wpkhKeypairFinalization.unregister(this);
384
+ return ptr;
385
+ }
386
+ free() {
387
+ const ptr = this.__destroy_into_raw();
388
+ wasm.__wbg_wasmbitcoinp2wpkhkeypair_free(ptr, 0);
389
+ }
390
+ /**
391
+ * Lowercase `bc1q…` P2WPKH address.
392
+ * @returns {string}
393
+ */
394
+ get address() {
395
+ let deferred1_0;
396
+ let deferred1_1;
397
+ try {
398
+ const ret = wasm.__wbg_get_wasmbitcoinp2wpkhkeypair_address(this.__wbg_ptr);
399
+ deferred1_0 = ret[0];
400
+ deferred1_1 = ret[1];
401
+ return getStringFromWasm0(ret[0], ret[1]);
402
+ } finally {
403
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
404
+ }
405
+ }
406
+ /**
407
+ * Derivation path, e.g. `m/84'/0'/0'/0/0`.
408
+ * @returns {string}
409
+ */
410
+ get path() {
411
+ let deferred1_0;
412
+ let deferred1_1;
413
+ try {
414
+ const ret = wasm.__wbg_get_wasmbitcoinp2wpkhkeypair_path(this.__wbg_ptr);
415
+ deferred1_0 = ret[0];
416
+ deferred1_1 = ret[1];
417
+ return getStringFromWasm0(ret[0], ret[1]);
418
+ } finally {
419
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
420
+ }
421
+ }
422
+ /**
423
+ * Private key as 64 hex chars (no 0x prefix). Treat as secret.
424
+ * @returns {string}
425
+ */
426
+ get private_key() {
427
+ let deferred1_0;
428
+ let deferred1_1;
429
+ try {
430
+ const ret = wasm.__wbg_get_wasmbitcoinp2wpkhkeypair_private_key(this.__wbg_ptr);
431
+ deferred1_0 = ret[0];
432
+ deferred1_1 = ret[1];
433
+ return getStringFromWasm0(ret[0], ret[1]);
434
+ } finally {
435
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
436
+ }
437
+ }
438
+ /**
439
+ * Compressed SEC1 public key as 66 hex chars (no 0x prefix).
440
+ * @returns {string}
441
+ */
442
+ get public_key() {
443
+ let deferred1_0;
444
+ let deferred1_1;
445
+ try {
446
+ const ret = wasm.__wbg_get_wasmbitcoinp2wpkhkeypair_public_key(this.__wbg_ptr);
447
+ deferred1_0 = ret[0];
448
+ deferred1_1 = ret[1];
449
+ return getStringFromWasm0(ret[0], ret[1]);
450
+ } finally {
451
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
452
+ }
453
+ }
454
+ /**
455
+ * Lowercase `bc1q…` P2WPKH address.
456
+ * @param {string} arg0
457
+ */
458
+ set address(arg0) {
459
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
460
+ const len0 = WASM_VECTOR_LEN;
461
+ wasm.__wbg_set_wasmbitcoinp2wpkhkeypair_address(this.__wbg_ptr, ptr0, len0);
462
+ }
463
+ /**
464
+ * Derivation path, e.g. `m/84'/0'/0'/0/0`.
465
+ * @param {string} arg0
466
+ */
467
+ set path(arg0) {
468
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
469
+ const len0 = WASM_VECTOR_LEN;
470
+ wasm.__wbg_set_wasmbitcoinp2wpkhkeypair_path(this.__wbg_ptr, ptr0, len0);
471
+ }
472
+ /**
473
+ * Private key as 64 hex chars (no 0x prefix). Treat as secret.
474
+ * @param {string} arg0
475
+ */
476
+ set private_key(arg0) {
477
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
478
+ const len0 = WASM_VECTOR_LEN;
479
+ wasm.__wbg_set_wasmbitcoinp2wpkhkeypair_private_key(this.__wbg_ptr, ptr0, len0);
480
+ }
481
+ /**
482
+ * Compressed SEC1 public key as 66 hex chars (no 0x prefix).
483
+ * @param {string} arg0
484
+ */
485
+ set public_key(arg0) {
486
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
487
+ const len0 = WASM_VECTOR_LEN;
488
+ wasm.__wbg_set_wasmbitcoinp2wpkhkeypair_public_key(this.__wbg_ptr, ptr0, len0);
489
+ }
490
+ }
491
+ if (Symbol.dispose) WasmBitcoinP2wpkhKeypair.prototype[Symbol.dispose] = WasmBitcoinP2wpkhKeypair.prototype.free;
492
+
363
493
  /**
364
494
  * ElGamal ciphertext (L, R points).
365
495
  */
@@ -1805,6 +1935,165 @@ export class WasmPublicKey {
1805
1935
  }
1806
1936
  if (Symbol.dispose) WasmPublicKey.prototype[Symbol.dispose] = WasmPublicKey.prototype.free;
1807
1937
 
1938
+ /**
1939
+ * The public commitments of one vault and their root.
1940
+ */
1941
+ export class WasmQsbCommitments {
1942
+ static __wrap(ptr) {
1943
+ const obj = Object.create(WasmQsbCommitments.prototype);
1944
+ obj.__wbg_ptr = ptr;
1945
+ WasmQsbCommitmentsFinalization.register(obj, obj.__wbg_ptr, obj);
1946
+ return obj;
1947
+ }
1948
+ __destroy_into_raw() {
1949
+ const ptr = this.__wbg_ptr;
1950
+ this.__wbg_ptr = 0;
1951
+ WasmQsbCommitmentsFinalization.unregister(this);
1952
+ return ptr;
1953
+ }
1954
+ free() {
1955
+ const ptr = this.__destroy_into_raw();
1956
+ wasm.__wbg_wasmqsbcommitments_free(ptr, 0);
1957
+ }
1958
+ /**
1959
+ * The commitment root `R[v]` (64 lowercase hex chars).
1960
+ * @returns {string}
1961
+ */
1962
+ get root() {
1963
+ let deferred1_0;
1964
+ let deferred1_1;
1965
+ try {
1966
+ const ret = wasm.__wbg_get_wasmqsbcommitments_root(this.__wbg_ptr);
1967
+ deferred1_0 = ret[0];
1968
+ deferred1_1 = ret[1];
1969
+ return getStringFromWasm0(ret[0], ret[1]);
1970
+ } finally {
1971
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1972
+ }
1973
+ }
1974
+ /**
1975
+ * The 150 round-0 commitments `c[v][0][i]`, in index order (40 lowercase hex chars each).
1976
+ * @returns {string[]}
1977
+ */
1978
+ get round0() {
1979
+ const ret = wasm.__wbg_get_wasmqsbcommitments_round0(this.__wbg_ptr);
1980
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
1981
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1982
+ return v1;
1983
+ }
1984
+ /**
1985
+ * The 150 round-1 commitments `c[v][1][i]`, in index order (40 lowercase hex chars each).
1986
+ * @returns {string[]}
1987
+ */
1988
+ get round1() {
1989
+ const ret = wasm.__wbg_get_wasmqsbcommitments_round1(this.__wbg_ptr);
1990
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
1991
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1992
+ return v1;
1993
+ }
1994
+ /**
1995
+ * The commitment root `R[v]` (64 lowercase hex chars).
1996
+ * @param {string} arg0
1997
+ */
1998
+ set root(arg0) {
1999
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2000
+ const len0 = WASM_VECTOR_LEN;
2001
+ wasm.__wbg_set_wasmqsbcommitments_root(this.__wbg_ptr, ptr0, len0);
2002
+ }
2003
+ /**
2004
+ * The 150 round-0 commitments `c[v][0][i]`, in index order (40 lowercase hex chars each).
2005
+ * @param {string[]} arg0
2006
+ */
2007
+ set round0(arg0) {
2008
+ const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
2009
+ const len0 = WASM_VECTOR_LEN;
2010
+ wasm.__wbg_set_wasmqsbcommitments_round0(this.__wbg_ptr, ptr0, len0);
2011
+ }
2012
+ /**
2013
+ * The 150 round-1 commitments `c[v][1][i]`, in index order (40 lowercase hex chars each).
2014
+ * @param {string[]} arg0
2015
+ */
2016
+ set round1(arg0) {
2017
+ const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
2018
+ const len0 = WASM_VECTOR_LEN;
2019
+ wasm.__wbg_set_wasmqsbcommitments_round1(this.__wbg_ptr, ptr0, len0);
2020
+ }
2021
+ }
2022
+ if (Symbol.dispose) WasmQsbCommitments.prototype[Symbol.dispose] = WasmQsbCommitments.prototype.free;
2023
+
2024
+ /**
2025
+ * The transaction binding of a disclosure request.
2026
+ */
2027
+ export class WasmQsbRevealDigest {
2028
+ static __wrap(ptr) {
2029
+ const obj = Object.create(WasmQsbRevealDigest.prototype);
2030
+ obj.__wbg_ptr = ptr;
2031
+ WasmQsbRevealDigestFinalization.register(obj, obj.__wbg_ptr, obj);
2032
+ return obj;
2033
+ }
2034
+ __destroy_into_raw() {
2035
+ const ptr = this.__wbg_ptr;
2036
+ this.__wbg_ptr = 0;
2037
+ WasmQsbRevealDigestFinalization.unregister(this);
2038
+ return ptr;
2039
+ }
2040
+ free() {
2041
+ const ptr = this.__destroy_into_raw();
2042
+ wasm.__wbg_wasmqsbrevealdigest_free(ptr, 0);
2043
+ }
2044
+ /**
2045
+ * `B = SHA256(T)` (64 lowercase hex chars).
2046
+ * @returns {string}
2047
+ */
2048
+ get binding() {
2049
+ let deferred1_0;
2050
+ let deferred1_1;
2051
+ try {
2052
+ const ret = wasm.__wbg_get_wasmqsbrevealdigest_binding(this.__wbg_ptr);
2053
+ deferred1_0 = ret[0];
2054
+ deferred1_1 = ret[1];
2055
+ return getStringFromWasm0(ret[0], ret[1]);
2056
+ } finally {
2057
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2058
+ }
2059
+ }
2060
+ /**
2061
+ * `D = SHA256("QSB-HORS-v1/reveal" || I || B)` (64 lowercase hex chars).
2062
+ * @returns {string}
2063
+ */
2064
+ get digest() {
2065
+ let deferred1_0;
2066
+ let deferred1_1;
2067
+ try {
2068
+ const ret = wasm.__wbg_get_wasmqsbrevealdigest_digest(this.__wbg_ptr);
2069
+ deferred1_0 = ret[0];
2070
+ deferred1_1 = ret[1];
2071
+ return getStringFromWasm0(ret[0], ret[1]);
2072
+ } finally {
2073
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2074
+ }
2075
+ }
2076
+ /**
2077
+ * `B = SHA256(T)` (64 lowercase hex chars).
2078
+ * @param {string} arg0
2079
+ */
2080
+ set binding(arg0) {
2081
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2082
+ const len0 = WASM_VECTOR_LEN;
2083
+ wasm.__wbg_set_wasmqsbrevealdigest_binding(this.__wbg_ptr, ptr0, len0);
2084
+ }
2085
+ /**
2086
+ * `D = SHA256("QSB-HORS-v1/reveal" || I || B)` (64 lowercase hex chars).
2087
+ * @param {string} arg0
2088
+ */
2089
+ set digest(arg0) {
2090
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2091
+ const len0 = WASM_VECTOR_LEN;
2092
+ wasm.__wbg_set_wasmqsbrevealdigest_digest(this.__wbg_ptr, ptr0, len0);
2093
+ }
2094
+ }
2095
+ if (Symbol.dispose) WasmQsbRevealDigest.prototype[Symbol.dispose] = WasmQsbRevealDigest.prototype.free;
2096
+
1808
2097
  /**
1809
2098
  * Parameters for generating a ragequit proof.
1810
2099
  */
@@ -5513,6 +5802,39 @@ export function deriveArgentLegacyPublicKey(mnemonic, address_index, account_ind
5513
5802
  return WasmStarkXOnlyPublicKey.__wrap(ret[0]);
5514
5803
  }
5515
5804
 
5805
+ /**
5806
+ * Derive the BIP-84 mainnet P2WPKH keypair at
5807
+ * `m/84'/0'/{account_index}'/{change}/{address_index}`.
5808
+ *
5809
+ * # Security / threat model
5810
+ *
5811
+ * Returns the private key as a hex string in the JS heap.
5812
+ *
5813
+ * # Arguments
5814
+ * * `mnemonic` - BIP-39 mnemonic
5815
+ * * `account_index` - hardened account index, an integer below 2^31
5816
+ * * `change` - 0 for receiving, 1 for change
5817
+ * * `address_index` - address index, an integer below 2^31
5818
+ * * `passphrase` - Optional BIP-39 passphrase
5819
+ * @param {string} mnemonic
5820
+ * @param {number} account_index
5821
+ * @param {number} change
5822
+ * @param {number} address_index
5823
+ * @param {string | null} [passphrase]
5824
+ * @returns {WasmBitcoinP2wpkhKeypair}
5825
+ */
5826
+ export function deriveBitcoinP2wpkhKeypair(mnemonic, account_index, change, address_index, passphrase) {
5827
+ const ptr0 = passStringToWasm0(mnemonic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5828
+ const len0 = WASM_VECTOR_LEN;
5829
+ var ptr1 = isLikeNone(passphrase) ? 0 : passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5830
+ var len1 = WASM_VECTOR_LEN;
5831
+ const ret = wasm.deriveBitcoinP2wpkhKeypair(ptr0, len0, account_index, change, address_index, ptr1, len1);
5832
+ if (ret[2]) {
5833
+ throw takeFromExternrefTable0(ret[1]);
5834
+ }
5835
+ return WasmBitcoinP2wpkhKeypair.__wrap(ret[0]);
5836
+ }
5837
+
5516
5838
  /**
5517
5839
  * Derive a Braavos account contract address from a public key.
5518
5840
  *
@@ -5801,6 +6123,36 @@ export function derivePublicKey(mnemonic, address_index, account_index, passphra
5801
6123
  return WasmPublicKey.__wrap(ret[0]);
5802
6124
  }
5803
6125
 
6126
+ /**
6127
+ * Derive the 2 × 150 commitments and the root of a QSB vault.
6128
+ *
6129
+ * `net` is `0` (Bitcoin mainnet) or `1` (shared test namespace) and
6130
+ * `vault_index` is below `2^31`; both are validated before the mnemonic is
6131
+ * read. Deriving commitments does not allocate the vault.
6132
+ *
6133
+ * # Arguments
6134
+ * * `mnemonic` - BIP-39 mnemonic of the dedicated QSB phrase
6135
+ * * `net` - Derivation namespace
6136
+ * * `vault_index` - Vault index `v`
6137
+ * * `passphrase` - Optional BIP-39 passphrase
6138
+ * @param {string} mnemonic
6139
+ * @param {number} net
6140
+ * @param {number} vault_index
6141
+ * @param {string | null} [passphrase]
6142
+ * @returns {WasmQsbCommitments}
6143
+ */
6144
+ export function deriveQsbCommitments(mnemonic, net, vault_index, passphrase) {
6145
+ const ptr0 = passStringToWasm0(mnemonic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6146
+ const len0 = WASM_VECTOR_LEN;
6147
+ var ptr1 = isLikeNone(passphrase) ? 0 : passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6148
+ var len1 = WASM_VECTOR_LEN;
6149
+ const ret = wasm.deriveQsbCommitments(ptr0, len0, net, vault_index, ptr1, len1);
6150
+ if (ret[2]) {
6151
+ throw takeFromExternrefTable0(ret[1]);
6152
+ }
6153
+ return WasmQsbCommitments.__wrap(ret[0]);
6154
+ }
6155
+
5804
6156
  /**
5805
6157
  * Derive a chain- and pool-scoped STRK20 viewing key.
5806
6158
  * @param {string} private_key
@@ -7037,6 +7389,27 @@ export function poseidonHashMany(inputs) {
7037
7389
  }
7038
7390
  }
7039
7391
 
7392
+ /**
7393
+ * Compute `B` and `D` for a disclosure request.
7394
+ *
7395
+ * `transaction_hex` is the BIP's `T` as lowercase hex: the full legacy
7396
+ * serialization with every scriptSig empty and no witness. Krusty parses it
7397
+ * and refuses anything else; it never accepts a caller-supplied hash.
7398
+ * `round0` must hold 8 and `round1` 7 distinct indices below 150, in the
7399
+ * order the spend reveals them.
7400
+ * @param {string} transaction_hex
7401
+ * @param {number[]} round0
7402
+ * @param {number[]} round1
7403
+ * @returns {WasmQsbRevealDigest}
7404
+ */
7405
+ export function qsbRevealDigest(transaction_hex, round0, round1) {
7406
+ const ret = wasm.qsbRevealDigest(transaction_hex, round0, round1);
7407
+ if (ret[2]) {
7408
+ throw takeFromExternrefTable0(ret[1]);
7409
+ }
7410
+ return WasmQsbRevealDigest.__wrap(ret[0]);
7411
+ }
7412
+
7040
7413
  /**
7041
7414
  * Generate random bytes and return them as a hex string.
7042
7415
  *
@@ -7094,6 +7467,37 @@ export function randomFelt() {
7094
7467
  }
7095
7468
  }
7096
7469
 
7470
+ /**
7471
+ * Reveal the 15 preimages a disclosure request names.
7472
+ *
7473
+ * Returns 15 lowercase hex strings: round 0's then round 1's, in the given
7474
+ * order. Every parameter is validated before the mnemonic is read.
7475
+ *
7476
+ * # Security / threat model
7477
+ *
7478
+ * Call only after durably recording this request as `exposed`. The returned
7479
+ * preimages are spending secrets. The Rust-side preimages and their hex
7480
+ * encoding are wiped before returning; the JS strings cannot be wiped.
7481
+ * @param {string} mnemonic
7482
+ * @param {number} net
7483
+ * @param {number} vault_index
7484
+ * @param {number[]} round0
7485
+ * @param {number[]} round1
7486
+ * @param {string | null} [passphrase]
7487
+ * @returns {string[]}
7488
+ */
7489
+ export function revealQsbPreimages(mnemonic, net, vault_index, round0, round1, passphrase) {
7490
+ const ptr0 = passStringToWasm0(mnemonic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7491
+ const len0 = WASM_VECTOR_LEN;
7492
+ var ptr1 = isLikeNone(passphrase) ? 0 : passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7493
+ var len1 = WASM_VECTOR_LEN;
7494
+ const ret = wasm.revealQsbPreimages(ptr0, len0, net, vault_index, round0, round1, ptr1, len1);
7495
+ if (ret[2]) {
7496
+ throw takeFromExternrefTable0(ret[1]);
7497
+ }
7498
+ return takeFromExternrefTable0(ret[0]);
7499
+ }
7500
+
7097
7501
  /**
7098
7502
  * Multiply a point by a scalar.
7099
7503
  *
@@ -7180,6 +7584,95 @@ export function serializePublicKey(x, y) {
7180
7584
  }
7181
7585
  }
7182
7586
 
7587
+ /**
7588
+ * Sign a UTF-8 message with a BIP-322 "simple" signature for this key's
7589
+ * P2WPKH address.
7590
+ *
7591
+ * Returns the `smp`-prefixed base64 witness that BIP-322 requires of
7592
+ * signers. Pass `legacy_unprefixed = true` only for a verifier that predates
7593
+ * the prefix (for example `bip322-js` 4.0.0); strict verifiers may reject the
7594
+ * unprefixed form.
7595
+ *
7596
+ * # Arguments
7597
+ * * `private_key` - 64 hex chars (no 0x prefix), secp256k1 private key
7598
+ * * `address` - must be this key's mainnet P2WPKH address
7599
+ * * `message` - the message; signed as its UTF-8 bytes
7600
+ * * `legacy_unprefixed` - optional boolean, `false` when omitted
7601
+ * @param {string} private_key
7602
+ * @param {string} address
7603
+ * @param {string} message
7604
+ * @param {boolean} [legacy_unprefixed]
7605
+ * @returns {string}
7606
+ */
7607
+ export function signBip322Simple(private_key, address, message, legacy_unprefixed) {
7608
+ let deferred5_0;
7609
+ let deferred5_1;
7610
+ try {
7611
+ const ptr0 = passStringToWasm0(private_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7612
+ const len0 = WASM_VECTOR_LEN;
7613
+ const ptr1 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7614
+ const len1 = WASM_VECTOR_LEN;
7615
+ const ptr2 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7616
+ const len2 = WASM_VECTOR_LEN;
7617
+ const ret = wasm.signBip322Simple(ptr0, len0, ptr1, len1, ptr2, len2, legacy_unprefixed);
7618
+ var ptr4 = ret[0];
7619
+ var len4 = ret[1];
7620
+ if (ret[3]) {
7621
+ ptr4 = 0; len4 = 0;
7622
+ throw takeFromExternrefTable0(ret[2]);
7623
+ }
7624
+ deferred5_0 = ptr4;
7625
+ deferred5_1 = len4;
7626
+ return getStringFromWasm0(ptr4, len4);
7627
+ } finally {
7628
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
7629
+ }
7630
+ }
7631
+
7632
+ /**
7633
+ * Add this key's SIGHASH_ALL partial signature to the listed inputs of a
7634
+ * base64 PSBT (version 0) and return the PSBT as base64. Signatures are
7635
+ * low-R and low-S, as Bitcoin Core signs: at most 71 bytes each.
7636
+ *
7637
+ * Each listed input must be this key's P2WPKH coin, proven by a
7638
+ * `witness_utxo` that matches the spent output of its full
7639
+ * `non_witness_utxo`, and must not request a sighash type other than
7640
+ * SIGHASH_ALL. Every other input and field is returned byte-identical. The
7641
+ * PSBT is not finalized or broadcast.
7642
+ *
7643
+ * # Arguments
7644
+ * * `private_key` - 64 hex chars (no 0x prefix), secp256k1 private key
7645
+ * * `psbt_base64` - the PSBT, standard base64 with padding
7646
+ * * `input_indices` - a plain array of input numbers to sign; non-empty,
7647
+ * distinct and in range (typed arrays are refused)
7648
+ * @param {string} private_key
7649
+ * @param {string} psbt_base64
7650
+ * @param {number[]} input_indices
7651
+ * @returns {string}
7652
+ */
7653
+ export function signBitcoinPsbtInputs(private_key, psbt_base64, input_indices) {
7654
+ let deferred4_0;
7655
+ let deferred4_1;
7656
+ try {
7657
+ const ptr0 = passStringToWasm0(private_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7658
+ const len0 = WASM_VECTOR_LEN;
7659
+ const ptr1 = passStringToWasm0(psbt_base64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7660
+ const len1 = WASM_VECTOR_LEN;
7661
+ const ret = wasm.signBitcoinPsbtInputs(ptr0, len0, ptr1, len1, input_indices);
7662
+ var ptr3 = ret[0];
7663
+ var len3 = ret[1];
7664
+ if (ret[3]) {
7665
+ ptr3 = 0; len3 = 0;
7666
+ throw takeFromExternrefTable0(ret[2]);
7667
+ }
7668
+ deferred4_0 = ptr3;
7669
+ deferred4_1 = len3;
7670
+ return getStringFromWasm0(ptr3, len3);
7671
+ } finally {
7672
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
7673
+ }
7674
+ }
7675
+
7183
7676
  /**
7184
7677
  * Sign a 32-byte Nostr event id using BIP-340 Schnorr.
7185
7678
  *
@@ -7412,6 +7905,10 @@ function __wbg_get_imports() {
7412
7905
  const ret = Error(getStringFromWasm0(arg0, arg1));
7413
7906
  return ret;
7414
7907
  },
7908
+ __wbg_Number_3890faa6d3ff057d: function(arg0) {
7909
+ const ret = Number(arg0);
7910
+ return ret;
7911
+ },
7415
7912
  __wbg_String_8564e559799eccda: function(arg0, arg1) {
7416
7913
  const ret = String(arg1);
7417
7914
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -7435,6 +7932,14 @@ function __wbg_get_imports() {
7435
7932
  const ret = arg0 in arg1;
7436
7933
  return ret;
7437
7934
  },
7935
+ __wbg___wbindgen_is_function_5e4570eb24ffa122: function(arg0) {
7936
+ const ret = typeof(arg0) === 'function';
7937
+ return ret;
7938
+ },
7939
+ __wbg___wbindgen_is_null_7d13f41e1a2d5140: function(arg0) {
7940
+ const ret = arg0 === null;
7941
+ return ret;
7942
+ },
7438
7943
  __wbg___wbindgen_is_object_a2790eb24c211ea0: function(arg0) {
7439
7944
  const val = arg0;
7440
7945
  const ret = typeof(val) === 'object' && val !== null;
@@ -7469,9 +7974,29 @@ function __wbg_get_imports() {
7469
7974
  __wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
7470
7975
  throw new Error(getStringFromWasm0(arg0, arg1));
7471
7976
  },
7977
+ __wbg_call_1c5886ab9c57d1c7: function() { return handleError(function (arg0, arg1) {
7978
+ const ret = arg0.call(arg1);
7979
+ return ret;
7980
+ }, arguments); },
7981
+ __wbg_done_669171204c3dcae2: function(arg0) {
7982
+ const ret = arg0.done;
7983
+ return ret;
7984
+ },
7472
7985
  __wbg_getRandomValues_436a51d0629d84e1: function() { return handleError(function (arg0, arg1) {
7473
7986
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
7474
7987
  }, arguments); },
7988
+ __wbg_get_c0c8f8d7da0c03dd: function(arg0, arg1) {
7989
+ const ret = arg0[arg1 >>> 0];
7990
+ return ret;
7991
+ },
7992
+ __wbg_get_d173c0308df22d37: function() { return handleError(function (arg0, arg1) {
7993
+ const ret = Reflect.get(arg0, arg1);
7994
+ return ret;
7995
+ }, arguments); },
7996
+ __wbg_get_unchecked_e20b893aeafc3fca: function(arg0, arg1) {
7997
+ const ret = arg0[arg1 >>> 0];
7998
+ return ret;
7999
+ },
7475
8000
  __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
7476
8001
  const ret = arg0[arg1];
7477
8002
  return ret;
@@ -7496,10 +8021,30 @@ function __wbg_get_imports() {
7496
8021
  const ret = result;
7497
8022
  return ret;
7498
8023
  },
8024
+ __wbg_isArray_6339f732981044bf: function(arg0) {
8025
+ const ret = Array.isArray(arg0);
8026
+ return ret;
8027
+ },
8028
+ __wbg_isSafeInteger_f3d6cd19ccfe4512: function(arg0) {
8029
+ const ret = Number.isSafeInteger(arg0);
8030
+ return ret;
8031
+ },
8032
+ __wbg_iterator_5cebbb86e33c6dd6: function() {
8033
+ const ret = Symbol.iterator;
8034
+ return ret;
8035
+ },
7499
8036
  __wbg_length_36bd29c6848c2144: function(arg0) {
7500
8037
  const ret = arg0.length;
7501
8038
  return ret;
7502
8039
  },
8040
+ __wbg_length_7afd83ae4ddf324f: function(arg0) {
8041
+ const ret = arg0.length;
8042
+ return ret;
8043
+ },
8044
+ __wbg_length_ecfa2c63d3d0d82c: function(arg0) {
8045
+ const ret = arg0.length;
8046
+ return ret;
8047
+ },
7503
8048
  __wbg_new_116be93542d39019: function() {
7504
8049
  const ret = new Array();
7505
8050
  return ret;
@@ -7520,6 +8065,14 @@ function __wbg_get_imports() {
7520
8065
  const ret = new Object();
7521
8066
  return ret;
7522
8067
  },
8068
+ __wbg_next_42cf16ee0dafc9e2: function() { return handleError(function (arg0) {
8069
+ const ret = arg0.next();
8070
+ return ret;
8071
+ }, arguments); },
8072
+ __wbg_next_8f26b64fa5e9f64b: function(arg0) {
8073
+ const ret = arg0.next;
8074
+ return ret;
8075
+ },
7523
8076
  __wbg_now_8b265300afd5f2b9: function() {
7524
8077
  const ret = Date.now();
7525
8078
  return ret;
@@ -7527,6 +8080,10 @@ function __wbg_get_imports() {
7527
8080
  __wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
7528
8081
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
7529
8082
  },
8083
+ __wbg_push_adb0107829f02d75: function(arg0, arg1) {
8084
+ const ret = arg0.push(arg1);
8085
+ return ret;
8086
+ },
7530
8087
  __wbg_set_014226dfeca53178: function(arg0, arg1, arg2) {
7531
8088
  const ret = arg0.set(arg1, arg2);
7532
8089
  return ret;
@@ -7537,6 +8094,10 @@ function __wbg_get_imports() {
7537
8094
  __wbg_set_a80955eb93b145c6: function(arg0, arg1, arg2) {
7538
8095
  arg0[arg1 >>> 0] = arg2;
7539
8096
  },
8097
+ __wbg_value_1e2369fab29b420e: function(arg0) {
8098
+ const ret = arg0.value;
8099
+ return ret;
8100
+ },
7540
8101
  __wbindgen_cast_0000000000000001: function(arg0) {
7541
8102
  // Cast intrinsic for `F64 -> Externref`.
7542
8103
  const ret = arg0;
@@ -7579,6 +8140,9 @@ const WasmAccountFinalization = (typeof FinalizationRegistry === 'undefined')
7579
8140
  const WasmAccountStateFinalization = (typeof FinalizationRegistry === 'undefined')
7580
8141
  ? { register: () => {}, unregister: () => {} }
7581
8142
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmaccountstate_free(ptr, 1));
8143
+ const WasmBitcoinP2wpkhKeypairFinalization = (typeof FinalizationRegistry === 'undefined')
8144
+ ? { register: () => {}, unregister: () => {} }
8145
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmbitcoinp2wpkhkeypair_free(ptr, 1));
7582
8146
  const WasmCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
7583
8147
  ? { register: () => {}, unregister: () => {} }
7584
8148
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmciphertext_free(ptr, 1));
@@ -7615,6 +8179,12 @@ const WasmPointFinalization = (typeof FinalizationRegistry === 'undefined')
7615
8179
  const WasmPublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')
7616
8180
  ? { register: () => {}, unregister: () => {} }
7617
8181
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmpublickey_free(ptr, 1));
8182
+ const WasmQsbCommitmentsFinalization = (typeof FinalizationRegistry === 'undefined')
8183
+ ? { register: () => {}, unregister: () => {} }
8184
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmqsbcommitments_free(ptr, 1));
8185
+ const WasmQsbRevealDigestFinalization = (typeof FinalizationRegistry === 'undefined')
8186
+ ? { register: () => {}, unregister: () => {} }
8187
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmqsbrevealdigest_free(ptr, 1));
7618
8188
  const WasmRagequitParamsFinalization = (typeof FinalizationRegistry === 'undefined')
7619
8189
  ? { register: () => {}, unregister: () => {} }
7620
8190
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmragequitparams_free(ptr, 1));
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Krusty KMS Contributors"
6
6
  ],
7
7
  "description": "WASM bindings for krusty-kms account and protocol utilities",
8
- "version": "0.13.0",
8
+ "version": "0.15.0",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",