@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
@@ -0,0 +1,52 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <AuthenticationServices/AuthenticationServices.h>
3
+
4
+ NS_ASSUME_NONNULL_BEGIN
5
+
6
+ /// ObjC helper for passkey PRF operations.
7
+ ///
8
+ /// The PRF types are marked NS_REFINED_FOR_SWIFT in the iOS/macOS SDK, which makes
9
+ /// their initializers inaccessible from Swift. This helper bridges the gap.
10
+ API_AVAILABLE(ios(18.0), macos(15.0))
11
+ @interface PasskeyPRFHelper : NSObject
12
+
13
+ /// Set PRF assertion input (with salt) on an assertion request.
14
+ + (void)setAssertionPRFOnRequest:(ASAuthorizationPlatformPublicKeyCredentialAssertionRequest *)request
15
+ withSalt:(NSData *)salt;
16
+
17
+ /// Set PRF assertion input (with up to two salts) on an assertion request.
18
+ /// Pass nil for `salt2` to skip the second derivation.
19
+ + (void)setAssertionPRFOnRequest:(ASAuthorizationPlatformPublicKeyCredentialAssertionRequest *)request
20
+ withSalt1:(NSData *)salt1
21
+ salt2:(NSData * _Nullable)salt2;
22
+
23
+ /// Set PRF registration input on a registration request, support-only.
24
+ + (void)setRegistrationPRFOnRequest:(ASAuthorizationPlatformPublicKeyCredentialRegistrationRequest *)request;
25
+
26
+ /// Set PRF registration input asking the create ceremony to evaluate up
27
+ /// to two salts. Pass nil for `salt1` to only probe support, nil for
28
+ /// `salt2` to evaluate one.
29
+ + (void)setRegistrationPRFOnRequest:(ASAuthorizationPlatformPublicKeyCredentialRegistrationRequest *)request
30
+ withSalt1:(NSData * _Nullable)salt1
31
+ salt2:(NSData * _Nullable)salt2;
32
+
33
+ /// Extract the PRF output (first salt result) from a registration
34
+ /// credential. Returns nil when the authenticator evaluated nothing at
35
+ /// create, which is the pre-eval-at-create behavior.
36
+ + (NSData * _Nullable)extractPRFOutputFromRegistration:(ASAuthorizationPlatformPublicKeyCredentialRegistration *)credential;
37
+
38
+ /// Extract the second PRF output from a registration credential.
39
+ + (NSData * _Nullable)extractSecondPRFOutputFromRegistration:(ASAuthorizationPlatformPublicKeyCredentialRegistration *)credential;
40
+
41
+ /// Extract the PRF output (first salt result) from an assertion credential.
42
+ /// Returns nil if PRF output is not available.
43
+ + (NSData * _Nullable)extractPRFOutputFromAssertion:(ASAuthorizationPlatformPublicKeyCredentialAssertion *)credential;
44
+
45
+ /// Extract the second PRF output (second salt result) from an assertion
46
+ /// credential. Returns nil if PRF output is not available, or if no
47
+ /// second salt was provided in the request.
48
+ + (NSData * _Nullable)extractSecondPRFOutputFromAssertion:(ASAuthorizationPlatformPublicKeyCredentialAssertion *)credential;
49
+
50
+ @end
51
+
52
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,73 @@
1
+ #import "PasskeyPRFHelper.h"
2
+
3
+ API_AVAILABLE(ios(18.0), macos(15.0))
4
+ @implementation PasskeyPRFHelper
5
+
6
+ + (void)setAssertionPRFOnRequest:(ASAuthorizationPlatformPublicKeyCredentialAssertionRequest *)request
7
+ withSalt:(NSData *)salt {
8
+ [self setAssertionPRFOnRequest:request withSalt1:salt salt2:nil];
9
+ }
10
+
11
+ + (void)setAssertionPRFOnRequest:(ASAuthorizationPlatformPublicKeyCredentialAssertionRequest *)request
12
+ withSalt1:(NSData *)salt1
13
+ salt2:(NSData * _Nullable)salt2 {
14
+ ASAuthorizationPublicKeyCredentialPRFAssertionInputValues *values =
15
+ [[ASAuthorizationPublicKeyCredentialPRFAssertionInputValues alloc] initWithSaltInput1:salt1 saltInput2:salt2];
16
+ ASAuthorizationPublicKeyCredentialPRFAssertionInput *input =
17
+ [[ASAuthorizationPublicKeyCredentialPRFAssertionInput alloc] initWithInputValues:values perCredentialInputValues:nil];
18
+ request.prf = input;
19
+ }
20
+
21
+ + (void)setRegistrationPRFOnRequest:(ASAuthorizationPlatformPublicKeyCredentialRegistrationRequest *)request {
22
+ [self setRegistrationPRFOnRequest:request withSalt1:nil salt2:nil];
23
+ }
24
+
25
+ + (void)setRegistrationPRFOnRequest:(ASAuthorizationPlatformPublicKeyCredentialRegistrationRequest *)request
26
+ withSalt1:(NSData * _Nullable)salt1
27
+ salt2:(NSData * _Nullable)salt2 {
28
+ // nil salt1 asks only whether PRF is supported. Non-nil asks the
29
+ // create ceremony to evaluate it too, which removes the assertion
30
+ // that would otherwise follow.
31
+ ASAuthorizationPublicKeyCredentialPRFAssertionInputValues *values = nil;
32
+ if (salt1 != nil) {
33
+ values = [[ASAuthorizationPublicKeyCredentialPRFAssertionInputValues alloc]
34
+ initWithSaltInput1:salt1 saltInput2:salt2];
35
+ }
36
+ ASAuthorizationPublicKeyCredentialPRFRegistrationInput *input =
37
+ [[ASAuthorizationPublicKeyCredentialPRFRegistrationInput alloc] initWithInputValues:values];
38
+ request.prf = input;
39
+ }
40
+
41
+ + (NSData * _Nullable)extractPRFOutputFromRegistration:(ASAuthorizationPlatformPublicKeyCredentialRegistration *)credential {
42
+ ASAuthorizationPublicKeyCredentialPRFRegistrationOutput *output = credential.prf;
43
+ if (output == nil) {
44
+ return nil;
45
+ }
46
+ return output.first;
47
+ }
48
+
49
+ + (NSData * _Nullable)extractSecondPRFOutputFromRegistration:(ASAuthorizationPlatformPublicKeyCredentialRegistration *)credential {
50
+ ASAuthorizationPublicKeyCredentialPRFRegistrationOutput *output = credential.prf;
51
+ if (output == nil) {
52
+ return nil;
53
+ }
54
+ return output.second;
55
+ }
56
+
57
+ + (NSData * _Nullable)extractPRFOutputFromAssertion:(ASAuthorizationPlatformPublicKeyCredentialAssertion *)credential {
58
+ ASAuthorizationPublicKeyCredentialPRFAssertionOutput *output = credential.prf;
59
+ if (output == nil) {
60
+ return nil;
61
+ }
62
+ return output.first;
63
+ }
64
+
65
+ + (NSData * _Nullable)extractSecondPRFOutputFromAssertion:(ASAuthorizationPlatformPublicKeyCredentialAssertion *)credential {
66
+ ASAuthorizationPublicKeyCredentialPRFAssertionOutput *output = credential.prf;
67
+ if (output == nil) {
68
+ return nil;
69
+ }
70
+ return output.second;
71
+ }
72
+
73
+ @end
@@ -1 +1 @@
1
- {"version":3,"names":["getter","globalThis","NativeBreezSdkSpark","_default","exports","default","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/breez_sdk_spark-ffi.ts"],"mappings":";;;;;;AAAA;AACA;;AAyzCA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,mBAAmB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAC3BL,MAAM,EAErB;AAyuBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["getter","globalThis","NativeBreezSdkSpark","_default","exports","default","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/breez_sdk_spark-ffi.ts"],"mappings":";;;;;;AAAA;AACA;;AAy0CA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,mBAAmB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAC3BL,MAAM,EAErB;AA0uBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}