@breeztech/breez-sdk-spark 0.18.0 → 0.19.2

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.
@@ -116,6 +116,22 @@ export class BreezSdk {
116
116
  const ret = wasm.breezsdk_authorizeLightningAddressTransfer(this.__wbg_ptr, request);
117
117
  return ret;
118
118
  }
119
+ /**
120
+ * @param {BuildUnsignedLnurlPayPackageRequest} request
121
+ * @returns {Promise<UnsignedTransferPackage>}
122
+ */
123
+ buildUnsignedLnurlPayPackage(request) {
124
+ const ret = wasm.breezsdk_buildUnsignedLnurlPayPackage(this.__wbg_ptr, request);
125
+ return ret;
126
+ }
127
+ /**
128
+ * @param {BuildUnsignedTransferPackageRequest} request
129
+ * @returns {Promise<UnsignedTransferPackage>}
130
+ */
131
+ buildUnsignedTransferPackage(request) {
132
+ const ret = wasm.breezsdk_buildUnsignedTransferPackage(this.__wbg_ptr, request);
133
+ return ret;
134
+ }
119
135
  /**
120
136
  * @param {BuyBitcoinRequest} request
121
137
  * @returns {Promise<BuyBitcoinResponse>}
@@ -352,6 +368,22 @@ export class BreezSdk {
352
368
  const ret = wasm.breezsdk_prepareSendPayment(this.__wbg_ptr, request);
353
369
  return ret;
354
370
  }
371
+ /**
372
+ * @param {PublishSignedLnurlPayPackageRequest} request
373
+ * @returns {Promise<PublishSignedLnurlPayResponse>}
374
+ */
375
+ publishSignedLnurlPayPackage(request) {
376
+ const ret = wasm.breezsdk_publishSignedLnurlPayPackage(this.__wbg_ptr, request);
377
+ return ret;
378
+ }
379
+ /**
380
+ * @param {PublishSignedTransferPackageRequest} request
381
+ * @returns {Promise<PublishSignedTransferPackageResponse>}
382
+ */
383
+ publishSignedTransferPackage(request) {
384
+ const ret = wasm.breezsdk_publishSignedTransferPackage(this.__wbg_ptr, request);
385
+ return ret;
386
+ }
355
387
  /**
356
388
  * @param {ReceivePaymentRequest} request
357
389
  * @returns {Promise<ReceivePaymentResponse>}
@@ -459,6 +491,54 @@ export class BreezSdk {
459
491
  }
460
492
  if (Symbol.dispose) BreezSdk.prototype[Symbol.dispose] = BreezSdk.prototype.free;
461
493
 
494
+ /**
495
+ * A JS handle to a backend's own session store (from `defaultSessionStore`),
496
+ * exposing the same `getSession` / `setSession` interface. Wrap it in a JS
497
+ * `SessionStore` decorator and pass that to `SdkBuilder.withSessionStore` to
498
+ * transform tokens while keeping the backend's persistence: for example
499
+ * at-rest encryption, which the SDK does not apply itself.
500
+ */
501
+ export class DefaultSessionStore {
502
+ static __wrap(ptr) {
503
+ const obj = Object.create(DefaultSessionStore.prototype);
504
+ obj.__wbg_ptr = ptr;
505
+ DefaultSessionStoreFinalization.register(obj, obj.__wbg_ptr, obj);
506
+ return obj;
507
+ }
508
+ __destroy_into_raw() {
509
+ const ptr = this.__wbg_ptr;
510
+ this.__wbg_ptr = 0;
511
+ DefaultSessionStoreFinalization.unregister(this);
512
+ return ptr;
513
+ }
514
+ free() {
515
+ const ptr = this.__destroy_into_raw();
516
+ wasm.__wbg_defaultsessionstore_free(ptr, 0);
517
+ }
518
+ /**
519
+ * @param {string} service_identity_key
520
+ * @returns {Promise<Session>}
521
+ */
522
+ getSession(service_identity_key) {
523
+ const ptr0 = passStringToWasm0(service_identity_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
524
+ const len0 = WASM_VECTOR_LEN;
525
+ const ret = wasm.defaultsessionstore_getSession(this.__wbg_ptr, ptr0, len0);
526
+ return ret;
527
+ }
528
+ /**
529
+ * @param {string} service_identity_key
530
+ * @param {Session} session
531
+ * @returns {Promise<void>}
532
+ */
533
+ setSession(service_identity_key, session) {
534
+ const ptr0 = passStringToWasm0(service_identity_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
535
+ const len0 = WASM_VECTOR_LEN;
536
+ const ret = wasm.defaultsessionstore_setSession(this.__wbg_ptr, ptr0, len0, session);
537
+ return ret;
538
+ }
539
+ }
540
+ if (Symbol.dispose) DefaultSessionStore.prototype[Symbol.dispose] = DefaultSessionStore.prototype.free;
541
+
462
542
  /**
463
543
  * A Rust-backed [`ExternalBreezSigner`] surfaced to JS as a signer object that
464
544
  * can be passed to `connectWithSigner` or `SdkBuilder.newWithSigner`. Produced
@@ -973,6 +1053,23 @@ export class PasskeyClient {
973
1053
  const ret = wasm.passkeyclient_checkAvailability(this.__wbg_ptr);
974
1054
  return ret;
975
1055
  }
1056
+ /**
1057
+ * Single-CTA onboarding: silent sign-in that falls through to
1058
+ * registration when no credential exists on the device. Pins
1059
+ * immediate mediation, so on web only use it where the browser
1060
+ * advertises it (`supportsImmediateMediation`); otherwise the silent
1061
+ * probe degrades to the standard picker and a dismiss does not fall
1062
+ * through to register, so
1063
+ * present an explicit create / sign-in choice instead. Called without
1064
+ * a `label`, the response `labels` lists a returning user's wallets
1065
+ * for a picker.
1066
+ * @param {ConnectWithPasskeyRequest} request
1067
+ * @returns {Promise<ConnectWithPasskeyResponse>}
1068
+ */
1069
+ connectWithPasskey(request) {
1070
+ const ret = wasm.passkeyclient_connectWithPasskey(this.__wbg_ptr, request);
1071
+ return ret;
1072
+ }
976
1073
  /**
977
1074
  * Label sub-object. List / publish labels for this passkey's identity.
978
1075
  * @returns {PasskeyLabels}
@@ -1021,6 +1118,18 @@ export class PasskeyClient {
1021
1118
  const ret = wasm.passkeyclient_signIn(this.__wbg_ptr, request);
1022
1119
  return ret;
1023
1120
  }
1121
+ /**
1122
+ * Whether this browser advertises WebAuthn immediate mediation: the
1123
+ * silent single-CTA probe (a no-credential sign-in fast-fails with no
1124
+ * UI) works here, so a web host can pick single- vs two-button
1125
+ * onboarding. Web-only and WASM-only: native does the silent probe
1126
+ * inherently, so there is nothing to query off-web.
1127
+ * @returns {Promise<boolean>}
1128
+ */
1129
+ supportsImmediateMediation() {
1130
+ const ret = wasm.passkeyclient_supportsImmediateMediation(this.__wbg_ptr);
1131
+ return ret;
1132
+ }
1024
1133
  }
1025
1134
  if (Symbol.dispose) PasskeyClient.prototype[Symbol.dispose] = PasskeyClient.prototype.free;
1026
1135
 
@@ -1219,6 +1328,19 @@ export class SdkBuilder {
1219
1328
  const ret = wasm.sdkbuilder_withRestChainService(ptr, ptr0, len0, api_type, isLikeNone(credentials) ? 0 : addToExternrefTable0(credentials));
1220
1329
  return SdkBuilder.__wrap(ret);
1221
1330
  }
1331
+ /**
1332
+ * Overrides the session store used to cache auth tokens, replacing the one
1333
+ * the backend provides. Pass any `SessionStore`: for example one that wraps
1334
+ * the backend's own store from `defaultSessionStore` to add at-rest
1335
+ * encryption, which the SDK does not apply itself.
1336
+ * @param {SessionStore} session_store
1337
+ * @returns {SdkBuilder}
1338
+ */
1339
+ withSessionStore(session_store) {
1340
+ const ptr = this.__destroy_into_raw();
1341
+ const ret = wasm.sdkbuilder_withSessionStore(ptr, session_store);
1342
+ return SdkBuilder.__wrap(ret);
1343
+ }
1222
1344
  /**
1223
1345
  * Threads a shared [`WasmSdkContext`] into the builder.
1224
1346
  *
@@ -1570,6 +1692,24 @@ export function defaultServerConfig(network) {
1570
1692
  return ret;
1571
1693
  }
1572
1694
 
1695
+ /**
1696
+ * The session store the `config`'s backend provides for `identity` (the wallet
1697
+ * identity public key, hex), as a handle to wrap in a `SessionStore` decorator
1698
+ * and pass to `SdkBuilder.withSessionStore`, keeping the backend's persistence.
1699
+ * A typical use is at-rest encryption, which the SDK does not apply itself.
1700
+ * @param {WasmStorageConfig} config
1701
+ * @param {Network} network
1702
+ * @param {string} identity
1703
+ * @returns {Promise<DefaultSessionStore>}
1704
+ */
1705
+ export function defaultSessionStore(config, network, identity) {
1706
+ _assertClass(config, WasmStorageConfig);
1707
+ const ptr0 = passStringToWasm0(identity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1708
+ const len0 = WASM_VECTOR_LEN;
1709
+ const ret = wasm.defaultSessionStore(config.__wbg_ptr, network, ptr0, len0);
1710
+ return ret;
1711
+ }
1712
+
1573
1713
  /**
1574
1714
  * File-based storage rooted at `storageDir` — IndexedDB in the browser,
1575
1715
  * SQLite under Node.js.
@@ -2009,6 +2149,10 @@ function __wbg_get_imports() {
2009
2149
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2010
2150
  }
2011
2151
  }, arguments); },
2152
+ __wbg_defaultsessionstore_new: function(arg0) {
2153
+ const ret = DefaultSessionStore.__wrap(arg0);
2154
+ return ret;
2155
+ },
2012
2156
  __wbg_deleteCachedItem_b8fbe3ebea21ed7e: function() { return handleError(function (arg0, arg1, arg2) {
2013
2157
  let deferred0_0;
2014
2158
  let deferred0_1;
@@ -2354,6 +2498,10 @@ function __wbg_get_imports() {
2354
2498
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2355
2499
  }
2356
2500
  }, arguments); },
2501
+ __wbg_getVerifiedLeafKeys_12405bb5f39ffb61: function() { return handleError(function (arg0) {
2502
+ const ret = arg0.getVerifiedLeafKeys();
2503
+ return ret;
2504
+ }, arguments); },
2357
2505
  __wbg_get_41476db20fef99a8: function() { return handleError(function (arg0, arg1) {
2358
2506
  const ret = Reflect.get(arg0, arg1);
2359
2507
  return ret;
@@ -2799,6 +2947,23 @@ function __wbg_get_imports() {
2799
2947
  const ret = module.require;
2800
2948
  return ret;
2801
2949
  }, arguments); },
2950
+ __wbg_reserveTokenOutputsByOutpoints_a18be5f9fb4ab30a: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
2951
+ let deferred0_0;
2952
+ let deferred0_1;
2953
+ let deferred1_0;
2954
+ let deferred1_1;
2955
+ try {
2956
+ deferred0_0 = arg1;
2957
+ deferred0_1 = arg2;
2958
+ deferred1_0 = arg4;
2959
+ deferred1_1 = arg5;
2960
+ const ret = arg0.reserveTokenOutputsByOutpoints(getStringFromWasm0(arg1, arg2), arg3, getStringFromWasm0(arg4, arg5));
2961
+ return ret;
2962
+ } finally {
2963
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2964
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2965
+ }
2966
+ }, arguments); },
2802
2967
  __wbg_reserveTokenOutputs_233990fbd0ce963a: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
2803
2968
  let deferred0_0;
2804
2969
  let deferred0_1;
@@ -2827,6 +2992,18 @@ function __wbg_get_imports() {
2827
2992
  const ret = SdkBuilder.__wrap(arg0);
2828
2993
  return ret;
2829
2994
  },
2995
+ __wbg_selectTokenOutputs_450f20621013b14d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
2996
+ let deferred0_0;
2997
+ let deferred0_1;
2998
+ try {
2999
+ deferred0_0 = arg1;
3000
+ deferred0_1 = arg2;
3001
+ const ret = arg0.selectTokenOutputs(getStringFromWasm0(arg1, arg2), arg3, arg4, arg5);
3002
+ return ret;
3003
+ } finally {
3004
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3005
+ }
3006
+ }, arguments); },
2830
3007
  __wbg_send_0edb796d05cd3239: function() { return handleError(function (arg0, arg1, arg2) {
2831
3008
  arg0.send(getStringFromWasm0(arg1, arg2));
2832
3009
  }, arguments); },
@@ -3107,6 +3284,10 @@ function __wbg_get_imports() {
3107
3284
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
3108
3285
  return ret;
3109
3286
  },
3287
+ __wbg_supportsImmediateMediation_a50b46b1cdfacd3d: function() { return handleError(function (arg0) {
3288
+ const ret = arg0.supportsImmediateMediation();
3289
+ return ret;
3290
+ }, arguments); },
3110
3291
  __wbg_syncAddOutgoingChange_69db2a1430cbd55a: function() { return handleError(function (arg0, arg1) {
3111
3292
  const ret = arg0.syncAddOutgoingChange(arg1);
3112
3293
  return ret;
@@ -3168,6 +3349,18 @@ function __wbg_get_imports() {
3168
3349
  const ret = arg0.toString();
3169
3350
  return ret;
3170
3351
  },
3352
+ __wbg_tryReserveLeavesByIds_a6433e824993a82f: function() { return handleError(function (arg0, arg1, arg2, arg3) {
3353
+ let deferred0_0;
3354
+ let deferred0_1;
3355
+ try {
3356
+ deferred0_0 = arg2;
3357
+ deferred0_1 = arg3;
3358
+ const ret = arg0.tryReserveLeavesByIds(arg1, getStringFromWasm0(arg2, arg3));
3359
+ return ret;
3360
+ } finally {
3361
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3362
+ }
3363
+ }, arguments); },
3171
3364
  __wbg_tryReserveLeaves_d2cd87cbc2a886d2: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
3172
3365
  let deferred0_0;
3173
3366
  let deferred0_1;
@@ -3180,6 +3373,10 @@ function __wbg_get_imports() {
3180
3373
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3181
3374
  }
3182
3375
  }, arguments); },
3376
+ __wbg_trySelectLeaves_ff1aeb7ffc5e4e57: function() { return handleError(function (arg0, arg1) {
3377
+ const ret = arg0.trySelectLeaves(arg1);
3378
+ return ret;
3379
+ }, arguments); },
3183
3380
  __wbg_updateDeposit_efb96cf6e6fbe7b7: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
3184
3381
  let deferred0_0;
3185
3382
  let deferred0_1;
@@ -3244,61 +3441,61 @@ function __wbg_get_imports() {
3244
3441
  },
3245
3442
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
3246
3443
  // 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`.
3247
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h38afe039e8450492);
3444
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h21f6855640435575);
3248
3445
  return ret;
3249
3446
  },
3250
3447
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
3251
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 219, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3448
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3252
3449
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2);
3253
3450
  return ret;
3254
3451
  },
3255
3452
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
3256
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 219, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3453
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3257
3454
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2);
3258
3455
  return ret;
3259
3456
  },
3260
3457
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
3261
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 219, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3458
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3262
3459
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_3);
3263
3460
  return ret;
3264
3461
  },
3265
3462
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
3266
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 219, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3463
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3267
3464
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_4);
3268
3465
  return ret;
3269
3466
  },
3270
3467
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
3271
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 219, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3468
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3272
3469
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5);
3273
3470
  return ret;
3274
3471
  },
3275
3472
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
3276
3473
  // 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`.
3277
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_6);
3474
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h21f6855640435575_6);
3278
3475
  return ret;
3279
3476
  },
3280
3477
  __wbindgen_cast_0000000000000008: function(arg0, arg1) {
3281
3478
  // 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`.
3282
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_7);
3479
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h21f6855640435575_7);
3283
3480
  return ret;
3284
3481
  },
3285
3482
  __wbindgen_cast_0000000000000009: function(arg0, arg1) {
3286
3483
  // 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`.
3287
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_8);
3484
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h21f6855640435575_8);
3288
3485
  return ret;
3289
3486
  },
3290
3487
  __wbindgen_cast_000000000000000a: function(arg0, arg1) {
3291
3488
  // 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`.
3292
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_9);
3489
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h21f6855640435575_9);
3293
3490
  return ret;
3294
3491
  },
3295
3492
  __wbindgen_cast_000000000000000b: function(arg0, arg1) {
3296
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 393, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3493
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 371, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3297
3494
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1d6669a7b693932a);
3298
3495
  return ret;
3299
3496
  },
3300
3497
  __wbindgen_cast_000000000000000c: function(arg0, arg1) {
3301
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 422, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
3498
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 403, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
3302
3499
  const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h0fa3f876e31d2a3e);
3303
3500
  return ret;
3304
3501
  },
@@ -3418,36 +3615,36 @@ function wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5(arg0, a
3418
3615
  wasm.wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5(arg0, arg1, arg2);
3419
3616
  }
3420
3617
 
3421
- function wasm_bindgen__convert__closures_____invoke__h38afe039e8450492(arg0, arg1, arg2) {
3422
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h38afe039e8450492(arg0, arg1, arg2);
3618
+ function wasm_bindgen__convert__closures_____invoke__h21f6855640435575(arg0, arg1, arg2) {
3619
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h21f6855640435575(arg0, arg1, arg2);
3423
3620
  if (ret[1]) {
3424
3621
  throw takeFromExternrefTable0(ret[0]);
3425
3622
  }
3426
3623
  }
3427
3624
 
3428
- function wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_6(arg0, arg1, arg2) {
3429
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_6(arg0, arg1, arg2);
3625
+ function wasm_bindgen__convert__closures_____invoke__h21f6855640435575_6(arg0, arg1, arg2) {
3626
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h21f6855640435575_6(arg0, arg1, arg2);
3430
3627
  if (ret[1]) {
3431
3628
  throw takeFromExternrefTable0(ret[0]);
3432
3629
  }
3433
3630
  }
3434
3631
 
3435
- function wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_7(arg0, arg1, arg2) {
3436
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_7(arg0, arg1, arg2);
3632
+ function wasm_bindgen__convert__closures_____invoke__h21f6855640435575_7(arg0, arg1, arg2) {
3633
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h21f6855640435575_7(arg0, arg1, arg2);
3437
3634
  if (ret[1]) {
3438
3635
  throw takeFromExternrefTable0(ret[0]);
3439
3636
  }
3440
3637
  }
3441
3638
 
3442
- function wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_8(arg0, arg1, arg2) {
3443
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_8(arg0, arg1, arg2);
3639
+ function wasm_bindgen__convert__closures_____invoke__h21f6855640435575_8(arg0, arg1, arg2) {
3640
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h21f6855640435575_8(arg0, arg1, arg2);
3444
3641
  if (ret[1]) {
3445
3642
  throw takeFromExternrefTable0(ret[0]);
3446
3643
  }
3447
3644
  }
3448
3645
 
3449
- function wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_9(arg0, arg1, arg2) {
3450
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_9(arg0, arg1, arg2);
3646
+ function wasm_bindgen__convert__closures_____invoke__h21f6855640435575_9(arg0, arg1, arg2) {
3647
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h21f6855640435575_9(arg0, arg1, arg2);
3451
3648
  if (ret[1]) {
3452
3649
  throw takeFromExternrefTable0(ret[0]);
3453
3650
  }
@@ -3483,6 +3680,9 @@ const BitcoinChainServiceHandleFinalization = (typeof FinalizationRegistry === '
3483
3680
  const BreezSdkFinalization = (typeof FinalizationRegistry === 'undefined')
3484
3681
  ? { register: () => {}, unregister: () => {} }
3485
3682
  : new FinalizationRegistry(ptr => wasm.__wbg_breezsdk_free(ptr, 1));
3683
+ const DefaultSessionStoreFinalization = (typeof FinalizationRegistry === 'undefined')
3684
+ ? { register: () => {}, unregister: () => {} }
3685
+ : new FinalizationRegistry(ptr => wasm.__wbg_defaultsessionstore_free(ptr, 1));
3486
3686
  const ExternalBreezSignerHandleFinalization = (typeof FinalizationRegistry === 'undefined')
3487
3687
  ? { register: () => {}, unregister: () => {} }
3488
3688
  : new FinalizationRegistry(ptr => wasm.__wbg_externalbreezsignerhandle_free(ptr, 1));
Binary file
@@ -18,6 +18,8 @@ export const bitcoinchainservicehandle_recommendedFees: (a: number) => any;
18
18
  export const breezsdk_addContact: (a: number, b: any) => any;
19
19
  export const breezsdk_addEventListener: (a: number, b: any) => any;
20
20
  export const breezsdk_authorizeLightningAddressTransfer: (a: number, b: any) => any;
21
+ export const breezsdk_buildUnsignedLnurlPayPackage: (a: number, b: any) => any;
22
+ export const breezsdk_buildUnsignedTransferPackage: (a: number, b: any) => any;
21
23
  export const breezsdk_buyBitcoin: (a: number, b: any) => any;
22
24
  export const breezsdk_checkLightningAddressAvailable: (a: number, b: any) => any;
23
25
  export const breezsdk_checkMessage: (a: number, b: any) => any;
@@ -48,6 +50,8 @@ export const breezsdk_optimizeLeaves: (a: number, b: any) => any;
48
50
  export const breezsdk_parse: (a: number, b: number, c: number) => any;
49
51
  export const breezsdk_prepareLnurlPay: (a: number, b: any) => any;
50
52
  export const breezsdk_prepareSendPayment: (a: number, b: any) => any;
53
+ export const breezsdk_publishSignedLnurlPayPackage: (a: number, b: any) => any;
54
+ export const breezsdk_publishSignedTransferPackage: (a: number, b: any) => any;
51
55
  export const breezsdk_receivePayment: (a: number, b: any) => any;
52
56
  export const breezsdk_recommendedFees: (a: number) => any;
53
57
  export const breezsdk_refundDeposit: (a: number, b: any) => any;
@@ -71,7 +75,10 @@ export const defaultExternalSigners: (a: number, b: number, c: number, d: number
71
75
  export const defaultMysqlStorageConfig: (a: number, b: number) => any;
72
76
  export const defaultPostgresStorageConfig: (a: number, b: number) => any;
73
77
  export const defaultServerConfig: (a: any) => any;
78
+ export const defaultSessionStore: (a: number, b: any, c: number, d: number) => any;
74
79
  export const defaultStorage: (a: number, b: number) => number;
80
+ export const defaultsessionstore_getSession: (a: number, b: number, c: number) => any;
81
+ export const defaultsessionstore_setSession: (a: number, b: number, c: number, d: any) => any;
75
82
  export const externalbreezsignerhandle_decryptEcies: (a: number, b: number, c: number, d: number, e: number) => any;
76
83
  export const externalbreezsignerhandle_derivePublicKey: (a: number, b: number, c: number) => any;
77
84
  export const externalbreezsignerhandle_encryptEcies: (a: number, b: number, c: number, d: number, e: number) => any;
@@ -106,10 +113,12 @@ export const mysqlStorage: (a: any) => number;
106
113
  export const newRestChainService: (a: number, b: number, c: any, d: any, e: number) => any;
107
114
  export const newSharedSdkContext: (a: any) => any;
108
115
  export const passkeyclient_checkAvailability: (a: number) => any;
116
+ export const passkeyclient_connectWithPasskey: (a: number, b: any) => any;
109
117
  export const passkeyclient_labels: (a: number) => number;
110
118
  export const passkeyclient_new: (a: any, b: number, c: number, d: number) => number;
111
119
  export const passkeyclient_register: (a: number, b: any) => any;
112
120
  export const passkeyclient_signIn: (a: number, b: any) => any;
121
+ export const passkeyclient_supportsImmediateMediation: (a: number) => any;
113
122
  export const passkeylabels_list: (a: number) => any;
114
123
  export const passkeylabels_store: (a: number, b: number, c: number) => any;
115
124
  export const postgresStorage: (a: any) => number;
@@ -126,6 +135,7 @@ export const sdkbuilder_withMysqlBackend: (a: number, b: any) => [number, number
126
135
  export const sdkbuilder_withPaymentObserver: (a: number, b: any) => number;
127
136
  export const sdkbuilder_withPostgresBackend: (a: number, b: any) => [number, number, number];
128
137
  export const sdkbuilder_withRestChainService: (a: number, b: number, c: number, d: any, e: number) => number;
138
+ export const sdkbuilder_withSessionStore: (a: number, b: any) => number;
129
139
  export const sdkbuilder_withSharedContext: (a: number, b: number) => number;
130
140
  export const sdkbuilder_withStorage: (a: number, b: any) => number;
131
141
  export const sdkbuilder_withStorageBackend: (a: number, b: number) => number;
@@ -156,16 +166,17 @@ export const intounderlyingsink_write: (a: number, b: any) => any;
156
166
  export const intounderlyingsource_cancel: (a: number) => void;
157
167
  export const intounderlyingsource_pull: (a: number, b: any) => any;
158
168
  export const __wbg_externalbreezsignerhandle_free: (a: number, b: number) => void;
159
- export const __wbg_externalsparksignerhandle_free: (a: number, b: number) => void;
169
+ export const __wbg_defaultsessionstore_free: (a: number, b: number) => void;
160
170
  export const __wbg_externalsigningsignerhandle_free: (a: number, b: number) => void;
171
+ export const __wbg_externalsparksignerhandle_free: (a: number, b: number) => void;
161
172
  export const __wbg_signingonlyexternalsigners_free: (a: number, b: number) => void;
162
173
  export const signingonlyexternalsigners_breezSigner: (a: number) => number;
163
174
  export const signingonlyexternalsigners_sparkSigner: (a: number) => number;
164
- export const wasm_bindgen__convert__closures_____invoke__h38afe039e8450492: (a: number, b: number, c: any) => [number, number];
165
- export const wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_6: (a: number, b: number, c: any) => [number, number];
166
- export const wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_7: (a: number, b: number, c: any) => [number, number];
167
- export const wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_8: (a: number, b: number, c: any) => [number, number];
168
- export const wasm_bindgen__convert__closures_____invoke__h38afe039e8450492_9: (a: number, b: number, c: any) => [number, number];
175
+ export const wasm_bindgen__convert__closures_____invoke__h21f6855640435575: (a: number, b: number, c: any) => [number, number];
176
+ export const wasm_bindgen__convert__closures_____invoke__h21f6855640435575_6: (a: number, b: number, c: any) => [number, number];
177
+ export const wasm_bindgen__convert__closures_____invoke__h21f6855640435575_7: (a: number, b: number, c: any) => [number, number];
178
+ export const wasm_bindgen__convert__closures_____invoke__h21f6855640435575_8: (a: number, b: number, c: any) => [number, number];
179
+ export const wasm_bindgen__convert__closures_____invoke__h21f6855640435575_9: (a: number, b: number, c: any) => [number, number];
169
180
  export const wasm_bindgen__convert__closures_____invoke__h41057d61edf43a32: (a: number, b: number, c: any, d: any) => void;
170
181
  export const wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2: (a: number, b: number, c: any) => void;
171
182
  export const wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2: (a: number, b: number, c: any) => void;
@@ -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()) {