@breeztech/breez-sdk-spark-react-native 0.20.0-dev1 → 0.21.1

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.
Files changed (49) hide show
  1. package/BreezSdkSparkReactNative.podspec +6 -0
  2. package/android/build.gradle +5 -0
  3. package/android/src/main/java/com/breeztech/breezsdkspark/BreezSdkSparkReactNativePackage.kt +12 -4
  4. package/android/src/main/kotlin/com/breeztech/breezsdkspark/BreezSdkSparkPasskeyModule.kt +306 -0
  5. package/android/src/main/kotlin/technology/breez/spark/passkey/core/CredentialManagerPrfCore.kt +955 -0
  6. package/cpp/generated/breez_sdk_spark.cpp +168 -11
  7. package/cpp/generated/breez_sdk_spark.hpp +21 -0
  8. package/ios/BreezSdkSparkPasskey.m +33 -0
  9. package/ios/BreezSdkSparkPasskey.swift +201 -0
  10. package/ios/PasskeyAssertionCore.swift +881 -0
  11. package/ios/PasskeyPRFHelper.h +52 -0
  12. package/ios/PasskeyPRFHelper.m +73 -0
  13. package/lib/commonjs/generated/breez_sdk_spark-ffi.js.map +1 -1
  14. package/lib/commonjs/generated/breez_sdk_spark.js +225 -35
  15. package/lib/commonjs/generated/breez_sdk_spark.js.map +1 -1
  16. package/lib/commonjs/passkey-prf-provider.js +31 -11
  17. package/lib/commonjs/passkey-prf-provider.js.map +1 -1
  18. package/lib/module/generated/breez_sdk_spark-ffi.js.map +1 -1
  19. package/lib/module/generated/breez_sdk_spark.js +224 -34
  20. package/lib/module/generated/breez_sdk_spark.js.map +1 -1
  21. package/lib/module/passkey-prf-provider.js +31 -11
  22. package/lib/module/passkey-prf-provider.js.map +1 -1
  23. package/lib/typescript/commonjs/src/generated/breez_sdk_spark-ffi.d.ts +8 -2
  24. package/lib/typescript/commonjs/src/generated/breez_sdk_spark-ffi.d.ts.map +1 -1
  25. package/lib/typescript/commonjs/src/generated/breez_sdk_spark.d.ts +811 -26
  26. package/lib/typescript/commonjs/src/generated/breez_sdk_spark.d.ts.map +1 -1
  27. package/lib/typescript/commonjs/src/passkey-prf-provider.d.ts +24 -6
  28. package/lib/typescript/commonjs/src/passkey-prf-provider.d.ts.map +1 -1
  29. package/lib/typescript/module/src/generated/breez_sdk_spark-ffi.d.ts +8 -2
  30. package/lib/typescript/module/src/generated/breez_sdk_spark-ffi.d.ts.map +1 -1
  31. package/lib/typescript/module/src/generated/breez_sdk_spark.d.ts +811 -26
  32. package/lib/typescript/module/src/generated/breez_sdk_spark.d.ts.map +1 -1
  33. package/lib/typescript/module/src/passkey-prf-provider.d.ts +24 -6
  34. package/lib/typescript/module/src/passkey-prf-provider.d.ts.map +1 -1
  35. package/package.json +6 -4
  36. package/passkey-prf-provider.d.ts +1 -0
  37. package/passkey-prf-provider.js +5 -0
  38. package/plugin/build/index.d.ts +1 -1
  39. package/plugin/build/index.js +3 -1
  40. package/plugin/build/withAndroid.d.ts +1 -1
  41. package/plugin/build/withAndroid.js +1 -1
  42. package/plugin/build/withBinaryArtifacts.d.ts +1 -1
  43. package/plugin/build/withBinaryArtifacts.js +1 -1
  44. package/plugin/build/withIOS.d.ts +1 -1
  45. package/plugin/build/withIOS.js +1 -1
  46. package/scripts/post-ubrn.js +42 -0
  47. package/src/generated/breez_sdk_spark-ffi.ts +18 -1
  48. package/src/generated/breez_sdk_spark.ts +1303 -36
  49. package/src/passkey-prf-provider.ts +41 -12
@@ -59,6 +59,21 @@ export interface PasskeyCredential {
59
59
  backupEligible: boolean | null;
60
60
  }
61
61
 
62
+ /**
63
+ * Result of {@link PasskeyProvider.createPasskey}: the new credential, plus
64
+ * the PRF outputs when the authenticator evaluated them during the create
65
+ * ceremony. `seeds` null means it did not, so the caller derives through
66
+ * {@link PasskeyProvider.deriveSeeds}.
67
+ *
68
+ * Seeds returned here must equal what `deriveSeeds` returns for the same
69
+ * salts: the wallet is derived from them either way, so a mismatch means
70
+ * register and sign-in land on different wallets.
71
+ */
72
+ export interface CreatePasskeyOutput {
73
+ credential: PasskeyCredential;
74
+ seeds: Uint8Array[] | null;
75
+ }
76
+
62
77
  /**
63
78
  * Result of {@link PasskeyProvider.checkDomainAssociation}. Switch on `kind`
64
79
  * to handle each outcome.
@@ -199,13 +214,20 @@ export class PasskeyProvider {
199
214
  }
200
215
 
201
216
  /**
202
- * Register a new PRF-capable passkey (one prompt, no seed derivation): use
203
- * it to split credential creation from derivation in multi-step onboarding.
204
- * `excludeCredentials` blocks re-registering a device that already holds a
205
- * credential, surfaced as a `credentialAlreadyExists` failure. The returned
206
- * user handle is minted fresh per call (never host-supplied).
217
+ * Register a new PRF-capable passkey. `excludeCredentials` blocks
218
+ * re-registering a device that already holds a credential, surfaced as a
219
+ * `credentialAlreadyExists` failure. The returned user handle is minted
220
+ * fresh per call (never host-supplied).
221
+ *
222
+ * Asking the create ceremony to evaluate PRF for `salts` removes the
223
+ * assertion that would otherwise follow it. `seeds` is null when the
224
+ * authenticator reported PRF support without evaluating, or returned
225
+ * fewer outputs than salts; the caller then derives as before.
207
226
  */
208
- async createPasskey(excludeCredentials: Uint8Array[] = []): Promise<PasskeyCredential> {
227
+ async createPasskey(
228
+ excludeCredentials: Uint8Array[] = [],
229
+ salts: string[] = []
230
+ ): Promise<CreatePasskeyOutput> {
209
231
  if (!BreezSdkSparkPasskey) {
210
232
  throw passkeyModuleUnavailableError('createPasskey');
211
233
  }
@@ -215,22 +237,29 @@ export class PasskeyProvider {
215
237
  try {
216
238
  const result: {
217
239
  credentialId: string;
218
- userId: string;
240
+ userId: string | null;
219
241
  aaguid: string | null;
220
242
  backupEligible: boolean | null;
243
+ seeds: string[] | null;
221
244
  } = await BreezSdkSparkPasskey.createPasskey(
222
245
  this.rpId,
223
246
  this.rpName,
224
247
  this.userName,
225
248
  this.userDisplayName,
226
- excludeBase64
249
+ excludeBase64,
250
+ salts
227
251
  );
228
252
 
229
253
  return {
230
- credentialId: base64ToUint8Array(result.credentialId),
231
- userId: base64ToUint8Array(result.userId),
232
- aaguid: result.aaguid ? base64ToUint8Array(result.aaguid) : null,
233
- backupEligible: result.backupEligible,
254
+ credential: {
255
+ credentialId: base64ToUint8Array(result.credentialId),
256
+ userId: result.userId ? base64ToUint8Array(result.userId) : null,
257
+ aaguid: result.aaguid ? base64ToUint8Array(result.aaguid) : null,
258
+ backupEligible: result.backupEligible,
259
+ },
260
+ // Null unless the authenticator evaluated PRF during the create
261
+ // ceremony and returned one output per salt.
262
+ seeds: result.seeds ? result.seeds.map(base64ToUint8Array) : null,
234
263
  };
235
264
  } catch (err) {
236
265
  throw mapNativeError(err);