@breeztech/breez-sdk-spark 0.19.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.
Binary file
@@ -307,6 +307,14 @@ export interface PrfProvider {
307
307
  * device. Hosts gate UX on the result.
308
308
  */
309
309
  isSupported(): Promise<boolean>;
310
+
311
+ /**
312
+ * Optional. Whether the silent single-CTA flow works here (a
313
+ * no-credential sign-in fast-fails with no UI). Omit to be treated as
314
+ * unsupported (`false`); the built-in browser provider returns the
315
+ * WebAuthn immediate-mediation capability.
316
+ */
317
+ supportsImmediateMediation?(): Promise<boolean>;
310
318
  }
311
319
 
312
320
  /**
@@ -322,7 +330,9 @@ export interface DeriveSeedOptions {
322
330
  allowCredentials?: Uint8Array[];
323
331
  /**
324
332
  * Fast-fail when no local credential is available. On the web this maps
325
- * to WebAuthn `mediation: 'immediate'`: `true` opts in where the browser
333
+ * to WebAuthn `uiMode: 'immediate'`, used only on the unpinned probe (a
334
+ * non-empty allowCredentials keeps the standard picker, since a pin means
335
+ * a credential is already known): `true` opts in where the browser
326
336
  * advertises support, `false` uses the standard picker. Unset uses the
327
337
  * provider default.
328
338
  */
@@ -372,6 +382,15 @@ export interface PasskeyProviderOptions {
372
382
  userDisplayName?: string;
373
383
  }
374
384
 
385
+ /**
386
+ * Request shape for `PasskeyClient.connectWithPasskey`.
387
+ */
388
+ export interface ConnectWithPasskeyRequest {
389
+ label?: string;
390
+ allowCredentials?: Uint8Array[];
391
+ excludeCredentials?: Uint8Array[];
392
+ }
393
+
375
394
  /**
376
395
  * Request shape for `PasskeyClient.register`.
377
396
  */
@@ -389,6 +408,15 @@ export interface SignInRequest {
389
408
  preferImmediatelyAvailableCredentials?: boolean;
390
409
  }
391
410
 
411
+ /**
412
+ * Response shape for `PasskeyClient.connectWithPasskey`.
413
+ */
414
+ export interface ConnectWithPasskeyResponse {
415
+ wallet: Wallet;
416
+ credential?: PasskeyCredential;
417
+ labels: string[];
418
+ }
419
+
392
420
  /**
393
421
  * Response shape for `PasskeyClient.register`.
394
422
  */
@@ -2060,6 +2088,18 @@ export class PasskeyClient {
2060
2088
  * hosts can gate UX on.
2061
2089
  */
2062
2090
  checkAvailability(): Promise<PasskeyAvailability>;
2091
+ /**
2092
+ * Single-CTA onboarding: silent sign-in that falls through to
2093
+ * registration when no credential exists on the device. Pins
2094
+ * immediate mediation, so on web only use it where the browser
2095
+ * advertises it (`supportsImmediateMediation`); otherwise the silent
2096
+ * probe degrades to the standard picker and a dismiss does not fall
2097
+ * through to register, so
2098
+ * present an explicit create / sign-in choice instead. Called without
2099
+ * a `label`, the response `labels` lists a returning user's wallets
2100
+ * for a picker.
2101
+ */
2102
+ connectWithPasskey(request: ConnectWithPasskeyRequest): Promise<ConnectWithPasskeyResponse>;
2063
2103
  /**
2064
2104
  * Label sub-object. List / publish labels for this passkey's identity.
2065
2105
  */
@@ -2084,6 +2124,14 @@ export class PasskeyClient {
2084
2124
  * label set in the same ceremony.
2085
2125
  */
2086
2126
  signIn(request: SignInRequest): Promise<SignInResponse>;
2127
+ /**
2128
+ * Whether this browser advertises WebAuthn immediate mediation: the
2129
+ * silent single-CTA probe (a no-credential sign-in fast-fails with no
2130
+ * UI) works here, so a web host can pick single- vs two-button
2131
+ * onboarding. Web-only and WASM-only: native does the silent probe
2132
+ * inherently, so there is nothing to query off-web.
2133
+ */
2134
+ supportsImmediateMediation(): Promise<boolean>;
2087
2135
  }
2088
2136
 
2089
2137
  /**
@@ -1051,6 +1051,23 @@ export class PasskeyClient {
1051
1051
  const ret = wasm.passkeyclient_checkAvailability(this.__wbg_ptr);
1052
1052
  return ret;
1053
1053
  }
1054
+ /**
1055
+ * Single-CTA onboarding: silent sign-in that falls through to
1056
+ * registration when no credential exists on the device. Pins
1057
+ * immediate mediation, so on web only use it where the browser
1058
+ * advertises it (`supportsImmediateMediation`); otherwise the silent
1059
+ * probe degrades to the standard picker and a dismiss does not fall
1060
+ * through to register, so
1061
+ * present an explicit create / sign-in choice instead. Called without
1062
+ * a `label`, the response `labels` lists a returning user's wallets
1063
+ * for a picker.
1064
+ * @param {ConnectWithPasskeyRequest} request
1065
+ * @returns {Promise<ConnectWithPasskeyResponse>}
1066
+ */
1067
+ connectWithPasskey(request) {
1068
+ const ret = wasm.passkeyclient_connectWithPasskey(this.__wbg_ptr, request);
1069
+ return ret;
1070
+ }
1054
1071
  /**
1055
1072
  * Label sub-object. List / publish labels for this passkey's identity.
1056
1073
  * @returns {PasskeyLabels}
@@ -1099,6 +1116,18 @@ export class PasskeyClient {
1099
1116
  const ret = wasm.passkeyclient_signIn(this.__wbg_ptr, request);
1100
1117
  return ret;
1101
1118
  }
1119
+ /**
1120
+ * Whether this browser advertises WebAuthn immediate mediation: the
1121
+ * silent single-CTA probe (a no-credential sign-in fast-fails with no
1122
+ * UI) works here, so a web host can pick single- vs two-button
1123
+ * onboarding. Web-only and WASM-only: native does the silent probe
1124
+ * inherently, so there is nothing to query off-web.
1125
+ * @returns {Promise<boolean>}
1126
+ */
1127
+ supportsImmediateMediation() {
1128
+ const ret = wasm.passkeyclient_supportsImmediateMediation(this.__wbg_ptr);
1129
+ return ret;
1130
+ }
1102
1131
  }
1103
1132
  if (Symbol.dispose) PasskeyClient.prototype[Symbol.dispose] = PasskeyClient.prototype.free;
1104
1133
 
@@ -3250,6 +3279,10 @@ export function __wbg_subarray_fbe3cef290e1fa43(arg0, arg1, arg2) {
3250
3279
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
3251
3280
  return ret;
3252
3281
  }
3282
+ export function __wbg_supportsImmediateMediation_a50b46b1cdfacd3d() { return handleError(function (arg0) {
3283
+ const ret = arg0.supportsImmediateMediation();
3284
+ return ret;
3285
+ }, arguments); }
3253
3286
  export function __wbg_syncAddOutgoingChange_69db2a1430cbd55a() { return handleError(function (arg0, arg1) {
3254
3287
  const ret = arg0.syncAddOutgoingChange(arg1);
3255
3288
  return ret;
@@ -3407,27 +3440,27 @@ export function __wbindgen_cast_0000000000000001(arg0, arg1) {
3407
3440
  return ret;
3408
3441
  }
3409
3442
  export function __wbindgen_cast_0000000000000002(arg0, arg1) {
3410
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3443
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3411
3444
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2);
3412
3445
  return ret;
3413
3446
  }
3414
3447
  export function __wbindgen_cast_0000000000000003(arg0, arg1) {
3415
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3448
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3416
3449
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2);
3417
3450
  return ret;
3418
3451
  }
3419
3452
  export function __wbindgen_cast_0000000000000004(arg0, arg1) {
3420
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3453
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3421
3454
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_3);
3422
3455
  return ret;
3423
3456
  }
3424
3457
  export function __wbindgen_cast_0000000000000005(arg0, arg1) {
3425
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3458
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3426
3459
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_4);
3427
3460
  return ret;
3428
3461
  }
3429
3462
  export function __wbindgen_cast_0000000000000006(arg0, arg1) {
3430
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3463
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3431
3464
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5);
3432
3465
  return ret;
3433
3466
  }
@@ -3452,12 +3485,12 @@ export function __wbindgen_cast_000000000000000a(arg0, arg1) {
3452
3485
  return ret;
3453
3486
  }
3454
3487
  export function __wbindgen_cast_000000000000000b(arg0, arg1) {
3455
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 392, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3488
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 371, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3456
3489
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1d6669a7b693932a);
3457
3490
  return ret;
3458
3491
  }
3459
3492
  export function __wbindgen_cast_000000000000000c(arg0, arg1) {
3460
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 421, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
3493
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 403, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
3461
3494
  const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h0fa3f876e31d2a3e);
3462
3495
  return ret;
3463
3496
  }
@@ -113,10 +113,12 @@ export const mysqlStorage: (a: any) => number;
113
113
  export const newRestChainService: (a: number, b: number, c: any, d: any, e: number) => any;
114
114
  export const newSharedSdkContext: (a: any) => any;
115
115
  export const passkeyclient_checkAvailability: (a: number) => any;
116
+ export const passkeyclient_connectWithPasskey: (a: number, b: any) => any;
116
117
  export const passkeyclient_labels: (a: number) => number;
117
118
  export const passkeyclient_new: (a: any, b: number, c: number, d: number) => number;
118
119
  export const passkeyclient_register: (a: number, b: any) => any;
119
120
  export const passkeyclient_signIn: (a: number, b: any) => any;
121
+ export const passkeyclient_supportsImmediateMediation: (a: number) => any;
120
122
  export const passkeylabels_list: (a: number) => any;
121
123
  export const passkeylabels_store: (a: number, b: number, c: number) => any;
122
124
  export const postgresStorage: (a: any) => number;
@@ -307,6 +307,14 @@ export interface PrfProvider {
307
307
  * device. Hosts gate UX on the result.
308
308
  */
309
309
  isSupported(): Promise<boolean>;
310
+
311
+ /**
312
+ * Optional. Whether the silent single-CTA flow works here (a
313
+ * no-credential sign-in fast-fails with no UI). Omit to be treated as
314
+ * unsupported (`false`); the built-in browser provider returns the
315
+ * WebAuthn immediate-mediation capability.
316
+ */
317
+ supportsImmediateMediation?(): Promise<boolean>;
310
318
  }
311
319
 
312
320
  /**
@@ -322,7 +330,9 @@ export interface DeriveSeedOptions {
322
330
  allowCredentials?: Uint8Array[];
323
331
  /**
324
332
  * Fast-fail when no local credential is available. On the web this maps
325
- * to WebAuthn `mediation: 'immediate'`: `true` opts in where the browser
333
+ * to WebAuthn `uiMode: 'immediate'`, used only on the unpinned probe (a
334
+ * non-empty allowCredentials keeps the standard picker, since a pin means
335
+ * a credential is already known): `true` opts in where the browser
326
336
  * advertises support, `false` uses the standard picker. Unset uses the
327
337
  * provider default.
328
338
  */
@@ -372,6 +382,15 @@ export interface PasskeyProviderOptions {
372
382
  userDisplayName?: string;
373
383
  }
374
384
 
385
+ /**
386
+ * Request shape for `PasskeyClient.connectWithPasskey`.
387
+ */
388
+ export interface ConnectWithPasskeyRequest {
389
+ label?: string;
390
+ allowCredentials?: Uint8Array[];
391
+ excludeCredentials?: Uint8Array[];
392
+ }
393
+
375
394
  /**
376
395
  * Request shape for `PasskeyClient.register`.
377
396
  */
@@ -389,6 +408,15 @@ export interface SignInRequest {
389
408
  preferImmediatelyAvailableCredentials?: boolean;
390
409
  }
391
410
 
411
+ /**
412
+ * Response shape for `PasskeyClient.connectWithPasskey`.
413
+ */
414
+ export interface ConnectWithPasskeyResponse {
415
+ wallet: Wallet;
416
+ credential?: PasskeyCredential;
417
+ labels: string[];
418
+ }
419
+
392
420
  /**
393
421
  * Response shape for `PasskeyClient.register`.
394
422
  */
@@ -2060,6 +2088,18 @@ export class PasskeyClient {
2060
2088
  * hosts can gate UX on.
2061
2089
  */
2062
2090
  checkAvailability(): Promise<PasskeyAvailability>;
2091
+ /**
2092
+ * Single-CTA onboarding: silent sign-in that falls through to
2093
+ * registration when no credential exists on the device. Pins
2094
+ * immediate mediation, so on web only use it where the browser
2095
+ * advertises it (`supportsImmediateMediation`); otherwise the silent
2096
+ * probe degrades to the standard picker and a dismiss does not fall
2097
+ * through to register, so
2098
+ * present an explicit create / sign-in choice instead. Called without
2099
+ * a `label`, the response `labels` lists a returning user's wallets
2100
+ * for a picker.
2101
+ */
2102
+ connectWithPasskey(request: ConnectWithPasskeyRequest): Promise<ConnectWithPasskeyResponse>;
2063
2103
  /**
2064
2104
  * Label sub-object. List / publish labels for this passkey's identity.
2065
2105
  */
@@ -2084,6 +2124,14 @@ export class PasskeyClient {
2084
2124
  * label set in the same ceremony.
2085
2125
  */
2086
2126
  signIn(request: SignInRequest): Promise<SignInResponse>;
2127
+ /**
2128
+ * Whether this browser advertises WebAuthn immediate mediation: the
2129
+ * silent single-CTA probe (a no-credential sign-in fast-fails with no
2130
+ * UI) works here, so a web host can pick single- vs two-button
2131
+ * onboarding. Web-only and WASM-only: native does the silent probe
2132
+ * inherently, so there is nothing to query off-web.
2133
+ */
2134
+ supportsImmediateMediation(): Promise<boolean>;
2087
2135
  }
2088
2136
 
2089
2137
  /**
@@ -1053,6 +1053,23 @@ export class PasskeyClient {
1053
1053
  const ret = wasm.passkeyclient_checkAvailability(this.__wbg_ptr);
1054
1054
  return ret;
1055
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
+ }
1056
1073
  /**
1057
1074
  * Label sub-object. List / publish labels for this passkey's identity.
1058
1075
  * @returns {PasskeyLabels}
@@ -1101,6 +1118,18 @@ export class PasskeyClient {
1101
1118
  const ret = wasm.passkeyclient_signIn(this.__wbg_ptr, request);
1102
1119
  return ret;
1103
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
+ }
1104
1133
  }
1105
1134
  if (Symbol.dispose) PasskeyClient.prototype[Symbol.dispose] = PasskeyClient.prototype.free;
1106
1135
 
@@ -3255,6 +3284,10 @@ function __wbg_get_imports() {
3255
3284
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
3256
3285
  return ret;
3257
3286
  },
3287
+ __wbg_supportsImmediateMediation_a50b46b1cdfacd3d: function() { return handleError(function (arg0) {
3288
+ const ret = arg0.supportsImmediateMediation();
3289
+ return ret;
3290
+ }, arguments); },
3258
3291
  __wbg_syncAddOutgoingChange_69db2a1430cbd55a: function() { return handleError(function (arg0, arg1) {
3259
3292
  const ret = arg0.syncAddOutgoingChange(arg1);
3260
3293
  return ret;
@@ -3412,27 +3445,27 @@ function __wbg_get_imports() {
3412
3445
  return ret;
3413
3446
  },
3414
3447
  __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`.
3448
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3416
3449
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2);
3417
3450
  return ret;
3418
3451
  },
3419
3452
  __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`.
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`.
3421
3454
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2);
3422
3455
  return ret;
3423
3456
  },
3424
3457
  __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`.
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`.
3426
3459
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_3);
3427
3460
  return ret;
3428
3461
  },
3429
3462
  __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`.
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`.
3431
3464
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_4);
3432
3465
  return ret;
3433
3466
  },
3434
3467
  __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`.
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`.
3436
3469
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5);
3437
3470
  return ret;
3438
3471
  },
@@ -3457,12 +3490,12 @@ function __wbg_get_imports() {
3457
3490
  return ret;
3458
3491
  },
3459
3492
  __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`.
3493
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 371, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3461
3494
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1d6669a7b693932a);
3462
3495
  return ret;
3463
3496
  },
3464
3497
  __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`.
3498
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 403, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
3466
3499
  const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h0fa3f876e31d2a3e);
3467
3500
  return ret;
3468
3501
  },
Binary file
@@ -113,10 +113,12 @@ export const mysqlStorage: (a: any) => number;
113
113
  export const newRestChainService: (a: number, b: number, c: any, d: any, e: number) => any;
114
114
  export const newSharedSdkContext: (a: any) => any;
115
115
  export const passkeyclient_checkAvailability: (a: number) => any;
116
+ export const passkeyclient_connectWithPasskey: (a: number, b: any) => any;
116
117
  export const passkeyclient_labels: (a: number) => number;
117
118
  export const passkeyclient_new: (a: any, b: number, c: number, d: number) => number;
118
119
  export const passkeyclient_register: (a: number, b: any) => any;
119
120
  export const passkeyclient_signIn: (a: number, b: any) => any;
121
+ export const passkeyclient_supportsImmediateMediation: (a: number) => any;
120
122
  export const passkeylabels_list: (a: number) => any;
121
123
  export const passkeylabels_store: (a: number, b: number, c: number) => any;
122
124
  export const postgresStorage: (a: any) => number;
@@ -307,6 +307,14 @@ export interface PrfProvider {
307
307
  * device. Hosts gate UX on the result.
308
308
  */
309
309
  isSupported(): Promise<boolean>;
310
+
311
+ /**
312
+ * Optional. Whether the silent single-CTA flow works here (a
313
+ * no-credential sign-in fast-fails with no UI). Omit to be treated as
314
+ * unsupported (`false`); the built-in browser provider returns the
315
+ * WebAuthn immediate-mediation capability.
316
+ */
317
+ supportsImmediateMediation?(): Promise<boolean>;
310
318
  }
311
319
 
312
320
  /**
@@ -322,7 +330,9 @@ export interface DeriveSeedOptions {
322
330
  allowCredentials?: Uint8Array[];
323
331
  /**
324
332
  * Fast-fail when no local credential is available. On the web this maps
325
- * to WebAuthn `mediation: 'immediate'`: `true` opts in where the browser
333
+ * to WebAuthn `uiMode: 'immediate'`, used only on the unpinned probe (a
334
+ * non-empty allowCredentials keeps the standard picker, since a pin means
335
+ * a credential is already known): `true` opts in where the browser
326
336
  * advertises support, `false` uses the standard picker. Unset uses the
327
337
  * provider default.
328
338
  */
@@ -372,6 +382,15 @@ export interface PasskeyProviderOptions {
372
382
  userDisplayName?: string;
373
383
  }
374
384
 
385
+ /**
386
+ * Request shape for `PasskeyClient.connectWithPasskey`.
387
+ */
388
+ export interface ConnectWithPasskeyRequest {
389
+ label?: string;
390
+ allowCredentials?: Uint8Array[];
391
+ excludeCredentials?: Uint8Array[];
392
+ }
393
+
375
394
  /**
376
395
  * Request shape for `PasskeyClient.register`.
377
396
  */
@@ -389,6 +408,15 @@ export interface SignInRequest {
389
408
  preferImmediatelyAvailableCredentials?: boolean;
390
409
  }
391
410
 
411
+ /**
412
+ * Response shape for `PasskeyClient.connectWithPasskey`.
413
+ */
414
+ export interface ConnectWithPasskeyResponse {
415
+ wallet: Wallet;
416
+ credential?: PasskeyCredential;
417
+ labels: string[];
418
+ }
419
+
392
420
  /**
393
421
  * Response shape for `PasskeyClient.register`.
394
422
  */
@@ -2060,6 +2088,18 @@ export class PasskeyClient {
2060
2088
  * hosts can gate UX on.
2061
2089
  */
2062
2090
  checkAvailability(): Promise<PasskeyAvailability>;
2091
+ /**
2092
+ * Single-CTA onboarding: silent sign-in that falls through to
2093
+ * registration when no credential exists on the device. Pins
2094
+ * immediate mediation, so on web only use it where the browser
2095
+ * advertises it (`supportsImmediateMediation`); otherwise the silent
2096
+ * probe degrades to the standard picker and a dismiss does not fall
2097
+ * through to register, so
2098
+ * present an explicit create / sign-in choice instead. Called without
2099
+ * a `label`, the response `labels` lists a returning user's wallets
2100
+ * for a picker.
2101
+ */
2102
+ connectWithPasskey(request: ConnectWithPasskeyRequest): Promise<ConnectWithPasskeyResponse>;
2063
2103
  /**
2064
2104
  * Label sub-object. List / publish labels for this passkey's identity.
2065
2105
  */
@@ -2084,6 +2124,14 @@ export class PasskeyClient {
2084
2124
  * label set in the same ceremony.
2085
2125
  */
2086
2126
  signIn(request: SignInRequest): Promise<SignInResponse>;
2127
+ /**
2128
+ * Whether this browser advertises WebAuthn immediate mediation: the
2129
+ * silent single-CTA probe (a no-credential sign-in fast-fails with no
2130
+ * UI) works here, so a web host can pick single- vs two-button
2131
+ * onboarding. Web-only and WASM-only: native does the silent probe
2132
+ * inherently, so there is nothing to query off-web.
2133
+ */
2134
+ supportsImmediateMediation(): Promise<boolean>;
2087
2135
  }
2088
2136
 
2089
2137
  /**
@@ -1063,6 +1063,23 @@ class PasskeyClient {
1063
1063
  const ret = wasm.passkeyclient_checkAvailability(this.__wbg_ptr);
1064
1064
  return ret;
1065
1065
  }
1066
+ /**
1067
+ * Single-CTA onboarding: silent sign-in that falls through to
1068
+ * registration when no credential exists on the device. Pins
1069
+ * immediate mediation, so on web only use it where the browser
1070
+ * advertises it (`supportsImmediateMediation`); otherwise the silent
1071
+ * probe degrades to the standard picker and a dismiss does not fall
1072
+ * through to register, so
1073
+ * present an explicit create / sign-in choice instead. Called without
1074
+ * a `label`, the response `labels` lists a returning user's wallets
1075
+ * for a picker.
1076
+ * @param {ConnectWithPasskeyRequest} request
1077
+ * @returns {Promise<ConnectWithPasskeyResponse>}
1078
+ */
1079
+ connectWithPasskey(request) {
1080
+ const ret = wasm.passkeyclient_connectWithPasskey(this.__wbg_ptr, request);
1081
+ return ret;
1082
+ }
1066
1083
  /**
1067
1084
  * Label sub-object. List / publish labels for this passkey's identity.
1068
1085
  * @returns {PasskeyLabels}
@@ -1111,6 +1128,18 @@ class PasskeyClient {
1111
1128
  const ret = wasm.passkeyclient_signIn(this.__wbg_ptr, request);
1112
1129
  return ret;
1113
1130
  }
1131
+ /**
1132
+ * Whether this browser advertises WebAuthn immediate mediation: the
1133
+ * silent single-CTA probe (a no-credential sign-in fast-fails with no
1134
+ * UI) works here, so a web host can pick single- vs two-button
1135
+ * onboarding. Web-only and WASM-only: native does the silent probe
1136
+ * inherently, so there is nothing to query off-web.
1137
+ * @returns {Promise<boolean>}
1138
+ */
1139
+ supportsImmediateMediation() {
1140
+ const ret = wasm.passkeyclient_supportsImmediateMediation(this.__wbg_ptr);
1141
+ return ret;
1142
+ }
1114
1143
  }
1115
1144
  if (Symbol.dispose) PasskeyClient.prototype[Symbol.dispose] = PasskeyClient.prototype.free;
1116
1145
  exports.PasskeyClient = PasskeyClient;
@@ -3292,6 +3321,10 @@ function __wbg_get_imports() {
3292
3321
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
3293
3322
  return ret;
3294
3323
  },
3324
+ __wbg_supportsImmediateMediation_a50b46b1cdfacd3d: function() { return handleError(function (arg0) {
3325
+ const ret = arg0.supportsImmediateMediation();
3326
+ return ret;
3327
+ }, arguments); },
3295
3328
  __wbg_syncAddOutgoingChange_69db2a1430cbd55a: function() { return handleError(function (arg0, arg1) {
3296
3329
  const ret = arg0.syncAddOutgoingChange(arg1);
3297
3330
  return ret;
@@ -3449,27 +3482,27 @@ function __wbg_get_imports() {
3449
3482
  return ret;
3450
3483
  },
3451
3484
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
3452
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3485
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3453
3486
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2);
3454
3487
  return ret;
3455
3488
  },
3456
3489
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
3457
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3490
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3458
3491
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2);
3459
3492
  return ret;
3460
3493
  },
3461
3494
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
3462
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3495
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3463
3496
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_3);
3464
3497
  return ret;
3465
3498
  },
3466
3499
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
3467
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3500
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3468
3501
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_4);
3469
3502
  return ret;
3470
3503
  },
3471
3504
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
3472
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 230, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3505
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3473
3506
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5);
3474
3507
  return ret;
3475
3508
  },
@@ -3494,12 +3527,12 @@ function __wbg_get_imports() {
3494
3527
  return ret;
3495
3528
  },
3496
3529
  __wbindgen_cast_000000000000000b: function(arg0, arg1) {
3497
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 392, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3530
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 371, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3498
3531
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1d6669a7b693932a);
3499
3532
  return ret;
3500
3533
  },
3501
3534
  __wbindgen_cast_000000000000000c: function(arg0, arg1) {
3502
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 421, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
3535
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 403, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
3503
3536
  const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h0fa3f876e31d2a3e);
3504
3537
  return ret;
3505
3538
  },
Binary file
@@ -113,10 +113,12 @@ export const mysqlStorage: (a: any) => number;
113
113
  export const newRestChainService: (a: number, b: number, c: any, d: any, e: number) => any;
114
114
  export const newSharedSdkContext: (a: any) => any;
115
115
  export const passkeyclient_checkAvailability: (a: number) => any;
116
+ export const passkeyclient_connectWithPasskey: (a: number, b: any) => any;
116
117
  export const passkeyclient_labels: (a: number) => number;
117
118
  export const passkeyclient_new: (a: any, b: number, c: number, d: number) => number;
118
119
  export const passkeyclient_register: (a: number, b: any) => any;
119
120
  export const passkeyclient_signIn: (a: number, b: any) => any;
121
+ export const passkeyclient_supportsImmediateMediation: (a: number) => any;
120
122
  export const passkeylabels_list: (a: number) => any;
121
123
  export const passkeylabels_store: (a: number, b: number, c: number) => any;
122
124
  export const postgresStorage: (a: any) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breeztech/breez-sdk-spark",
3
- "version": "0.19.0",
3
+ "version": "0.19.2",
4
4
  "description": "Breez Spark SDK",
5
5
  "repository": "https://github.com/breez/spark-sdk",
6
6
  "author": "Breez <contact@breez.technology> (https://github.com/breez)",
@@ -307,6 +307,14 @@ export interface PrfProvider {
307
307
  * device. Hosts gate UX on the result.
308
308
  */
309
309
  isSupported(): Promise<boolean>;
310
+
311
+ /**
312
+ * Optional. Whether the silent single-CTA flow works here (a
313
+ * no-credential sign-in fast-fails with no UI). Omit to be treated as
314
+ * unsupported (`false`); the built-in browser provider returns the
315
+ * WebAuthn immediate-mediation capability.
316
+ */
317
+ supportsImmediateMediation?(): Promise<boolean>;
310
318
  }
311
319
 
312
320
  /**
@@ -322,7 +330,9 @@ export interface DeriveSeedOptions {
322
330
  allowCredentials?: Uint8Array[];
323
331
  /**
324
332
  * Fast-fail when no local credential is available. On the web this maps
325
- * to WebAuthn `mediation: 'immediate'`: `true` opts in where the browser
333
+ * to WebAuthn `uiMode: 'immediate'`, used only on the unpinned probe (a
334
+ * non-empty allowCredentials keeps the standard picker, since a pin means
335
+ * a credential is already known): `true` opts in where the browser
326
336
  * advertises support, `false` uses the standard picker. Unset uses the
327
337
  * provider default.
328
338
  */
@@ -372,6 +382,15 @@ export interface PasskeyProviderOptions {
372
382
  userDisplayName?: string;
373
383
  }
374
384
 
385
+ /**
386
+ * Request shape for `PasskeyClient.connectWithPasskey`.
387
+ */
388
+ export interface ConnectWithPasskeyRequest {
389
+ label?: string;
390
+ allowCredentials?: Uint8Array[];
391
+ excludeCredentials?: Uint8Array[];
392
+ }
393
+
375
394
  /**
376
395
  * Request shape for `PasskeyClient.register`.
377
396
  */
@@ -389,6 +408,15 @@ export interface SignInRequest {
389
408
  preferImmediatelyAvailableCredentials?: boolean;
390
409
  }
391
410
 
411
+ /**
412
+ * Response shape for `PasskeyClient.connectWithPasskey`.
413
+ */
414
+ export interface ConnectWithPasskeyResponse {
415
+ wallet: Wallet;
416
+ credential?: PasskeyCredential;
417
+ labels: string[];
418
+ }
419
+
392
420
  /**
393
421
  * Response shape for `PasskeyClient.register`.
394
422
  */
@@ -2060,6 +2088,18 @@ export class PasskeyClient {
2060
2088
  * hosts can gate UX on.
2061
2089
  */
2062
2090
  checkAvailability(): Promise<PasskeyAvailability>;
2091
+ /**
2092
+ * Single-CTA onboarding: silent sign-in that falls through to
2093
+ * registration when no credential exists on the device. Pins
2094
+ * immediate mediation, so on web only use it where the browser
2095
+ * advertises it (`supportsImmediateMediation`); otherwise the silent
2096
+ * probe degrades to the standard picker and a dismiss does not fall
2097
+ * through to register, so
2098
+ * present an explicit create / sign-in choice instead. Called without
2099
+ * a `label`, the response `labels` lists a returning user's wallets
2100
+ * for a picker.
2101
+ */
2102
+ connectWithPasskey(request: ConnectWithPasskeyRequest): Promise<ConnectWithPasskeyResponse>;
2063
2103
  /**
2064
2104
  * Label sub-object. List / publish labels for this passkey's identity.
2065
2105
  */
@@ -2084,6 +2124,14 @@ export class PasskeyClient {
2084
2124
  * label set in the same ceremony.
2085
2125
  */
2086
2126
  signIn(request: SignInRequest): Promise<SignInResponse>;
2127
+ /**
2128
+ * Whether this browser advertises WebAuthn immediate mediation: the
2129
+ * silent single-CTA probe (a no-credential sign-in fast-fails with no
2130
+ * UI) works here, so a web host can pick single- vs two-button
2131
+ * onboarding. Web-only and WASM-only: native does the silent probe
2132
+ * inherently, so there is nothing to query off-web.
2133
+ */
2134
+ supportsImmediateMediation(): Promise<boolean>;
2087
2135
  }
2088
2136
 
2089
2137
  /**
@@ -2446,10 +2494,12 @@ export interface InitOutput {
2446
2494
  readonly newRestChainService: (a: number, b: number, c: any, d: any, e: number) => any;
2447
2495
  readonly newSharedSdkContext: (a: any) => any;
2448
2496
  readonly passkeyclient_checkAvailability: (a: number) => any;
2497
+ readonly passkeyclient_connectWithPasskey: (a: number, b: any) => any;
2449
2498
  readonly passkeyclient_labels: (a: number) => number;
2450
2499
  readonly passkeyclient_new: (a: any, b: number, c: number, d: number) => number;
2451
2500
  readonly passkeyclient_register: (a: number, b: any) => any;
2452
2501
  readonly passkeyclient_signIn: (a: number, b: any) => any;
2502
+ readonly passkeyclient_supportsImmediateMediation: (a: number) => any;
2453
2503
  readonly passkeylabels_list: (a: number) => any;
2454
2504
  readonly passkeylabels_store: (a: number, b: number, c: number) => any;
2455
2505
  readonly postgresStorage: (a: any) => number;
@@ -1053,6 +1053,23 @@ export class PasskeyClient {
1053
1053
  const ret = wasm.passkeyclient_checkAvailability(this.__wbg_ptr);
1054
1054
  return ret;
1055
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
+ }
1056
1073
  /**
1057
1074
  * Label sub-object. List / publish labels for this passkey's identity.
1058
1075
  * @returns {PasskeyLabels}
@@ -1101,6 +1118,18 @@ export class PasskeyClient {
1101
1118
  const ret = wasm.passkeyclient_signIn(this.__wbg_ptr, request);
1102
1119
  return ret;
1103
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
+ }
1104
1133
  }
1105
1134
  if (Symbol.dispose) PasskeyClient.prototype[Symbol.dispose] = PasskeyClient.prototype.free;
1106
1135
 
@@ -3255,6 +3284,10 @@ function __wbg_get_imports() {
3255
3284
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
3256
3285
  return ret;
3257
3286
  },
3287
+ __wbg_supportsImmediateMediation_a50b46b1cdfacd3d: function() { return handleError(function (arg0) {
3288
+ const ret = arg0.supportsImmediateMediation();
3289
+ return ret;
3290
+ }, arguments); },
3258
3291
  __wbg_syncAddOutgoingChange_69db2a1430cbd55a: function() { return handleError(function (arg0, arg1) {
3259
3292
  const ret = arg0.syncAddOutgoingChange(arg1);
3260
3293
  return ret;
@@ -3412,27 +3445,27 @@ function __wbg_get_imports() {
3412
3445
  return ret;
3413
3446
  },
3414
3447
  __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`.
3448
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 366, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3416
3449
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2);
3417
3450
  return ret;
3418
3451
  },
3419
3452
  __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`.
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`.
3421
3454
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2);
3422
3455
  return ret;
3423
3456
  },
3424
3457
  __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`.
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`.
3426
3459
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_3);
3427
3460
  return ret;
3428
3461
  },
3429
3462
  __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`.
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`.
3431
3464
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_4);
3432
3465
  return ret;
3433
3466
  },
3434
3467
  __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`.
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`.
3436
3469
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5);
3437
3470
  return ret;
3438
3471
  },
@@ -3457,12 +3490,12 @@ function __wbg_get_imports() {
3457
3490
  return ret;
3458
3491
  },
3459
3492
  __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`.
3493
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 371, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3461
3494
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1d6669a7b693932a);
3462
3495
  return ret;
3463
3496
  },
3464
3497
  __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`.
3498
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 403, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
3466
3499
  const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h0fa3f876e31d2a3e);
3467
3500
  return ret;
3468
3501
  },
Binary file
@@ -113,10 +113,12 @@ export const mysqlStorage: (a: any) => number;
113
113
  export const newRestChainService: (a: number, b: number, c: any, d: any, e: number) => any;
114
114
  export const newSharedSdkContext: (a: any) => any;
115
115
  export const passkeyclient_checkAvailability: (a: number) => any;
116
+ export const passkeyclient_connectWithPasskey: (a: number, b: any) => any;
116
117
  export const passkeyclient_labels: (a: number) => number;
117
118
  export const passkeyclient_new: (a: any, b: number, c: number, d: number) => number;
118
119
  export const passkeyclient_register: (a: number, b: any) => any;
119
120
  export const passkeyclient_signIn: (a: number, b: any) => any;
121
+ export const passkeyclient_supportsImmediateMediation: (a: number) => any;
120
122
  export const passkeylabels_list: (a: number) => any;
121
123
  export const passkeylabels_store: (a: number, b: number, c: number) => any;
122
124
  export const postgresStorage: (a: any) => number;
@@ -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()) {