diff --git a/bun.lockb b/bun.lockb index d313f928..a0ecf217 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 60453e1c..f3209cf7 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -7,7 +7,7 @@ PODS: - hermes-engine (0.74.5): - hermes-engine/Pre-built (= 0.74.5) - hermes-engine/Pre-built (0.74.5) - - NitroModules (0.9.2): + - NitroModules (0.14.0): - DoubleConversion - glog - hermes-engine @@ -1564,16 +1564,16 @@ SPEC CHECKSUMS: fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120 glog: fdfdfe5479092de0c4bdbebedd9056951f092c4f hermes-engine: 8c1577f3fdb849cbe7729c2e7b5abc4b845e88f8 - NitroModules: 38b7870be128f26cb82a2ef256fa8eea04933fa2 + NitroModules: a5daf9eaf57c450d4f464bfe8ec30fe550b0fa68 OpenSSL-Universal: f8a9c4fdab7e21cb70bda471c269e86e9212439c - QuickCrypto: 551d63cf0fdd977e6b8e0e78e853ab47e80de518 + QuickCrypto: b7afd2e6f9bd3ea7257896860579c85a9c6984ea RCT-Folly: 02617c592a293bd6d418e0a88ff4ee1f88329b47 RCTDeprecation: 3afceddffa65aee666dafd6f0116f1d975db1584 RCTRequired: ec1239bc9d8bf63e10fb92bd8b26171a9258e0c1 RCTTypeSafety: f5ecbc86c5c5fa163c05acb7a1c5012e15b5f994 React: fc9fa7258eff606f44d58c5b233a82dc9cf09018 React-callinvoker: e3fab14d69607fb7e8e3a57e5a415aed863d3599 - React-Codegen: 49efb5917c904b5b01ef708311a2f1773f4fe73e + React-Codegen: 6fa87b7c6b8efcd0cef4bfeaec8c8bc8a6abe75a React-Core: 3a5fd9e781cecf87803e5b091496a606a3df774a React-CoreModules: cbf4707dafab8f9f826ac0c63a07d0bf5d01e256 React-cxxreact: 7b188556271e3c7fdf22a04819f6a6225045b9dd @@ -1621,6 +1621,6 @@ SPEC CHECKSUMS: SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d Yoga: 950bbfd7e6f04790fdb51149ed51df41f329fcc8 -PODFILE CHECKSUM: 684599d0e4b0f60fab3a5ad6c896bb5e77f7b4f2 +PODFILE CHECKSUM: 35be88c88b1bb1be062e9004965b962528d32ae6 COCOAPODS: 1.14.3 diff --git a/example/package.json b/example/package.json index b04d2f57..e42e0456 100644 --- a/example/package.json +++ b/example/package.json @@ -31,9 +31,9 @@ "react": "^18.3.1", "react-native": "^0.74.5", "react-native-bouncy-checkbox": "4.0.1", - "react-native-nitro-modules": "0.9.2", + "react-native-nitro-modules": "0.14.0", "react-native-quick-base64": "2.1.2", - "react-native-quick-crypto": "*", + "react-native-quick-crypto": "workspace:*", "react-native-safe-area-context": "4.10.8", "react-native-screens": "3.32.0", "react-native-vector-icons": "^10.1.0", diff --git a/packages/react-native-quick-crypto/nitro.json b/packages/react-native-quick-crypto/nitro.json index ec04fb46..cd22074c 100644 --- a/packages/react-native-quick-crypto/nitro.json +++ b/packages/react-native-quick-crypto/nitro.json @@ -1,7 +1,7 @@ { "cxxNamespace": ["crypto"], "ios": { - "iosModulename": "QuickCrypto" + "iosModuleName": "QuickCrypto" }, "android": { "androidNamespace": ["crypto"], diff --git a/packages/react-native-quick-crypto/nitrogen/generated/android/QuickCrypto+autolinking.cmake b/packages/react-native-quick-crypto/nitrogen/generated/android/QuickCrypto+autolinking.cmake index ba45c08f..05eb7021 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/android/QuickCrypto+autolinking.cmake +++ b/packages/react-native-quick-crypto/nitrogen/generated/android/QuickCrypto+autolinking.cmake @@ -44,6 +44,18 @@ target_link_libraries( QuickCrypto fbjni::fbjni # <-- Facebook C++ JNI helpers ReactAndroid::jsi # <-- RN: JSI - ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core react-native-nitro-modules::NitroModules # <-- NitroModules Core :) ) + +# Link react-native (different prefab between RN 0.75 and RN 0.76) +if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) + target_link_libraries( + QuickCrypto + ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab + ) +else() + target_link_libraries( + QuickCrypto + ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core + ) +endif() diff --git a/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto+autolinking.rb b/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto+autolinking.rb index a792bc67..6a5aed32 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto+autolinking.rb +++ b/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto+autolinking.rb @@ -24,7 +24,7 @@ def add_nitrogen_files(spec) spec.dependency "NitroModules" - current_source_files = spec.attributes_hash['source_files'] || [] + current_source_files = Array(spec.attributes_hash['source_files']) spec.source_files = current_source_files + [ # Generated cross-platform specs "nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}", @@ -32,7 +32,7 @@ def add_nitrogen_files(spec) "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}", ] - current_public_header_files = spec.attributes_hash['public_header_files'] || [] + current_public_header_files = Array(spec.attributes_hash['public_header_files']) spec.public_header_files = current_public_header_files + [ # Generated specs "nitrogen/generated/shared/**/*.{h,hpp}", @@ -40,7 +40,7 @@ def add_nitrogen_files(spec) "nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.hpp" ] - current_private_header_files = spec.attributes_hash['private_header_files'] || [] + current_private_header_files = Array(spec.attributes_hash['private_header_files']) spec.private_header_files = current_private_header_files + [ # iOS specific specs "nitrogen/generated/ios/c++/**/*.{h,hpp}", @@ -52,5 +52,7 @@ def add_nitrogen_files(spec) "CLANG_CXX_LANGUAGE_STANDARD" => "c++20", # Enables C++ <-> Swift interop (by default it's only C) "SWIFT_OBJC_INTEROP_MODE" => "objcxx", + # Enables stricter modular headers + "DEFINES_MODULE" => "YES", }) end diff --git a/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.cpp b/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.cpp index ca409639..78e11c93 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.cpp +++ b/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.cpp @@ -6,3 +6,12 @@ /// #include "QuickCrypto-Swift-Cxx-Bridge.hpp" + +// Include C++ implementation defined types + + +namespace margelo::nitro::crypto::bridge::swift { + + + +} // namespace margelo::nitro::crypto::bridge::swift diff --git a/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.hpp b/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.hpp index deeca6a7..b6913fd4 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.hpp +++ b/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.hpp @@ -8,71 +8,13 @@ #pragma once // Forward declarations of C++ defined types -// Forward declaration of `ArrayBufferHolder` to properly resolve imports. -namespace NitroModules { class ArrayBufferHolder; } -// Forward declaration of `ArrayBuffer` to properly resolve imports. -namespace NitroModules { class ArrayBuffer; } -// Forward declaration of `JWKkty` to properly resolve imports. -namespace margelo::nitro::crypto { enum class JWKkty; } -// Forward declaration of `JWKuse` to properly resolve imports. -namespace margelo::nitro::crypto { enum class JWKuse; } -// Forward declaration of `KFormatType` to properly resolve imports. -namespace margelo::nitro::crypto { enum class KFormatType; } -// Forward declaration of `KeyEncoding` to properly resolve imports. -namespace margelo::nitro::crypto { enum class KeyEncoding; } -// Forward declaration of `KeyType` to properly resolve imports. -namespace margelo::nitro::crypto { enum class KeyType; } -// Forward declaration of `KeyUsage` to properly resolve imports. -namespace margelo::nitro::crypto { enum class KeyUsage; } -// Forward declaration of `NamedCurve` to properly resolve imports. -namespace margelo::nitro::crypto { enum class NamedCurve; } + + +// Forward declarations of Swift defined types + // Include C++ defined types -#if __has_include("JWKkty.hpp") - #include "JWKkty.hpp" -#endif -#if __has_include("JWKuse.hpp") - #include "JWKuse.hpp" -#endif -#if __has_include("KFormatType.hpp") - #include "KFormatType.hpp" -#endif -#if __has_include("KeyEncoding.hpp") - #include "KeyEncoding.hpp" -#endif -#if __has_include("KeyType.hpp") - #include "KeyType.hpp" -#endif -#if __has_include("KeyUsage.hpp") - #include "KeyUsage.hpp" -#endif -#if __has_include("NamedCurve.hpp") - #include "NamedCurve.hpp" -#endif -#if __has_include() - #include -#endif -#if __has_include() - #include -#endif -#if __has_include() - #include -#endif -#if __has_include() - #include -#endif -#if __has_include() - #include -#endif -#if __has_include() - #include -#endif -#if __has_include() - #include -#endif -#if __has_include() - #include -#endif + /** * Contains specialized versions of C++ templated types so they can be accessed from Swift, @@ -80,145 +22,6 @@ namespace margelo::nitro::crypto { enum class NamedCurve; } */ namespace margelo::nitro::crypto::bridge::swift { - /** - * Specialized version of `std::optional`. - */ - using std__optional_KFormatType_ = std::optional; - inline std::optional create_std__optional_KFormatType_(const KFormatType& value) { - return std::optional(value); - } - - /** - * Specialized version of `std::optional`. - */ - using std__optional_KeyEncoding_ = std::optional; - inline std::optional create_std__optional_KeyEncoding_(const KeyEncoding& value) { - return std::optional(value); - } - - /** - * Specialized version of `std::optional`. - */ - using std__optional_std__string_ = std::optional; - inline std::optional create_std__optional_std__string_(const std::string& value) { - return std::optional(value); - } - - /** - * Specialized version of `std::optional>`. - */ - using std__optional_std__shared_ptr_ArrayBuffer__ = std::optional>; - inline std::optional> create_std__optional_std__shared_ptr_ArrayBuffer__(const std::shared_ptr& value) { - return std::optional>(value); - } - - /** - * Specialized version of `std::optional`. - */ - using std__optional_JWKkty_ = std::optional; - inline std::optional create_std__optional_JWKkty_(const JWKkty& value) { - return std::optional(value); - } - - /** - * Specialized version of `std::optional`. - */ - using std__optional_JWKuse_ = std::optional; - inline std::optional create_std__optional_JWKuse_(const JWKuse& value) { - return std::optional(value); - } - - /** - * Specialized version of `std::vector`. - */ - using std__vector_KeyUsage_ = std::vector; - inline std::vector create_std__vector_KeyUsage_(size_t size) { - std::vector vector; - vector.reserve(size); - return vector; - } - - /** - * Specialized version of `std::optional>`. - */ - using std__optional_std__vector_KeyUsage__ = std::optional>; - inline std::optional> create_std__optional_std__vector_KeyUsage__(const std::vector& value) { - return std::optional>(value); - } - - /** - * Specialized version of `std::vector`. - */ - using std__vector_std__string_ = std::vector; - inline std::vector create_std__vector_std__string_(size_t size) { - std::vector vector; - vector.reserve(size); - return vector; - } - - /** - * Specialized version of `std::optional>`. - */ - using std__optional_std__vector_std__string__ = std::optional>; - inline std::optional> create_std__optional_std__vector_std__string__(const std::vector& value) { - return std::optional>(value); - } - - /** - * Specialized version of `std::optional`. - */ - using std__optional_bool_ = std::optional; - inline std::optional create_std__optional_bool_(const bool& value) { - return std::optional(value); - } - - /** - * Specialized version of `std::variant>`. - */ - using std__variant_std__string__std__shared_ptr_ArrayBuffer__ = std::variant>; - inline std::variant> create_std__variant_std__string__std__shared_ptr_ArrayBuffer__(const std::string& value) { - return value; - } - inline std::variant> create_std__variant_std__string__std__shared_ptr_ArrayBuffer__(const std::shared_ptr& value) { - return value; - } - inline std::string get_std__variant_std__string__std__shared_ptr_ArrayBuffer___0(const std::variant>& variant) { - return std::get<0>(variant); - } - inline std::shared_ptr get_std__variant_std__string__std__shared_ptr_ArrayBuffer___1(const std::variant>& variant) { - return std::get<1>(variant); - } - - /** - * Specialized version of `std::optional`. - */ - using std__optional_KeyType_ = std::optional; - inline std::optional create_std__optional_KeyType_(const KeyType& value) { - return std::optional(value); - } - - /** - * Specialized version of `std::optional`. - */ - using std__optional_NamedCurve_ = std::optional; - inline std::optional create_std__optional_NamedCurve_(const NamedCurve& value) { - return std::optional(value); - } - - /** - * Specialized version of `std::optional`. - */ - using std__optional_double_ = std::optional; - inline std::optional create_std__optional_double_(const double& value) { - return std::optional(value); - } - /** - * Specialized version of `PromiseHolder>`. - */ - using PromiseHolder_std__shared_ptr_ArrayBuffer__ = PromiseHolder>; - inline PromiseHolder> create_PromiseHolder_std__shared_ptr_ArrayBuffer__() { - return PromiseHolder>(); - } } // namespace margelo::nitro::crypto::bridge::swift diff --git a/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Umbrella.hpp b/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Umbrella.hpp index de67f445..ed64ea77 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Umbrella.hpp +++ b/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Umbrella.hpp @@ -8,56 +8,10 @@ #pragma once // Forward declarations of C++ defined types -// Forward declaration of `ArrayBuffer` to properly resolve imports. -namespace NitroModules { class ArrayBuffer; } -// Forward declaration of `AsymmetricKeyType` to properly resolve imports. -namespace margelo::nitro::crypto { enum class AsymmetricKeyType; } -// Forward declaration of `HybridKeyObjectHandleSpec` to properly resolve imports. -namespace margelo::nitro::crypto { class HybridKeyObjectHandleSpec; } -// Forward declaration of `HybridPbkdf2Spec` to properly resolve imports. -namespace margelo::nitro::crypto { class HybridPbkdf2Spec; } -// Forward declaration of `HybridRandomSpec` to properly resolve imports. -namespace margelo::nitro::crypto { class HybridRandomSpec; } -// Forward declaration of `JWK` to properly resolve imports. -namespace margelo::nitro::crypto { struct JWK; } -// Forward declaration of `JWKkty` to properly resolve imports. -namespace margelo::nitro::crypto { enum class JWKkty; } -// Forward declaration of `JWKuse` to properly resolve imports. -namespace margelo::nitro::crypto { enum class JWKuse; } -// Forward declaration of `KFormatType` to properly resolve imports. -namespace margelo::nitro::crypto { enum class KFormatType; } -// Forward declaration of `KeyDetail` to properly resolve imports. -namespace margelo::nitro::crypto { struct KeyDetail; } -// Forward declaration of `KeyEncoding` to properly resolve imports. -namespace margelo::nitro::crypto { enum class KeyEncoding; } -// Forward declaration of `KeyType` to properly resolve imports. -namespace margelo::nitro::crypto { enum class KeyType; } -// Forward declaration of `KeyUsage` to properly resolve imports. -namespace margelo::nitro::crypto { enum class KeyUsage; } -// Forward declaration of `NamedCurve` to properly resolve imports. -namespace margelo::nitro::crypto { enum class NamedCurve; } + // Include C++ defined types -#include "AsymmetricKeyType.hpp" -#include "HybridKeyObjectHandleSpec.hpp" -#include "HybridPbkdf2Spec.hpp" -#include "HybridRandomSpec.hpp" -#include "JWK.hpp" -#include "JWKkty.hpp" -#include "JWKuse.hpp" -#include "KFormatType.hpp" -#include "KeyDetail.hpp" -#include "KeyEncoding.hpp" -#include "KeyType.hpp" -#include "KeyUsage.hpp" -#include "NamedCurve.hpp" -#include -#include -#include -#include -#include -#include -#include + // C++ helpers for Swift #include "QuickCrypto-Swift-Cxx-Bridge.hpp" @@ -69,12 +23,7 @@ namespace margelo::nitro::crypto { enum class NamedCurve; } #include // Forward declarations of Swift defined types -// Forward declaration of `HybridKeyObjectHandleSpecCxx` to properly resolve imports. -namespace QuickCrypto { class HybridKeyObjectHandleSpecCxx; } -// Forward declaration of `HybridPbkdf2SpecCxx` to properly resolve imports. -namespace QuickCrypto { class HybridPbkdf2SpecCxx; } -// Forward declaration of `HybridRandomSpecCxx` to properly resolve imports. -namespace QuickCrypto { class HybridRandomSpecCxx; } + // Include Swift defined types #if __has_include("QuickCrypto-Swift.h") diff --git a/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCryptoAutolinking.swift b/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCryptoAutolinking.swift index d35b608e..815c71fa 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCryptoAutolinking.swift +++ b/packages/react-native-quick-crypto/nitrogen/generated/ios/QuickCryptoAutolinking.swift @@ -6,5 +6,7 @@ /// public final class QuickCryptoAutolinking { + public typealias bridge = margelo.nitro.crypto.bridge.swift + } diff --git a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/AsymmetricKeyType.hpp b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/AsymmetricKeyType.hpp index 5505eec5..46480829 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/AsymmetricKeyType.hpp +++ b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/AsymmetricKeyType.hpp @@ -52,7 +52,7 @@ namespace margelo::nitro { case hashString("dsa"): return AsymmetricKeyType::DSA; case hashString("ec"): return AsymmetricKeyType::EC; default: [[unlikely]] - throw std::runtime_error("Cannot convert \"" + unionValue + "\" to enum AsymmetricKeyType - invalid value!"); + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum AsymmetricKeyType - invalid value!"); } } static inline jsi::Value toJSI(jsi::Runtime& runtime, AsymmetricKeyType arg) { @@ -62,7 +62,7 @@ namespace margelo::nitro { case AsymmetricKeyType::DSA: return JSIConverter::toJSI(runtime, "dsa"); case AsymmetricKeyType::EC: return JSIConverter::toJSI(runtime, "ec"); default: [[unlikely]] - throw std::runtime_error("Cannot convert AsymmetricKeyType to JS - invalid value: " + throw std::invalid_argument("Cannot convert AsymmetricKeyType to JS - invalid value: " + std::to_string(static_cast(arg)) + "!"); } } diff --git a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.hpp b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.hpp index fbe81160..21ca53f4 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.hpp +++ b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.hpp @@ -49,9 +49,12 @@ namespace margelo::nitro::crypto { /** * An abstract base class for `KeyObjectHandle` * Inherit this class to create instances of `HybridKeyObjectHandleSpec` in C++. + * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. * @example * ```cpp * class HybridKeyObjectHandle: public HybridKeyObjectHandleSpec { + * public: + * HybridKeyObjectHandle(...): HybridObject(TAG) { ... } * // ... * }; * ``` diff --git a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridPbkdf2Spec.hpp b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridPbkdf2Spec.hpp index 185d28bc..96c1113b 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridPbkdf2Spec.hpp +++ b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridPbkdf2Spec.hpp @@ -27,9 +27,12 @@ namespace margelo::nitro::crypto { /** * An abstract base class for `Pbkdf2` * Inherit this class to create instances of `HybridPbkdf2Spec` in C++. + * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. * @example * ```cpp * class HybridPbkdf2: public HybridPbkdf2Spec { + * public: + * HybridPbkdf2(...): HybridObject(TAG) { ... } * // ... * }; * ``` diff --git a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridRandomSpec.hpp b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridRandomSpec.hpp index 9fb1e423..a23618ec 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridRandomSpec.hpp +++ b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridRandomSpec.hpp @@ -26,9 +26,12 @@ namespace margelo::nitro::crypto { /** * An abstract base class for `Random` * Inherit this class to create instances of `HybridRandomSpec` in C++. + * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. * @example * ```cpp * class HybridRandom: public HybridRandomSpec { + * public: + * HybridRandom(...): HybridObject(TAG) { ... } * // ... * }; * ``` diff --git a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/JWKkty.hpp b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/JWKkty.hpp index 06ec5b3b..4e0170f8 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/JWKkty.hpp +++ b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/JWKkty.hpp @@ -52,7 +52,7 @@ namespace margelo::nitro { case hashString("EC"): return JWKkty::EC; case hashString("oct"): return JWKkty::OCT; default: [[unlikely]] - throw std::runtime_error("Cannot convert \"" + unionValue + "\" to enum JWKkty - invalid value!"); + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum JWKkty - invalid value!"); } } static inline jsi::Value toJSI(jsi::Runtime& runtime, JWKkty arg) { @@ -62,7 +62,7 @@ namespace margelo::nitro { case JWKkty::EC: return JSIConverter::toJSI(runtime, "EC"); case JWKkty::OCT: return JSIConverter::toJSI(runtime, "oct"); default: [[unlikely]] - throw std::runtime_error("Cannot convert JWKkty to JS - invalid value: " + throw std::invalid_argument("Cannot convert JWKkty to JS - invalid value: " + std::to_string(static_cast(arg)) + "!"); } } diff --git a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/JWKuse.hpp b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/JWKuse.hpp index 33538015..8d62b78a 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/JWKuse.hpp +++ b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/JWKuse.hpp @@ -48,7 +48,7 @@ namespace margelo::nitro { case hashString("sig"): return JWKuse::SIG; case hashString("enc"): return JWKuse::ENC; default: [[unlikely]] - throw std::runtime_error("Cannot convert \"" + unionValue + "\" to enum JWKuse - invalid value!"); + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum JWKuse - invalid value!"); } } static inline jsi::Value toJSI(jsi::Runtime& runtime, JWKuse arg) { @@ -56,7 +56,7 @@ namespace margelo::nitro { case JWKuse::SIG: return JSIConverter::toJSI(runtime, "sig"); case JWKuse::ENC: return JSIConverter::toJSI(runtime, "enc"); default: [[unlikely]] - throw std::runtime_error("Cannot convert JWKuse to JS - invalid value: " + throw std::invalid_argument("Cannot convert JWKuse to JS - invalid value: " + std::to_string(static_cast(arg)) + "!"); } } diff --git a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/KeyUsage.hpp b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/KeyUsage.hpp index eba3e7e2..4378ab81 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/KeyUsage.hpp +++ b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/KeyUsage.hpp @@ -60,7 +60,7 @@ namespace margelo::nitro { case hashString("wrapKey"): return KeyUsage::WRAPKEY; case hashString("unwrapKey"): return KeyUsage::UNWRAPKEY; default: [[unlikely]] - throw std::runtime_error("Cannot convert \"" + unionValue + "\" to enum KeyUsage - invalid value!"); + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum KeyUsage - invalid value!"); } } static inline jsi::Value toJSI(jsi::Runtime& runtime, KeyUsage arg) { @@ -74,7 +74,7 @@ namespace margelo::nitro { case KeyUsage::WRAPKEY: return JSIConverter::toJSI(runtime, "wrapKey"); case KeyUsage::UNWRAPKEY: return JSIConverter::toJSI(runtime, "unwrapKey"); default: [[unlikely]] - throw std::runtime_error("Cannot convert KeyUsage to JS - invalid value: " + throw std::invalid_argument("Cannot convert KeyUsage to JS - invalid value: " + std::to_string(static_cast(arg)) + "!"); } } diff --git a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/NamedCurve.hpp b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/NamedCurve.hpp index 2d04adae..18a8e6c9 100644 --- a/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/NamedCurve.hpp +++ b/packages/react-native-quick-crypto/nitrogen/generated/shared/c++/NamedCurve.hpp @@ -50,7 +50,7 @@ namespace margelo::nitro { case hashString("P-384"): return NamedCurve::P_384; case hashString("P-521"): return NamedCurve::P_521; default: [[unlikely]] - throw std::runtime_error("Cannot convert \"" + unionValue + "\" to enum NamedCurve - invalid value!"); + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NamedCurve - invalid value!"); } } static inline jsi::Value toJSI(jsi::Runtime& runtime, NamedCurve arg) { @@ -59,7 +59,7 @@ namespace margelo::nitro { case NamedCurve::P_384: return JSIConverter::toJSI(runtime, "P-384"); case NamedCurve::P_521: return JSIConverter::toJSI(runtime, "P-521"); default: [[unlikely]] - throw std::runtime_error("Cannot convert NamedCurve to JS - invalid value: " + throw std::invalid_argument("Cannot convert NamedCurve to JS - invalid value: " + std::to_string(static_cast(arg)) + "!"); } } diff --git a/packages/react-native-quick-crypto/package.json b/packages/react-native-quick-crypto/package.json index 8c9e51d8..b389699b 100644 --- a/packages/react-native-quick-crypto/package.json +++ b/packages/react-native-quick-crypto/package.json @@ -38,8 +38,7 @@ "prepare": "bun clean && bob build", "release-it": "bun prepare && release-it", "specs": "nitro-codegen", - "test": "jest", - "postinstall": "tsc || exit 0;" + "test": "jest" }, "keywords": [ "react-native", @@ -70,7 +69,7 @@ "dependencies": { "@craftzdog/react-native-buffer": "6.0.5", "events": "3.3.0", - "react-native-nitro-modules": "0.9.2", + "react-native-nitro-modules": "0.14.0", "react-native-quick-base64": "2.1.2", "readable-stream": "4.5.2", "string_decoder": "1.3.0", @@ -88,10 +87,10 @@ "eslint": "9.9.0", "eslint-plugin-react-native": "^4.1.0", "jest": "29.7.0", - "nitro-codegen": "0.9.2", + "nitro-codegen": "0.14.0", "prettier": "3.3.3", "react": "18.3.1", - "react-native": "0.74.5", + "react-native": "0.76.1", "react-native-builder-bob": "0.30.0", "release-it": "17.6.0", "typescript": "5.1.6", diff --git a/packages/react-native-quick-crypto/tsconfig.json b/packages/react-native-quick-crypto/tsconfig.json index 45a45aa1..875ec696 100644 --- a/packages/react-native-quick-crypto/tsconfig.json +++ b/packages/react-native-quick-crypto/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "composite": true, - "outDir": "lib", "rootDir": "src", "allowUnreachableCode": false, "allowUnusedLabels": false,