@breeztech/breez-sdk-spark-react-native 0.21.0 → 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.
- package/android/build.gradle +5 -0
- package/android/src/main/java/com/breeztech/breezsdkspark/BreezSdkSparkReactNativePackage.kt +12 -4
- package/android/src/main/kotlin/com/breeztech/breezsdkspark/BreezSdkSparkPasskeyModule.kt +306 -0
- package/android/src/main/kotlin/technology/breez/spark/passkey/core/CredentialManagerPrfCore.kt +955 -0
- package/ios/BreezSdkSparkPasskey.m +33 -0
- package/ios/BreezSdkSparkPasskey.swift +201 -0
- package/ios/PasskeyAssertionCore.swift +881 -0
- package/ios/PasskeyPRFHelper.h +52 -0
- package/ios/PasskeyPRFHelper.m +73 -0
- package/package.json +5 -3
- package/passkey-prf-provider.d.ts +1 -0
- package/passkey-prf-provider.js +5 -0
|
@@ -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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breeztech/breez-sdk-spark-react-native",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "React Native bindings for the Breez SDK - Nodeless (Spark Implementation)",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
"cpp",
|
|
38
38
|
"*.podspec",
|
|
39
39
|
"app.plugin.js",
|
|
40
|
+
"passkey-prf-provider.js",
|
|
41
|
+
"passkey-prf-provider.d.ts",
|
|
40
42
|
"react-native.config.js",
|
|
41
43
|
"swift",
|
|
42
44
|
"scripts",
|
|
@@ -209,7 +211,7 @@
|
|
|
209
211
|
"version": "0.49.0"
|
|
210
212
|
},
|
|
211
213
|
"checksums": {
|
|
212
|
-
"android": "
|
|
213
|
-
"ios": "
|
|
214
|
+
"android": "79713a56bab0aa1f9071709780051816438b5d55cca0574b4748f79e9056655d",
|
|
215
|
+
"ios": "2f84c07585c8be34dcbe324e594bf4d9351cbca3e6c8e666f9b6cfa711646240"
|
|
214
216
|
}
|
|
215
217
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/typescript/commonjs/src/passkey-prf-provider';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Root shim so `@breeztech/breez-sdk-spark-react-native/passkey-prf-provider`
|
|
2
|
+
// resolves on React Native versions whose Metro ignores package `exports`
|
|
3
|
+
// (RN < 0.79, which the package still supports). Metro versions that honour
|
|
4
|
+
// `exports` map the subpath to lib/ directly and never read this file.
|
|
5
|
+
module.exports = require('./lib/commonjs/passkey-prf-provider.js');
|