@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.
- package/BreezSdkSparkReactNative.podspec +6 -0
- 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/cpp/generated/breez_sdk_spark.cpp +168 -11
- package/cpp/generated/breez_sdk_spark.hpp +21 -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/lib/commonjs/generated/breez_sdk_spark-ffi.js.map +1 -1
- package/lib/commonjs/generated/breez_sdk_spark.js +225 -35
- package/lib/commonjs/generated/breez_sdk_spark.js.map +1 -1
- package/lib/commonjs/passkey-prf-provider.js +31 -11
- package/lib/commonjs/passkey-prf-provider.js.map +1 -1
- package/lib/module/generated/breez_sdk_spark-ffi.js.map +1 -1
- package/lib/module/generated/breez_sdk_spark.js +224 -34
- package/lib/module/generated/breez_sdk_spark.js.map +1 -1
- package/lib/module/passkey-prf-provider.js +31 -11
- package/lib/module/passkey-prf-provider.js.map +1 -1
- package/lib/typescript/commonjs/src/generated/breez_sdk_spark-ffi.d.ts +8 -2
- package/lib/typescript/commonjs/src/generated/breez_sdk_spark-ffi.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/generated/breez_sdk_spark.d.ts +811 -26
- package/lib/typescript/commonjs/src/generated/breez_sdk_spark.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/passkey-prf-provider.d.ts +24 -6
- package/lib/typescript/commonjs/src/passkey-prf-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/breez_sdk_spark-ffi.d.ts +8 -2
- package/lib/typescript/module/src/generated/breez_sdk_spark-ffi.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/breez_sdk_spark.d.ts +811 -26
- package/lib/typescript/module/src/generated/breez_sdk_spark.d.ts.map +1 -1
- package/lib/typescript/module/src/passkey-prf-provider.d.ts +24 -6
- package/lib/typescript/module/src/passkey-prf-provider.d.ts.map +1 -1
- package/package.json +6 -4
- package/passkey-prf-provider.d.ts +1 -0
- package/passkey-prf-provider.js +5 -0
- package/plugin/build/index.d.ts +1 -1
- package/plugin/build/index.js +3 -1
- package/plugin/build/withAndroid.d.ts +1 -1
- package/plugin/build/withAndroid.js +1 -1
- package/plugin/build/withBinaryArtifacts.d.ts +1 -1
- package/plugin/build/withBinaryArtifacts.js +1 -1
- package/plugin/build/withIOS.d.ts +1 -1
- package/plugin/build/withIOS.js +1 -1
- package/scripts/post-ubrn.js +42 -0
- package/src/generated/breez_sdk_spark-ffi.ts +18 -1
- package/src/generated/breez_sdk_spark.ts +1303 -36
- package/src/passkey-prf-provider.ts +41 -12
|
@@ -275,7 +275,7 @@ typedef void (*UniffiCallbackInterfacePrfProviderMethod1)(
|
|
|
275
275
|
UniffiForeignFutureCompleteI8 uniffi_future_callback,
|
|
276
276
|
uint64_t uniffi_callback_data, UniffiForeignFuture *uniffi_out_return);
|
|
277
277
|
typedef void (*UniffiCallbackInterfacePrfProviderMethod2)(
|
|
278
|
-
uint64_t uniffi_handle, RustBuffer exclude_credentials,
|
|
278
|
+
uint64_t uniffi_handle, RustBuffer exclude_credentials, RustBuffer salts,
|
|
279
279
|
UniffiForeignFutureCompleteRustBuffer uniffi_future_callback,
|
|
280
280
|
uint64_t uniffi_callback_data, UniffiForeignFuture *uniffi_out_return);
|
|
281
281
|
typedef void (*UniffiCallbackInterfacePrfProviderMethod3)(
|
|
@@ -596,6 +596,9 @@ uniffi_breez_sdk_spark_fn_method_breezsdk_add_event_listener(void *ptr,
|
|
|
596
596
|
uniffi_breez_sdk_spark_fn_method_breezsdk_authorize_lightning_address_transfer(
|
|
597
597
|
void *ptr, RustBuffer request);
|
|
598
598
|
/*handle*/ uint64_t
|
|
599
|
+
uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_batch_package(
|
|
600
|
+
void *ptr, RustBuffer request);
|
|
601
|
+
/*handle*/ uint64_t
|
|
599
602
|
uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_lnurl_pay_package(
|
|
600
603
|
void *ptr, RustBuffer request);
|
|
601
604
|
/*handle*/ uint64_t
|
|
@@ -680,6 +683,9 @@ uniffi_breez_sdk_spark_fn_method_breezsdk_parse(void *ptr, RustBuffer input);
|
|
|
680
683
|
uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_lnurl_pay(void *ptr,
|
|
681
684
|
RustBuffer request);
|
|
682
685
|
/*handle*/ uint64_t
|
|
686
|
+
uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_batch(
|
|
687
|
+
void *ptr, RustBuffer request);
|
|
688
|
+
/*handle*/ uint64_t
|
|
683
689
|
uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_payment(
|
|
684
690
|
void *ptr, RustBuffer request);
|
|
685
691
|
/*handle*/ uint64_t
|
|
@@ -711,6 +717,9 @@ uniffi_breez_sdk_spark_fn_method_breezsdk_register_webhook(void *ptr,
|
|
|
711
717
|
uniffi_breez_sdk_spark_fn_method_breezsdk_remove_event_listener(void *ptr,
|
|
712
718
|
RustBuffer id);
|
|
713
719
|
/*handle*/ uint64_t
|
|
720
|
+
uniffi_breez_sdk_spark_fn_method_breezsdk_send_batch(void *ptr,
|
|
721
|
+
RustBuffer request);
|
|
722
|
+
/*handle*/ uint64_t
|
|
714
723
|
uniffi_breez_sdk_spark_fn_method_breezsdk_send_payment(void *ptr,
|
|
715
724
|
RustBuffer request);
|
|
716
725
|
/*handle*/ uint64_t
|
|
@@ -909,7 +918,7 @@ uniffi_breez_sdk_spark_fn_method_prfprovider_derive_seeds(void *ptr,
|
|
|
909
918
|
/*handle*/ uint64_t
|
|
910
919
|
uniffi_breez_sdk_spark_fn_method_prfprovider_is_supported(void *ptr);
|
|
911
920
|
/*handle*/ uint64_t uniffi_breez_sdk_spark_fn_method_prfprovider_create_passkey(
|
|
912
|
-
void *ptr, RustBuffer exclude_credentials);
|
|
921
|
+
void *ptr, RustBuffer exclude_credentials, RustBuffer salts);
|
|
913
922
|
/*handle*/ uint64_t
|
|
914
923
|
uniffi_breez_sdk_spark_fn_method_prfprovider_check_domain_association(
|
|
915
924
|
void *ptr);
|
|
@@ -1324,6 +1333,8 @@ uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_add_event_listener();
|
|
|
1324
1333
|
uint16_t
|
|
1325
1334
|
uniffi_breez_sdk_spark_checksum_method_breezsdk_authorize_lightning_address_transfer();
|
|
1326
1335
|
uint16_t
|
|
1336
|
+
uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_batch_package();
|
|
1337
|
+
uint16_t
|
|
1327
1338
|
uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_lnurl_pay_package();
|
|
1328
1339
|
uint16_t
|
|
1329
1340
|
uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_transfer_package();
|
|
@@ -1363,6 +1374,7 @@ uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_withdraw();
|
|
|
1363
1374
|
uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_optimize_leaves();
|
|
1364
1375
|
uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_parse();
|
|
1365
1376
|
uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_lnurl_pay();
|
|
1377
|
+
uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_batch();
|
|
1366
1378
|
uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_payment();
|
|
1367
1379
|
uint16_t
|
|
1368
1380
|
uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_unilateral_exit();
|
|
@@ -1380,6 +1392,7 @@ uniffi_breez_sdk_spark_checksum_method_breezsdk_register_lightning_address();
|
|
|
1380
1392
|
uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_register_webhook();
|
|
1381
1393
|
uint16_t
|
|
1382
1394
|
uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener();
|
|
1395
|
+
uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_send_batch();
|
|
1383
1396
|
uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment();
|
|
1384
1397
|
uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_sign_message();
|
|
1385
1398
|
uint16_t uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet();
|
|
@@ -10909,7 +10922,7 @@ using namespace facebook;
|
|
|
10909
10922
|
|
|
10910
10923
|
// We need to store a lambda in a global so we can call it from
|
|
10911
10924
|
// a function pointer. The function pointer is passed to Rust.
|
|
10912
|
-
static std::function<void(uint64_t, RustBuffer,
|
|
10925
|
+
static std::function<void(uint64_t, RustBuffer, RustBuffer,
|
|
10913
10926
|
UniffiForeignFutureCompleteRustBuffer, uint64_t,
|
|
10914
10927
|
UniffiForeignFuture *)>
|
|
10915
10928
|
rsLambda = nullptr;
|
|
@@ -10920,6 +10933,7 @@ static void body(jsi::Runtime &rt,
|
|
|
10920
10933
|
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
10921
10934
|
std::shared_ptr<jsi::Value> callbackValue,
|
|
10922
10935
|
uint64_t rs_uniffiHandle, RustBuffer rs_excludeCredentials,
|
|
10936
|
+
RustBuffer rs_salts,
|
|
10923
10937
|
UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
|
|
10924
10938
|
uint64_t rs_uniffiCallbackData,
|
|
10925
10939
|
UniffiForeignFuture *rs_uniffiOutReturn) {
|
|
@@ -10931,6 +10945,8 @@ static void body(jsi::Runtime &rt,
|
|
|
10931
10945
|
auto js_excludeCredentials =
|
|
10932
10946
|
uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
|
|
10933
10947
|
rt, callInvoker, rs_excludeCredentials);
|
|
10948
|
+
auto js_salts = uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
|
|
10949
|
+
rt, callInvoker, rs_salts);
|
|
10934
10950
|
auto js_uniffiFutureCallback = uniffi::breez_sdk_spark::Bridging<
|
|
10935
10951
|
UniffiForeignFutureCompleteRustBuffer>::toJs(rt, callInvoker,
|
|
10936
10952
|
rs_uniffiFutureCallback);
|
|
@@ -10943,8 +10959,9 @@ static void body(jsi::Runtime &rt,
|
|
|
10943
10959
|
try {
|
|
10944
10960
|
// Getting the callback function
|
|
10945
10961
|
auto cb = callbackValue->asObject(rt).asFunction(rt);
|
|
10946
|
-
auto uniffiResult =
|
|
10947
|
-
|
|
10962
|
+
auto uniffiResult =
|
|
10963
|
+
cb.call(rt, js_uniffiHandle, js_excludeCredentials, js_salts,
|
|
10964
|
+
js_uniffiFutureCallback, js_uniffiCallbackData);
|
|
10948
10965
|
|
|
10949
10966
|
// return type is MutReference(Struct("ForeignFuture"))
|
|
10950
10967
|
// Finally, we need to copy the return value back into the Rust pointer.
|
|
@@ -10960,6 +10977,7 @@ static void body(jsi::Runtime &rt,
|
|
|
10960
10977
|
|
|
10961
10978
|
static void
|
|
10962
10979
|
callback(uint64_t rs_uniffiHandle, RustBuffer rs_excludeCredentials,
|
|
10980
|
+
RustBuffer rs_salts,
|
|
10963
10981
|
UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
|
|
10964
10982
|
uint64_t rs_uniffiCallbackData,
|
|
10965
10983
|
UniffiForeignFuture *rs_uniffiOutReturn) {
|
|
@@ -10978,8 +10996,8 @@ callback(uint64_t rs_uniffiHandle, RustBuffer rs_excludeCredentials,
|
|
|
10978
10996
|
|
|
10979
10997
|
// The runtime, the actual callback jsi::funtion, and the callInvoker
|
|
10980
10998
|
// are all in the lambda.
|
|
10981
|
-
rsLambda(rs_uniffiHandle, rs_excludeCredentials,
|
|
10982
|
-
rs_uniffiCallbackData, rs_uniffiOutReturn);
|
|
10999
|
+
rsLambda(rs_uniffiHandle, rs_excludeCredentials, rs_salts,
|
|
11000
|
+
rs_uniffiFutureCallback, rs_uniffiCallbackData, rs_uniffiOutReturn);
|
|
10983
11001
|
}
|
|
10984
11002
|
|
|
10985
11003
|
static UniffiCallbackInterfacePrfProviderMethod2
|
|
@@ -11003,6 +11021,7 @@ makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfaceprfprovid
|
|
|
11003
11021
|
auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
|
|
11004
11022
|
rsLambda = [&rt, callInvoker, callbackValue](
|
|
11005
11023
|
uint64_t rs_uniffiHandle, RustBuffer rs_excludeCredentials,
|
|
11024
|
+
RustBuffer rs_salts,
|
|
11006
11025
|
UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
|
|
11007
11026
|
uint64_t rs_uniffiCallbackData,
|
|
11008
11027
|
UniffiForeignFuture *rs_uniffiOutReturn) {
|
|
@@ -11010,10 +11029,10 @@ makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfaceprfprovid
|
|
|
11010
11029
|
// arguments into JSI values and calling the callback.
|
|
11011
11030
|
uniffi_runtime::UniffiCallFunc jsLambda =
|
|
11012
11031
|
[callInvoker, callbackValue, rs_uniffiHandle, rs_excludeCredentials,
|
|
11013
|
-
rs_uniffiFutureCallback, rs_uniffiCallbackData,
|
|
11032
|
+
rs_salts, rs_uniffiFutureCallback, rs_uniffiCallbackData,
|
|
11014
11033
|
rs_uniffiOutReturn](jsi::Runtime &rt) mutable {
|
|
11015
11034
|
body(rt, callInvoker, callbackValue, rs_uniffiHandle,
|
|
11016
|
-
rs_excludeCredentials, rs_uniffiFutureCallback,
|
|
11035
|
+
rs_excludeCredentials, rs_salts, rs_uniffiFutureCallback,
|
|
11017
11036
|
rs_uniffiCallbackData, rs_uniffiOutReturn);
|
|
11018
11037
|
};
|
|
11019
11038
|
// We'll then call that lambda from the callInvoker which will
|
|
@@ -17298,6 +17317,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
|
|
|
17298
17317
|
->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_authorize_lightning_address_transfer(
|
|
17299
17318
|
rt, thisVal, args, count);
|
|
17300
17319
|
});
|
|
17320
|
+
props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_batch_"
|
|
17321
|
+
"package"] = jsi::Function::createFromHostFunction(
|
|
17322
|
+
rt,
|
|
17323
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_method_"
|
|
17324
|
+
"breezsdk_build_unsigned_batch_package"),
|
|
17325
|
+
2,
|
|
17326
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
17327
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
17328
|
+
return this
|
|
17329
|
+
->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_batch_package(
|
|
17330
|
+
rt, thisVal, args, count);
|
|
17331
|
+
});
|
|
17301
17332
|
props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_lnurl_"
|
|
17302
17333
|
"pay_package"] = jsi::Function::createFromHostFunction(
|
|
17303
17334
|
rt,
|
|
@@ -17680,6 +17711,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
|
|
|
17680
17711
|
->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_lnurl_pay(
|
|
17681
17712
|
rt, thisVal, args, count);
|
|
17682
17713
|
});
|
|
17714
|
+
props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_batch"] =
|
|
17715
|
+
jsi::Function::createFromHostFunction(
|
|
17716
|
+
rt,
|
|
17717
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_method_"
|
|
17718
|
+
"breezsdk_prepare_send_batch"),
|
|
17719
|
+
2,
|
|
17720
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
17721
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
17722
|
+
return this
|
|
17723
|
+
->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_batch(
|
|
17724
|
+
rt, thisVal, args, count);
|
|
17725
|
+
});
|
|
17683
17726
|
props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_payment"] =
|
|
17684
17727
|
jsi::Function::createFromHostFunction(
|
|
17685
17728
|
rt,
|
|
@@ -17815,6 +17858,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
|
|
|
17815
17858
|
->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_remove_event_listener(
|
|
17816
17859
|
rt, thisVal, args, count);
|
|
17817
17860
|
});
|
|
17861
|
+
props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_send_batch"] =
|
|
17862
|
+
jsi::Function::createFromHostFunction(
|
|
17863
|
+
rt,
|
|
17864
|
+
jsi::PropNameID::forAscii(
|
|
17865
|
+
rt, "ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_send_batch"),
|
|
17866
|
+
2,
|
|
17867
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
17868
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
17869
|
+
return this
|
|
17870
|
+
->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_send_batch(
|
|
17871
|
+
rt, thisVal, args, count);
|
|
17872
|
+
});
|
|
17818
17873
|
props["ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_send_payment"] =
|
|
17819
17874
|
jsi::Function::createFromHostFunction(
|
|
17820
17875
|
rt,
|
|
@@ -18729,7 +18784,7 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
|
|
|
18729
18784
|
rt,
|
|
18730
18785
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_method_"
|
|
18731
18786
|
"prfprovider_create_passkey"),
|
|
18732
|
-
|
|
18787
|
+
3,
|
|
18733
18788
|
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
18734
18789
|
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
18735
18790
|
return this
|
|
@@ -20773,6 +20828,19 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
|
|
|
20773
20828
|
->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_authorize_lightning_address_transfer(
|
|
20774
20829
|
rt, thisVal, args, count);
|
|
20775
20830
|
});
|
|
20831
|
+
props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_"
|
|
20832
|
+
"batch_package"] = jsi::Function::createFromHostFunction(
|
|
20833
|
+
rt,
|
|
20834
|
+
jsi::PropNameID::forAscii(rt,
|
|
20835
|
+
"ubrn_uniffi_breez_sdk_spark_checksum_method_"
|
|
20836
|
+
"breezsdk_build_unsigned_batch_package"),
|
|
20837
|
+
0,
|
|
20838
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
20839
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
20840
|
+
return this
|
|
20841
|
+
->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_batch_package(
|
|
20842
|
+
rt, thisVal, args, count);
|
|
20843
|
+
});
|
|
20776
20844
|
props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_"
|
|
20777
20845
|
"lnurl_pay_package"] = jsi::Function::createFromHostFunction(
|
|
20778
20846
|
rt,
|
|
@@ -21151,6 +21219,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
|
|
|
21151
21219
|
->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_lnurl_pay(
|
|
21152
21220
|
rt, thisVal, args, count);
|
|
21153
21221
|
});
|
|
21222
|
+
props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_"
|
|
21223
|
+
"batch"] = jsi::Function::createFromHostFunction(
|
|
21224
|
+
rt,
|
|
21225
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
|
|
21226
|
+
"method_breezsdk_prepare_send_batch"),
|
|
21227
|
+
0,
|
|
21228
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
21229
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
21230
|
+
return this
|
|
21231
|
+
->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_batch(
|
|
21232
|
+
rt, thisVal, args, count);
|
|
21233
|
+
});
|
|
21154
21234
|
props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_"
|
|
21155
21235
|
"payment"] = jsi::Function::createFromHostFunction(
|
|
21156
21236
|
rt,
|
|
@@ -21287,6 +21367,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
|
|
|
21287
21367
|
->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener(
|
|
21288
21368
|
rt, thisVal, args, count);
|
|
21289
21369
|
});
|
|
21370
|
+
props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_batch"] =
|
|
21371
|
+
jsi::Function::createFromHostFunction(
|
|
21372
|
+
rt,
|
|
21373
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
|
|
21374
|
+
"method_breezsdk_send_batch"),
|
|
21375
|
+
0,
|
|
21376
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
21377
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
21378
|
+
return this
|
|
21379
|
+
->cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_batch(
|
|
21380
|
+
rt, thisVal, args, count);
|
|
21381
|
+
});
|
|
21290
21382
|
props["ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment"] =
|
|
21291
21383
|
jsi::Function::createFromHostFunction(
|
|
21292
21384
|
rt,
|
|
@@ -23702,6 +23794,19 @@ jsi::Value NativeBreezSdkSpark::
|
|
|
23702
23794
|
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
23703
23795
|
value);
|
|
23704
23796
|
}
|
|
23797
|
+
jsi::Value NativeBreezSdkSpark::
|
|
23798
|
+
cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_batch_package(
|
|
23799
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
23800
|
+
size_t count) {
|
|
23801
|
+
auto value =
|
|
23802
|
+
uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_batch_package(
|
|
23803
|
+
uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
|
|
23804
|
+
uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
23805
|
+
args[1]));
|
|
23806
|
+
|
|
23807
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
23808
|
+
value);
|
|
23809
|
+
}
|
|
23705
23810
|
jsi::Value NativeBreezSdkSpark::
|
|
23706
23811
|
cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_lnurl_pay_package(
|
|
23707
23812
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
@@ -24068,6 +24173,18 @@ jsi::Value NativeBreezSdkSpark::
|
|
|
24068
24173
|
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
24069
24174
|
value);
|
|
24070
24175
|
}
|
|
24176
|
+
jsi::Value NativeBreezSdkSpark::
|
|
24177
|
+
cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_batch(
|
|
24178
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
24179
|
+
size_t count) {
|
|
24180
|
+
auto value = uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_batch(
|
|
24181
|
+
uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
|
|
24182
|
+
uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
24183
|
+
args[1]));
|
|
24184
|
+
|
|
24185
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
24186
|
+
value);
|
|
24187
|
+
}
|
|
24071
24188
|
jsi::Value NativeBreezSdkSpark::
|
|
24072
24189
|
cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_payment(
|
|
24073
24190
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
@@ -24202,6 +24319,18 @@ jsi::Value NativeBreezSdkSpark::
|
|
|
24202
24319
|
value);
|
|
24203
24320
|
}
|
|
24204
24321
|
jsi::Value
|
|
24322
|
+
NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_send_batch(
|
|
24323
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
24324
|
+
size_t count) {
|
|
24325
|
+
auto value = uniffi_breez_sdk_spark_fn_method_breezsdk_send_batch(
|
|
24326
|
+
uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
|
|
24327
|
+
uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
24328
|
+
args[1]));
|
|
24329
|
+
|
|
24330
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
24331
|
+
value);
|
|
24332
|
+
}
|
|
24333
|
+
jsi::Value
|
|
24205
24334
|
NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_send_payment(
|
|
24206
24335
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
24207
24336
|
size_t count) {
|
|
@@ -25186,7 +25315,9 @@ jsi::Value NativeBreezSdkSpark::
|
|
|
25186
25315
|
auto value = uniffi_breez_sdk_spark_fn_method_prfprovider_create_passkey(
|
|
25187
25316
|
uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
|
|
25188
25317
|
uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
25189
|
-
args[1])
|
|
25318
|
+
args[1]),
|
|
25319
|
+
uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
25320
|
+
args[2]));
|
|
25190
25321
|
|
|
25191
25322
|
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
25192
25323
|
value);
|
|
@@ -27258,6 +27389,15 @@ jsi::Value NativeBreezSdkSpark::
|
|
|
27258
27389
|
|
|
27259
27390
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
27260
27391
|
}
|
|
27392
|
+
jsi::Value NativeBreezSdkSpark::
|
|
27393
|
+
cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_batch_package(
|
|
27394
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
27395
|
+
size_t count) {
|
|
27396
|
+
auto value =
|
|
27397
|
+
uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_batch_package();
|
|
27398
|
+
|
|
27399
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
27400
|
+
}
|
|
27261
27401
|
jsi::Value NativeBreezSdkSpark::
|
|
27262
27402
|
cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_lnurl_pay_package(
|
|
27263
27403
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
@@ -27523,6 +27663,15 @@ jsi::Value NativeBreezSdkSpark::
|
|
|
27523
27663
|
|
|
27524
27664
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
27525
27665
|
}
|
|
27666
|
+
jsi::Value NativeBreezSdkSpark::
|
|
27667
|
+
cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_batch(
|
|
27668
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
27669
|
+
size_t count) {
|
|
27670
|
+
auto value =
|
|
27671
|
+
uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_batch();
|
|
27672
|
+
|
|
27673
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
27674
|
+
}
|
|
27526
27675
|
jsi::Value NativeBreezSdkSpark::
|
|
27527
27676
|
cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_payment(
|
|
27528
27677
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
@@ -27621,6 +27770,14 @@ jsi::Value NativeBreezSdkSpark::
|
|
|
27621
27770
|
|
|
27622
27771
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
27623
27772
|
}
|
|
27773
|
+
jsi::Value NativeBreezSdkSpark::
|
|
27774
|
+
cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_batch(
|
|
27775
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
27776
|
+
size_t count) {
|
|
27777
|
+
auto value = uniffi_breez_sdk_spark_checksum_method_breezsdk_send_batch();
|
|
27778
|
+
|
|
27779
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
27780
|
+
}
|
|
27624
27781
|
jsi::Value NativeBreezSdkSpark::
|
|
27625
27782
|
cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment(
|
|
27626
27783
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
@@ -83,6 +83,10 @@ protected:
|
|
|
83
83
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
84
84
|
size_t count);
|
|
85
85
|
jsi::Value
|
|
86
|
+
cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_batch_package(
|
|
87
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
88
|
+
size_t count);
|
|
89
|
+
jsi::Value
|
|
86
90
|
cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_lnurl_pay_package(
|
|
87
91
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
88
92
|
size_t count);
|
|
@@ -184,6 +188,9 @@ protected:
|
|
|
184
188
|
jsi::Value cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_lnurl_pay(
|
|
185
189
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
186
190
|
size_t count);
|
|
191
|
+
jsi::Value cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_batch(
|
|
192
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
193
|
+
size_t count);
|
|
187
194
|
jsi::Value cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_payment(
|
|
188
195
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
189
196
|
size_t count);
|
|
@@ -223,6 +230,9 @@ protected:
|
|
|
223
230
|
cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_remove_event_listener(
|
|
224
231
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
225
232
|
size_t count);
|
|
233
|
+
jsi::Value cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_send_batch(
|
|
234
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
235
|
+
size_t count);
|
|
226
236
|
jsi::Value cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_send_payment(
|
|
227
237
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
228
238
|
size_t count);
|
|
@@ -1044,6 +1054,10 @@ protected:
|
|
|
1044
1054
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1045
1055
|
size_t count);
|
|
1046
1056
|
jsi::Value
|
|
1057
|
+
cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_batch_package(
|
|
1058
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1059
|
+
size_t count);
|
|
1060
|
+
jsi::Value
|
|
1047
1061
|
cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_lnurl_pay_package(
|
|
1048
1062
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1049
1063
|
size_t count);
|
|
@@ -1154,6 +1168,10 @@ protected:
|
|
|
1154
1168
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1155
1169
|
size_t count);
|
|
1156
1170
|
jsi::Value
|
|
1171
|
+
cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_batch(
|
|
1172
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1173
|
+
size_t count);
|
|
1174
|
+
jsi::Value
|
|
1157
1175
|
cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_payment(
|
|
1158
1176
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1159
1177
|
size_t count);
|
|
@@ -1196,6 +1214,9 @@ protected:
|
|
|
1196
1214
|
cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener(
|
|
1197
1215
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1198
1216
|
size_t count);
|
|
1217
|
+
jsi::Value cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_batch(
|
|
1218
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1219
|
+
size_t count);
|
|
1199
1220
|
jsi::Value cpp_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment(
|
|
1200
1221
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1201
1222
|
size_t count);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
|
|
3
|
+
@interface RCT_EXTERN_MODULE(BreezSdkSparkPasskey, NSObject)
|
|
4
|
+
|
|
5
|
+
RCT_EXTERN_METHOD(deriveSeeds:(NSArray *)salts
|
|
6
|
+
rpId:(NSString *)rpId
|
|
7
|
+
rpName:(NSString *)rpName
|
|
8
|
+
userName:(NSString *)userName
|
|
9
|
+
userDisplayName:(NSString *)userDisplayName
|
|
10
|
+
autoRegister:(BOOL)autoRegister
|
|
11
|
+
allowCredentials:(NSArray *)allowCredentials
|
|
12
|
+
preferImmediatelyAvailableCredentials:(nullable NSNumber *)preferImmediatelyAvailableCredentials
|
|
13
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
14
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
15
|
+
|
|
16
|
+
RCT_EXTERN_METHOD(createPasskey:(NSString *)rpId
|
|
17
|
+
rpName:(NSString *)rpName
|
|
18
|
+
userName:(NSString *)userName
|
|
19
|
+
userDisplayName:(NSString *)userDisplayName
|
|
20
|
+
excludeCredentials:(NSArray *)excludeCredentials
|
|
21
|
+
registerSalts:(NSArray *)registerSalts
|
|
22
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
23
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
24
|
+
|
|
25
|
+
RCT_EXTERN_METHOD(isSupported:(RCTPromiseResolveBlock)resolve
|
|
26
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
27
|
+
|
|
28
|
+
RCT_EXTERN_METHOD(checkDomainAssociation:(NSString *)rpId
|
|
29
|
+
teamId:(NSString *)teamId
|
|
30
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
31
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import AuthenticationServices
|
|
2
|
+
import Foundation
|
|
3
|
+
import React
|
|
4
|
+
|
|
5
|
+
/// React Native native module for passkey PRF operations on iOS.
|
|
6
|
+
///
|
|
7
|
+
/// Thin RCT_EXTERN_MODULE bridge over the shared `PasskeyAssertionCore`.
|
|
8
|
+
/// Behavioral parity with the upstream Swift `PasskeyProvider` and the
|
|
9
|
+
/// Flutter plugin is enforced by routing all ASAuthorizationController
|
|
10
|
+
/// orchestration through the same canonical core.
|
|
11
|
+
@available(iOS 18.0, *)
|
|
12
|
+
@objc(BreezSdkSparkPasskey)
|
|
13
|
+
class BreezSdkSparkPasskey: NSObject {
|
|
14
|
+
|
|
15
|
+
/// Shared across the per-call cores so the post-create PRF-readiness
|
|
16
|
+
/// grace armed by `createPasskey` survives to an immediately-following
|
|
17
|
+
/// `deriveSeeds` (sparing a second prompt). The RN module is a singleton
|
|
18
|
+
/// per bridge, so this persists across calls; mirrors the Android module.
|
|
19
|
+
private let graceTracker = PostCreateGraceTracker()
|
|
20
|
+
|
|
21
|
+
@objc
|
|
22
|
+
static func requiresMainQueueSetup() -> Bool {
|
|
23
|
+
return false
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/// Derive multiple PRF seeds in a single ceremony when supported.
|
|
27
|
+
///
|
|
28
|
+
/// Walks `salts` two-at-a-time using a dual-salt assertion. Falls back
|
|
29
|
+
/// to per-salt single-salt assertion if the authenticator drops the
|
|
30
|
+
/// second salt. The `salts.count == 1` case short-circuits to a
|
|
31
|
+
/// single-salt assertion under the hood (one prompt).
|
|
32
|
+
@objc
|
|
33
|
+
func deriveSeeds(
|
|
34
|
+
_ salts: [String],
|
|
35
|
+
rpId: String,
|
|
36
|
+
rpName: String,
|
|
37
|
+
userName: String,
|
|
38
|
+
userDisplayName: String,
|
|
39
|
+
autoRegister: Bool,
|
|
40
|
+
allowCredentials: [String],
|
|
41
|
+
preferImmediatelyAvailableCredentials: NSNumber?,
|
|
42
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
43
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
44
|
+
) {
|
|
45
|
+
// Encode salts as UTF-8 bytes; the OS uses these directly as
|
|
46
|
+
// PRF eval inputs (saltInput1, saltInput2).
|
|
47
|
+
let saltDatas: [Data] = salts.compactMap { $0.data(using: .utf8) }
|
|
48
|
+
guard saltDatas.count == salts.count else {
|
|
49
|
+
reject("ERR_PASSKEY", "Failed to encode salts as UTF-8", nil)
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let allowIds: [Data] = allowCredentials.compactMap { Data(base64Encoded: $0) }
|
|
54
|
+
let preferImmediate = preferImmediatelyAvailableCredentials?.boolValue
|
|
55
|
+
|
|
56
|
+
let core = PasskeyAssertionCore(
|
|
57
|
+
rpId: rpId, rpName: rpName, userName: userName, userDisplayName: userDisplayName,
|
|
58
|
+
graceTracker: graceTracker
|
|
59
|
+
)
|
|
60
|
+
Task { @MainActor in
|
|
61
|
+
do {
|
|
62
|
+
let derivation = try await core.deriveSeeds(
|
|
63
|
+
salts: saltDatas,
|
|
64
|
+
autoRegister: autoRegister,
|
|
65
|
+
allowCredentials: allowIds,
|
|
66
|
+
preferImmediatelyAvailableCredentials: preferImmediate ?? true
|
|
67
|
+
)
|
|
68
|
+
resolve([
|
|
69
|
+
"seeds": derivation.seeds.map { $0.base64EncodedString() },
|
|
70
|
+
"credentialId": derivation.credentialId.map { $0.base64EncodedString() } ?? NSNull(),
|
|
71
|
+
])
|
|
72
|
+
} catch let err as PasskeyAssertionError {
|
|
73
|
+
Self.reject(err, reject: reject, defaultMessage: "User cancelled authentication")
|
|
74
|
+
} catch {
|
|
75
|
+
reject("ERR_PASSKEY", error.localizedDescription, nil)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// Create a new passkey with PRF support.
|
|
81
|
+
///
|
|
82
|
+
/// Only registers the credential, no seed derivation. Triggers exactly
|
|
83
|
+
/// 1 platform prompt. Use for multi-step onboarding flows. Per-call
|
|
84
|
+
/// overrides on userId, userName, userDisplayName fall back to the
|
|
85
|
+
/// constructor values when null.
|
|
86
|
+
@objc
|
|
87
|
+
func createPasskey(
|
|
88
|
+
_ rpId: String,
|
|
89
|
+
rpName: String,
|
|
90
|
+
userName: String,
|
|
91
|
+
userDisplayName: String,
|
|
92
|
+
excludeCredentials: [String],
|
|
93
|
+
registerSalts: [String],
|
|
94
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
95
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
96
|
+
) {
|
|
97
|
+
let excludeIds: [Data] = excludeCredentials.compactMap { Data(base64Encoded: $0) }
|
|
98
|
+
|
|
99
|
+
let core = PasskeyAssertionCore(
|
|
100
|
+
rpId: rpId, rpName: rpName, userName: userName, userDisplayName: userDisplayName,
|
|
101
|
+
graceTracker: graceTracker
|
|
102
|
+
)
|
|
103
|
+
Task { @MainActor in
|
|
104
|
+
do {
|
|
105
|
+
let registration = try await core.register(
|
|
106
|
+
excludeCredentials: excludeIds,
|
|
107
|
+
salts: registerSalts
|
|
108
|
+
)
|
|
109
|
+
let registered = registration.credential
|
|
110
|
+
// Null unless the authenticator evaluated PRF during the
|
|
111
|
+
// create ceremony and returned one output per salt. The JS
|
|
112
|
+
// side then skips the assertion entirely.
|
|
113
|
+
resolve([
|
|
114
|
+
"credentialId": registered.credentialId.base64EncodedString(),
|
|
115
|
+
"userId": registered.userId?.base64EncodedString() as Any?,
|
|
116
|
+
"aaguid": registered.aaguid?.base64EncodedString() as Any?,
|
|
117
|
+
"backupEligible": registered.backupEligible as Any?,
|
|
118
|
+
"seeds": registration.seeds?.map { $0.base64EncodedString() } as Any?,
|
|
119
|
+
])
|
|
120
|
+
} catch let err as PasskeyAssertionError {
|
|
121
|
+
Self.reject(err, reject: reject, defaultMessage: "User cancelled registration")
|
|
122
|
+
} catch {
|
|
123
|
+
reject("ERR_PASSKEY", error.localizedDescription, nil)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/// Check if PRF-capable passkeys are available on this device.
|
|
129
|
+
@objc
|
|
130
|
+
func isSupported(
|
|
131
|
+
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
132
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
133
|
+
) {
|
|
134
|
+
if #available(iOS 18.0, *) {
|
|
135
|
+
resolve(true)
|
|
136
|
+
} else {
|
|
137
|
+
resolve(false)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/// Domain association check. Delegates to the canonical
|
|
142
|
+
/// `PasskeyAssertionCore` which probes Apple's AASA CDN
|
|
143
|
+
/// (`app-site-association.cdn-apple.com`) for the bundle ID's
|
|
144
|
+
/// `webcredentials` listing. Verification-level failures (no
|
|
145
|
+
/// team ID, network errors, malformed JSON) all map to `Skipped`
|
|
146
|
+
///: the SDK never blocks on this check, it's diagnostic.
|
|
147
|
+
@objc
|
|
148
|
+
func checkDomainAssociation(
|
|
149
|
+
_ rpId: String,
|
|
150
|
+
teamId: String?,
|
|
151
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
152
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
153
|
+
) {
|
|
154
|
+
// Branding fields are unused by the domain check; pass rpId as
|
|
155
|
+
// a placeholder since this is a check-only core.
|
|
156
|
+
let core = PasskeyAssertionCore(
|
|
157
|
+
rpId: rpId, rpName: rpId, userName: rpId, userDisplayName: rpId,
|
|
158
|
+
explicitTeamId: teamId
|
|
159
|
+
)
|
|
160
|
+
Task { @MainActor in
|
|
161
|
+
let outcome = await core.checkDomainAssociation()
|
|
162
|
+
switch outcome {
|
|
163
|
+
case .associated:
|
|
164
|
+
resolve(["kind": "Associated"])
|
|
165
|
+
case .notAssociated(let source, let reason):
|
|
166
|
+
resolve(["kind": "NotAssociated", "source": source, "reason": reason])
|
|
167
|
+
case .skipped(let reason):
|
|
168
|
+
resolve(["kind": "Skipped", "reason": reason])
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// MARK: - Error mapping
|
|
174
|
+
|
|
175
|
+
private static func reject(
|
|
176
|
+
_ err: PasskeyAssertionError,
|
|
177
|
+
reject: @escaping RCTPromiseRejectBlock,
|
|
178
|
+
defaultMessage: String
|
|
179
|
+
) {
|
|
180
|
+
switch err {
|
|
181
|
+
case .userCancelled:
|
|
182
|
+
reject("ERR_USER_CANCELLED", defaultMessage, nil)
|
|
183
|
+
case .userTimedOut:
|
|
184
|
+
reject("ERR_USER_TIMED_OUT", "Authenticator timed out", nil)
|
|
185
|
+
case .credentialNotFound(let msg):
|
|
186
|
+
reject("ERR_NO_CREDENTIAL", msg, nil)
|
|
187
|
+
case .credentialAlreadyExists(let msg):
|
|
188
|
+
reject("ERR_CREDENTIAL_ALREADY_EXISTS", msg, nil)
|
|
189
|
+
case .prfNotSupported:
|
|
190
|
+
reject("ERR_PRF_NOT_SUPPORTED", "PRF not supported by authenticator", nil)
|
|
191
|
+
case .prfEvaluationFailed(let msg):
|
|
192
|
+
reject("ERR_PRF_NOT_SUPPORTED", msg, nil)
|
|
193
|
+
case .configuration(let msg):
|
|
194
|
+
reject("ERR_CONFIGURATION", msg, nil)
|
|
195
|
+
case .authenticationFailed(let msg):
|
|
196
|
+
reject("ERR_PASSKEY", msg, nil)
|
|
197
|
+
case .generic(let msg):
|
|
198
|
+
reject("ERR_PASSKEY", msg, nil)
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|