@breeztech/breez-sdk-spark 0.19.0 → 0.20.0-dev1

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.
@@ -35,6 +35,16 @@ export class BitcoinChainServiceHandle {
35
35
  const ret = wasm.bitcoinchainservicehandle_broadcastTransaction(this.__wbg_ptr, ptr0, len0);
36
36
  return ret;
37
37
  }
38
+ /**
39
+ * @param {string} address
40
+ * @returns {Promise<any>}
41
+ */
42
+ getAddressTxos(address) {
43
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
44
+ const len0 = WASM_VECTOR_LEN;
45
+ const ret = wasm.bitcoinchainservicehandle_getAddressTxos(this.__wbg_ptr, ptr0, len0);
46
+ return ret;
47
+ }
38
48
  /**
39
49
  * @param {string} address
40
50
  * @returns {Promise<any>}
@@ -45,6 +55,17 @@ export class BitcoinChainServiceHandle {
45
55
  const ret = wasm.bitcoinchainservicehandle_getAddressUtxos(this.__wbg_ptr, ptr0, len0);
46
56
  return ret;
47
57
  }
58
+ /**
59
+ * @param {string} txid
60
+ * @param {number} vout
61
+ * @returns {Promise<any>}
62
+ */
63
+ getOutspend(txid, vout) {
64
+ const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
65
+ const len0 = WASM_VECTOR_LEN;
66
+ const ret = wasm.bitcoinchainservicehandle_getOutspend(this.__wbg_ptr, ptr0, len0, vout);
67
+ return ret;
68
+ }
48
69
  /**
49
70
  * @param {string} txid
50
71
  * @returns {Promise<any>}
@@ -368,6 +389,14 @@ export class BreezSdk {
368
389
  const ret = wasm.breezsdk_prepareSendPayment(this.__wbg_ptr, request);
369
390
  return ret;
370
391
  }
392
+ /**
393
+ * @param {PrepareUnilateralExitRequest} request
394
+ * @returns {Promise<PrepareUnilateralExitResponse>}
395
+ */
396
+ prepareUnilateralExit(request) {
397
+ const ret = wasm.breezsdk_prepareUnilateralExit(this.__wbg_ptr, request);
398
+ return ret;
399
+ }
371
400
  /**
372
401
  * @param {PublishSignedLnurlPayPackageRequest} request
373
402
  * @returns {Promise<PublishSignedLnurlPayResponse>}
@@ -408,7 +437,7 @@ export class BreezSdk {
408
437
  return ret;
409
438
  }
410
439
  /**
411
- * @returns {Promise<void>}
440
+ * @returns {Promise<RefundPendingConversionsResponse>}
412
441
  */
413
442
  refundPendingConversions() {
414
443
  const ret = wasm.breezsdk_refundPendingConversions(this.__wbg_ptr);
@@ -464,6 +493,15 @@ export class BreezSdk {
464
493
  const ret = wasm.breezsdk_syncWallet(this.__wbg_ptr, request);
465
494
  return ret;
466
495
  }
496
+ /**
497
+ * @param {UnilateralExitRequest} request
498
+ * @param {CpfpSigner} signer
499
+ * @returns {Promise<UnilateralExitResponse>}
500
+ */
501
+ unilateralExit(request, signer) {
502
+ const ret = wasm.breezsdk_unilateralExit(this.__wbg_ptr, request, signer);
503
+ return ret;
504
+ }
467
505
  /**
468
506
  * @param {UnregisterWebhookRequest} request
469
507
  * @returns {Promise<void>}
@@ -491,6 +529,39 @@ export class BreezSdk {
491
529
  }
492
530
  if (Symbol.dispose) BreezSdk.prototype[Symbol.dispose] = BreezSdk.prototype.free;
493
531
 
532
+ /**
533
+ * A CPFP signer matching the `CpfpSigner` TypeScript interface.
534
+ */
535
+ export class DefaultCpfpSigner {
536
+ static __wrap(ptr) {
537
+ const obj = Object.create(DefaultCpfpSigner.prototype);
538
+ obj.__wbg_ptr = ptr;
539
+ DefaultCpfpSignerFinalization.register(obj, obj.__wbg_ptr, obj);
540
+ return obj;
541
+ }
542
+ __destroy_into_raw() {
543
+ const ptr = this.__wbg_ptr;
544
+ this.__wbg_ptr = 0;
545
+ DefaultCpfpSignerFinalization.unregister(this);
546
+ return ptr;
547
+ }
548
+ free() {
549
+ const ptr = this.__destroy_into_raw();
550
+ wasm.__wbg_defaultcpfpsigner_free(ptr, 0);
551
+ }
552
+ /**
553
+ * @param {Uint8Array} psbt_bytes
554
+ * @returns {Promise<Uint8Array>}
555
+ */
556
+ signPsbt(psbt_bytes) {
557
+ const ptr0 = passArray8ToWasm0(psbt_bytes, wasm.__wbindgen_malloc);
558
+ const len0 = WASM_VECTOR_LEN;
559
+ const ret = wasm.defaultcpfpsigner_signPsbt(this.__wbg_ptr, ptr0, len0);
560
+ return ret;
561
+ }
562
+ }
563
+ if (Symbol.dispose) DefaultCpfpSigner.prototype[Symbol.dispose] = DefaultCpfpSigner.prototype.free;
564
+
494
565
  /**
495
566
  * A JS handle to a backend's own session store (from `defaultSessionStore`),
496
567
  * exposing the same `getSession` / `setSession` interface. Wrap it in a JS
@@ -880,6 +951,17 @@ export class ExternalSparkSignerHandle {
880
951
  const ret = wasm.externalsparksignerhandle_signFrost(this.__wbg_ptr, ptr0, len0);
881
952
  return ret;
882
953
  }
954
+ /**
955
+ * @param {ExternalTreeNodeId} leaf_id
956
+ * @param {Uint8Array} sighash
957
+ * @returns {Promise<SchnorrSignatureBytes>}
958
+ */
959
+ signLeafRefundSpend(leaf_id, sighash) {
960
+ const ptr0 = passArray8ToWasm0(sighash, wasm.__wbindgen_malloc);
961
+ const len0 = WASM_VECTOR_LEN;
962
+ const ret = wasm.externalsparksignerhandle_signLeafRefundSpend(this.__wbg_ptr, leaf_id, ptr0, len0);
963
+ return ret;
964
+ }
883
965
  /**
884
966
  * @param {Uint8Array} message
885
967
  * @returns {Promise<EcdsaSignatureBytes>}
@@ -1053,6 +1135,23 @@ export class PasskeyClient {
1053
1135
  const ret = wasm.passkeyclient_checkAvailability(this.__wbg_ptr);
1054
1136
  return ret;
1055
1137
  }
1138
+ /**
1139
+ * Single-CTA onboarding: silent sign-in that falls through to
1140
+ * registration when no credential exists on the device. Pins
1141
+ * immediate mediation, so on web only use it where the browser
1142
+ * advertises it (`supportsImmediateMediation`); otherwise the silent
1143
+ * probe degrades to the standard picker and a dismiss does not fall
1144
+ * through to register, so
1145
+ * present an explicit create / sign-in choice instead. Called without
1146
+ * a `label`, the response `labels` lists a returning user's wallets
1147
+ * for a picker.
1148
+ * @param {ConnectWithPasskeyRequest} request
1149
+ * @returns {Promise<ConnectWithPasskeyResponse>}
1150
+ */
1151
+ connectWithPasskey(request) {
1152
+ const ret = wasm.passkeyclient_connectWithPasskey(this.__wbg_ptr, request);
1153
+ return ret;
1154
+ }
1056
1155
  /**
1057
1156
  * Label sub-object. List / publish labels for this passkey's identity.
1058
1157
  * @returns {PasskeyLabels}
@@ -1101,6 +1200,18 @@ export class PasskeyClient {
1101
1200
  const ret = wasm.passkeyclient_signIn(this.__wbg_ptr, request);
1102
1201
  return ret;
1103
1202
  }
1203
+ /**
1204
+ * Whether this browser advertises WebAuthn immediate mediation: the
1205
+ * silent single-CTA probe (a no-credential sign-in fast-fails with no
1206
+ * UI) works here, so a web host can pick single- vs two-button
1207
+ * onboarding. Web-only and WASM-only: native does the silent probe
1208
+ * inherently, so there is nothing to query off-web.
1209
+ * @returns {Promise<boolean>}
1210
+ */
1211
+ supportsImmediateMediation() {
1212
+ const ret = wasm.passkeyclient_supportsImmediateMediation(this.__wbg_ptr);
1213
+ return ret;
1214
+ }
1104
1215
  }
1105
1216
  if (Symbol.dispose) PasskeyClient.prototype[Symbol.dispose] = PasskeyClient.prototype.free;
1106
1217
 
@@ -1765,6 +1876,21 @@ export function postgresStorage(config) {
1765
1876
  return WasmStorageConfig.__wrap(ret);
1766
1877
  }
1767
1878
 
1879
+ /**
1880
+ * Creates a default CPFP signer backed by a single private key.
1881
+ * @param {Uint8Array} secret_key_bytes
1882
+ * @returns {DefaultCpfpSigner}
1883
+ */
1884
+ export function singleKeyCpfpSigner(secret_key_bytes) {
1885
+ const ptr0 = passArray8ToWasm0(secret_key_bytes, wasm.__wbindgen_malloc);
1886
+ const len0 = WASM_VECTOR_LEN;
1887
+ const ret = wasm.singleKeyCpfpSigner(ptr0, len0);
1888
+ if (ret[2]) {
1889
+ throw takeFromExternrefTable0(ret[1]);
1890
+ }
1891
+ return DefaultCpfpSigner.__wrap(ret[0]);
1892
+ }
1893
+
1768
1894
  /**
1769
1895
  * Runs automatically when the wasm module is instantiated. Installs the
1770
1896
  * panic hook so Rust panics surface as readable `console.error` output
@@ -2300,6 +2426,18 @@ function __wbg_get_imports() {
2300
2426
  const ret = Array.from(arg0);
2301
2427
  return ret;
2302
2428
  },
2429
+ __wbg_getAddressTxos_3ca1c4b39dd84911: function() { return handleError(function (arg0, arg1, arg2) {
2430
+ let deferred0_0;
2431
+ let deferred0_1;
2432
+ try {
2433
+ deferred0_0 = arg1;
2434
+ deferred0_1 = arg2;
2435
+ const ret = arg0.getAddressTxos(getStringFromWasm0(arg1, arg2));
2436
+ return ret;
2437
+ } finally {
2438
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2439
+ }
2440
+ }, arguments); },
2303
2441
  __wbg_getAddressUtxos_9526b6d8078b867e: function() { return handleError(function (arg0, arg1, arg2) {
2304
2442
  let deferred0_0;
2305
2443
  let deferred0_1;
@@ -2365,6 +2503,18 @@ function __wbg_get_imports() {
2365
2503
  const ret = arg0.getLeaves();
2366
2504
  return ret;
2367
2505
  }, arguments); },
2506
+ __wbg_getOutspend_4b3c117972515790: function() { return handleError(function (arg0, arg1, arg2, arg3) {
2507
+ let deferred0_0;
2508
+ let deferred0_1;
2509
+ try {
2510
+ deferred0_0 = arg1;
2511
+ deferred0_1 = arg2;
2512
+ const ret = arg0.getOutspend(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
2513
+ return ret;
2514
+ } finally {
2515
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2516
+ }
2517
+ }, arguments); },
2368
2518
  __wbg_getPaymentById_6d677ada5879df99: function() { return handleError(function (arg0, arg1, arg2) {
2369
2519
  let deferred0_0;
2370
2520
  let deferred0_1;
@@ -3194,12 +3344,24 @@ function __wbg_get_imports() {
3194
3344
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3195
3345
  }
3196
3346
  }, arguments); },
3347
+ __wbg_signLeafRefundSpend_dc0eea305a0dde9c: function() { return handleError(function (arg0, arg1, arg2, arg3) {
3348
+ var v0 = getArrayU8FromWasm0(arg2, arg3).slice();
3349
+ wasm.__wbindgen_free(arg2, arg3 * 1, 1);
3350
+ const ret = arg0.signLeafRefundSpend(arg1, v0);
3351
+ return ret;
3352
+ }, arguments); },
3197
3353
  __wbg_signMessage_80ec0b0dfc7f00ee: function() { return handleError(function (arg0, arg1, arg2) {
3198
3354
  var v0 = getArrayU8FromWasm0(arg1, arg2).slice();
3199
3355
  wasm.__wbindgen_free(arg1, arg2 * 1, 1);
3200
3356
  const ret = arg0.signMessage(v0);
3201
3357
  return ret;
3202
3358
  }, arguments); },
3359
+ __wbg_signPsbt_625c8cbdec488cc6: function() { return handleError(function (arg0, arg1, arg2) {
3360
+ var v0 = getArrayU8FromWasm0(arg1, arg2).slice();
3361
+ wasm.__wbindgen_free(arg1, arg2 * 1, 1);
3362
+ const ret = arg0.signPsbt(v0);
3363
+ return ret;
3364
+ }, arguments); },
3203
3365
  __wbg_signSparkInvoice_cca6c7f35b5e85d2: function() { return handleError(function (arg0, arg1) {
3204
3366
  const ret = arg0.signSparkInvoice(arg1);
3205
3367
  return ret;
@@ -3255,6 +3417,10 @@ function __wbg_get_imports() {
3255
3417
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
3256
3418
  return ret;
3257
3419
  },
3420
+ __wbg_supportsImmediateMediation_a50b46b1cdfacd3d: function() { return handleError(function (arg0) {
3421
+ const ret = arg0.supportsImmediateMediation();
3422
+ return ret;
3423
+ }, arguments); },
3258
3424
  __wbg_syncAddOutgoingChange_69db2a1430cbd55a: function() { return handleError(function (arg0, arg1) {
3259
3425
  const ret = arg0.syncAddOutgoingChange(arg1);
3260
3426
  return ret;
@@ -3407,62 +3573,62 @@ function __wbg_get_imports() {
3407
3573
  return ret;
3408
3574
  },
3409
3575
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
3410
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 17, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3576
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 21, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3411
3577
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h21f6855640435575);
3412
3578
  return ret;
3413
3579
  },
3414
3580
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
3415
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3581
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 389, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3416
3582
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2);
3417
3583
  return ret;
3418
3584
  },
3419
3585
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
3420
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3586
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 389, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3421
3587
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2);
3422
3588
  return ret;
3423
3589
  },
3424
3590
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
3425
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3591
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 389, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3426
3592
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_3);
3427
3593
  return ret;
3428
3594
  },
3429
3595
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
3430
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3596
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 389, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3431
3597
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_4);
3432
3598
  return ret;
3433
3599
  },
3434
3600
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
3435
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3601
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 389, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3436
3602
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5);
3437
3603
  return ret;
3438
3604
  },
3439
3605
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
3440
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("SessionStore")], shim_idx: 17, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3606
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("SessionStore")], shim_idx: 21, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3441
3607
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h21f6855640435575_6);
3442
3608
  return ret;
3443
3609
  },
3444
3610
  __wbindgen_cast_0000000000000008: function(arg0, arg1) {
3445
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Storage")], shim_idx: 17, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3611
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Storage")], shim_idx: 21, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3446
3612
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h21f6855640435575_7);
3447
3613
  return ret;
3448
3614
  },
3449
3615
  __wbindgen_cast_0000000000000009: function(arg0, arg1) {
3450
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TokenStore")], shim_idx: 17, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3616
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TokenStore")], shim_idx: 21, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3451
3617
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h21f6855640435575_8);
3452
3618
  return ret;
3453
3619
  },
3454
3620
  __wbindgen_cast_000000000000000a: function(arg0, arg1) {
3455
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TreeStore")], shim_idx: 17, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3621
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TreeStore")], shim_idx: 21, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3456
3622
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h21f6855640435575_9);
3457
3623
  return ret;
3458
3624
  },
3459
3625
  __wbindgen_cast_000000000000000b: function(arg0, arg1) {
3460
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 392, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3626
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 394, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3461
3627
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1d6669a7b693932a);
3462
3628
  return ret;
3463
3629
  },
3464
3630
  __wbindgen_cast_000000000000000c: function(arg0, arg1) {
3465
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 421, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
3631
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 425, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
3466
3632
  const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h0fa3f876e31d2a3e);
3467
3633
  return ret;
3468
3634
  },
@@ -3647,6 +3813,9 @@ const BitcoinChainServiceHandleFinalization = (typeof FinalizationRegistry === '
3647
3813
  const BreezSdkFinalization = (typeof FinalizationRegistry === 'undefined')
3648
3814
  ? { register: () => {}, unregister: () => {} }
3649
3815
  : new FinalizationRegistry(ptr => wasm.__wbg_breezsdk_free(ptr, 1));
3816
+ const DefaultCpfpSignerFinalization = (typeof FinalizationRegistry === 'undefined')
3817
+ ? { register: () => {}, unregister: () => {} }
3818
+ : new FinalizationRegistry(ptr => wasm.__wbg_defaultcpfpsigner_free(ptr, 1));
3650
3819
  const DefaultSessionStoreFinalization = (typeof FinalizationRegistry === 'undefined')
3651
3820
  ? { register: () => {}, unregister: () => {} }
3652
3821
  : new FinalizationRegistry(ptr => wasm.__wbg_defaultsessionstore_free(ptr, 1));
Binary file
@@ -3,6 +3,7 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_bitcoinchainservicehandle_free: (a: number, b: number) => void;
5
5
  export const __wbg_breezsdk_free: (a: number, b: number) => void;
6
+ export const __wbg_defaultcpfpsigner_free: (a: number, b: number) => void;
6
7
  export const __wbg_externalsigners_free: (a: number, b: number) => void;
7
8
  export const __wbg_passkeyclient_free: (a: number, b: number) => void;
8
9
  export const __wbg_passkeylabels_free: (a: number, b: number) => void;
@@ -11,7 +12,9 @@ export const __wbg_tokenissuer_free: (a: number, b: number) => void;
11
12
  export const __wbg_wasmsdkcontext_free: (a: number, b: number) => void;
12
13
  export const __wbg_wasmstorageconfig_free: (a: number, b: number) => void;
13
14
  export const bitcoinchainservicehandle_broadcastTransaction: (a: number, b: number, c: number) => any;
15
+ export const bitcoinchainservicehandle_getAddressTxos: (a: number, b: number, c: number) => any;
14
16
  export const bitcoinchainservicehandle_getAddressUtxos: (a: number, b: number, c: number) => any;
17
+ export const bitcoinchainservicehandle_getOutspend: (a: number, b: number, c: number, d: number) => any;
15
18
  export const bitcoinchainservicehandle_getTransactionHex: (a: number, b: number, c: number) => any;
16
19
  export const bitcoinchainservicehandle_getTransactionStatus: (a: number, b: number, c: number) => any;
17
20
  export const bitcoinchainservicehandle_recommendedFees: (a: number) => any;
@@ -50,6 +53,7 @@ export const breezsdk_optimizeLeaves: (a: number, b: any) => any;
50
53
  export const breezsdk_parse: (a: number, b: number, c: number) => any;
51
54
  export const breezsdk_prepareLnurlPay: (a: number, b: any) => any;
52
55
  export const breezsdk_prepareSendPayment: (a: number, b: any) => any;
56
+ export const breezsdk_prepareUnilateralExit: (a: number, b: any) => any;
53
57
  export const breezsdk_publishSignedLnurlPayPackage: (a: number, b: any) => any;
54
58
  export const breezsdk_publishSignedTransferPackage: (a: number, b: any) => any;
55
59
  export const breezsdk_receivePayment: (a: number, b: any) => any;
@@ -62,6 +66,7 @@ export const breezsdk_removeEventListener: (a: number, b: number, c: number) =>
62
66
  export const breezsdk_sendPayment: (a: number, b: any) => any;
63
67
  export const breezsdk_signMessage: (a: number, b: any) => any;
64
68
  export const breezsdk_syncWallet: (a: number, b: any) => any;
69
+ export const breezsdk_unilateralExit: (a: number, b: any, c: any) => any;
65
70
  export const breezsdk_unregisterWebhook: (a: number, b: any) => any;
66
71
  export const breezsdk_updateContact: (a: number, b: any) => any;
67
72
  export const breezsdk_updateUserSettings: (a: number, b: any) => any;
@@ -77,6 +82,7 @@ export const defaultPostgresStorageConfig: (a: number, b: number) => any;
77
82
  export const defaultServerConfig: (a: any) => any;
78
83
  export const defaultSessionStore: (a: number, b: any, c: number, d: number) => any;
79
84
  export const defaultStorage: (a: number, b: number) => number;
85
+ export const defaultcpfpsigner_signPsbt: (a: number, b: number, c: number) => any;
80
86
  export const defaultsessionstore_getSession: (a: number, b: number, c: number) => any;
81
87
  export const defaultsessionstore_setSession: (a: number, b: number, c: number, d: any) => any;
82
88
  export const externalbreezsignerhandle_decryptEcies: (a: number, b: number, c: number, d: number, e: number) => any;
@@ -103,6 +109,7 @@ export const externalsparksignerhandle_prepareTokenTransaction: (a: number, b: a
103
109
  export const externalsparksignerhandle_prepareTransfer: (a: number, b: any) => any;
104
110
  export const externalsparksignerhandle_signAuthenticationChallenge: (a: number, b: number, c: number) => any;
105
111
  export const externalsparksignerhandle_signFrost: (a: number, b: number, c: number) => any;
112
+ export const externalsparksignerhandle_signLeafRefundSpend: (a: number, b: any, c: number, d: number) => any;
106
113
  export const externalsparksignerhandle_signMessage: (a: number, b: number, c: number) => any;
107
114
  export const externalsparksignerhandle_signSparkInvoice: (a: number, b: any) => any;
108
115
  export const externalsparksignerhandle_signStaticDepositRefund: (a: number, b: any) => any;
@@ -113,10 +120,12 @@ export const mysqlStorage: (a: any) => number;
113
120
  export const newRestChainService: (a: number, b: number, c: any, d: any, e: number) => any;
114
121
  export const newSharedSdkContext: (a: any) => any;
115
122
  export const passkeyclient_checkAvailability: (a: number) => any;
123
+ export const passkeyclient_connectWithPasskey: (a: number, b: any) => any;
116
124
  export const passkeyclient_labels: (a: number) => number;
117
125
  export const passkeyclient_new: (a: any, b: number, c: number, d: number) => number;
118
126
  export const passkeyclient_register: (a: number, b: any) => any;
119
127
  export const passkeyclient_signIn: (a: number, b: any) => any;
128
+ export const passkeyclient_supportsImmediateMediation: (a: number) => any;
120
129
  export const passkeylabels_list: (a: number) => any;
121
130
  export const passkeylabels_store: (a: number, b: number, c: number) => any;
122
131
  export const postgresStorage: (a: any) => number;
@@ -137,6 +146,7 @@ export const sdkbuilder_withSessionStore: (a: number, b: any) => number;
137
146
  export const sdkbuilder_withSharedContext: (a: number, b: number) => number;
138
147
  export const sdkbuilder_withStorage: (a: number, b: any) => number;
139
148
  export const sdkbuilder_withStorageBackend: (a: number, b: number) => number;
149
+ export const singleKeyCpfpSigner: (a: number, b: number) => [number, number, number];
140
150
  export const start: () => void;
141
151
  export const tokenissuer_burnIssuerToken: (a: number, b: any) => any;
142
152
  export const tokenissuer_createIssuerToken: (a: number, b: any) => any;
@@ -144,6 +144,14 @@ export declare class PasskeyProvider {
144
144
  */
145
145
  isSupported(): Promise<boolean>;
146
146
 
147
+ /**
148
+ * Whether the silent single-CTA flow works in this browser: WebAuthn
149
+ * immediate mediation (`getClientCapabilities().immediateGet`). The SDK
150
+ * surfaces this on the WASM client's `supportsImmediateMediation()`;
151
+ * hosts gate single- vs two-button onboarding on it.
152
+ */
153
+ supportsImmediateMediation(): Promise<boolean>;
154
+
147
155
  /**
148
156
  * Check whether the configured `rpId` is a valid WebAuthn scope for
149
157
  * the current origin (must be a registrable suffix of
@@ -22,10 +22,12 @@ const BREEZ_RP_ID = 'keys.breez.technology';
22
22
  /** Default `rpName` for the zero-config {@link PasskeyClient} path. */
23
23
  const DEFAULT_RP_NAME = 'Breez';
24
24
 
25
- // WebAuthn collapses "no matching credential" and "user dismissed" into
26
- // one NotAllowedError, but a no-credential fast-fail resolves before any
27
- // UI shows while a dismiss takes seconds. Elapsed time below this is
28
- // classified as no-credential, at or above as user-cancel.
25
+ // A no-credential reject resolves before any UI shows; a dismiss takes
26
+ // seconds. This fast-fail window only applies under immediate UI mode
27
+ // (`uiMode: 'immediate'`): that is the only path where a no-credential
28
+ // reject shows no UI. On the modal path the OS always shows a picker
29
+ // first, so a NotAllowedError there is a dismiss/timeout, never a fast
30
+ // no-credential.
29
31
  const NO_CRED_FAST_FAIL_MS = 250;
30
32
 
31
33
  // iOS and Android tear the biometric sheet down around 55s of inactivity
@@ -284,6 +286,28 @@ export class PasskeyProvider {
284
286
  }
285
287
  }
286
288
 
289
+ /**
290
+ * Whether the silent single-CTA flow works in this browser: WebAuthn
291
+ * immediate UI mode (`uiMode: 'immediate'`), probed via
292
+ * `getClientCapabilities().immediateGet`. The SDK surfaces this on the
293
+ * WASM client's `supportsImmediateMediation()`; hosts gate single- vs
294
+ * two-button onboarding on it.
295
+ *
296
+ * @returns {Promise<boolean>}
297
+ */
298
+ async supportsImmediateMediation() {
299
+ try {
300
+ if (typeof PublicKeyCredential === 'undefined'
301
+ || typeof PublicKeyCredential.getClientCapabilities !== 'function') {
302
+ return false;
303
+ }
304
+ const caps = await PublicKeyCredential.getClientCapabilities();
305
+ return caps?.immediateGet === true;
306
+ } catch {
307
+ return false;
308
+ }
309
+ }
310
+
287
311
  /**
288
312
  * Check whether the configured rpId is a valid WebAuthn scope for
289
313
  * the current origin (must be a registrable suffix of
@@ -434,6 +458,26 @@ export class PasskeyProvider {
434
458
  }
435
459
 
436
460
  const requestOptions = { publicKey };
461
+ // Immediate UI mode: fast-fail with no UI when no credential is
462
+ // present so a single-CTA host can fall through to register. Only on
463
+ // the first, unpinned probe (`allowList` empty): immediate mode is
464
+ // discoverable-only (rejects a non-empty allowCredentials) and spends
465
+ // the transient activation, which the pinned later ceremonies of a
466
+ // multi-salt derive no longer have. Once a credential is pinned we
467
+ // already know one exists, so the modal path (which keeps the pin) is
468
+ // correct and avoids a second, credential-substituting chooser. Only
469
+ // where the browser advertises it (`getClientCapabilities().immediateGet`);
470
+ // the fast NotAllowedError it raises on no-credential is classified as
471
+ // CredentialNotFound below.
472
+ if (options.preferImmediatelyAvailableCredentials && allowList.length === 0) {
473
+ if (await this.supportsImmediateMediation()) {
474
+ requestOptions.uiMode = 'immediate';
475
+ } else {
476
+ // Surface the fallback: silently using standard mediation
477
+ // hides why a single-CTA probe still shows a sheet.
478
+ console.debug('breez-sdk: preferImmediatelyAvailableCredentials set but immediate UI mode is unsupported by this browser; using standard mediation');
479
+ }
480
+ }
437
481
 
438
482
  let credential;
439
483
  const startedAt = (typeof performance !== 'undefined' && performance.now)
@@ -445,7 +489,7 @@ export class PasskeyProvider {
445
489
  const elapsed = ((typeof performance !== 'undefined' && performance.now)
446
490
  ? performance.now()
447
491
  : Date.now()) - startedAt;
448
- throw this._mapAssertionError(error, elapsed);
492
+ throw this._mapAssertionError(error, elapsed, requestOptions.uiMode === 'immediate');
449
493
  }
450
494
  if (!credential) {
451
495
  throw new PasskeyCredentialNotFoundError();
@@ -583,18 +627,24 @@ export class PasskeyProvider {
583
627
 
584
628
  /**
585
629
  * Map a `navigator.credentials.get` failure into a typed error.
586
- * `elapsedMs` resolves the `NotAllowedError` ambiguity (cancel vs
587
- * no-credential vs timeout, which all share the error) by elapsed
588
- * time, since only the cancel path shows dismissable UI.
630
+ * `elapsedMs` disambiguates the shared `NotAllowedError` (cancel vs
631
+ * no-credential vs timeout) by time, since only cancel shows UI. The
632
+ * fast no-credential branch is immediate-only: the modal path shows a
633
+ * picker first, so its NotAllowedError is a dismiss/timeout.
589
634
  * @param {Error} error
590
635
  * @param {number} elapsedMs
636
+ * @param {boolean} [immediate=false]
591
637
  * @returns {Error}
592
638
  * @private
593
639
  */
594
- _mapAssertionError(error, elapsedMs) {
640
+ _mapAssertionError(error, elapsedMs, immediate = false) {
595
641
  if (!error) return new Error('Unknown WebAuthn error');
596
642
  if (error.name === 'NotAllowedError') {
597
- if (elapsedMs < NO_CRED_FAST_FAIL_MS) {
643
+ // Fast no-credential only under immediate mediation: that's the
644
+ // only path where a no-credential reject shows no UI. On the
645
+ // modal path the OS always shows a picker first, so a
646
+ // NotAllowedError is a dismiss/timeout, not a no-credential.
647
+ if (immediate && elapsedMs < NO_CRED_FAST_FAIL_MS) {
598
648
  return new PasskeyCredentialNotFoundError();
599
649
  }
600
650
  if (elapsedMs >= this._cancelVsTimeoutThresholdMs()) {