react-native-quick-crypto 1.0.0-beta.21 → 1.0.0-beta.22

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 (52) hide show
  1. package/QuickCrypto.podspec +11 -1
  2. package/android/CMakeLists.txt +2 -0
  3. package/cpp/cipher/GCMCipher.cpp +68 -0
  4. package/cpp/cipher/GCMCipher.hpp +14 -0
  5. package/cpp/cipher/HybridCipherFactory.hpp +8 -0
  6. package/cpp/cipher/HybridRsaCipher.cpp +229 -0
  7. package/cpp/cipher/HybridRsaCipher.hpp +23 -0
  8. package/cpp/keys/HybridKeyObjectHandle.cpp +508 -9
  9. package/cpp/keys/HybridKeyObjectHandle.hpp +10 -1
  10. package/cpp/utils/base64.h +309 -0
  11. package/lib/commonjs/ec.js +85 -17
  12. package/lib/commonjs/ec.js.map +1 -1
  13. package/lib/commonjs/specs/rsaCipher.nitro.js +6 -0
  14. package/lib/commonjs/specs/rsaCipher.nitro.js.map +1 -0
  15. package/lib/commonjs/subtle.js +420 -17
  16. package/lib/commonjs/subtle.js.map +1 -1
  17. package/lib/commonjs/utils/conversion.js +1 -1
  18. package/lib/commonjs/utils/conversion.js.map +1 -1
  19. package/lib/module/ec.js +86 -18
  20. package/lib/module/ec.js.map +1 -1
  21. package/lib/module/specs/rsaCipher.nitro.js +4 -0
  22. package/lib/module/specs/rsaCipher.nitro.js.map +1 -0
  23. package/lib/module/subtle.js +421 -18
  24. package/lib/module/subtle.js.map +1 -1
  25. package/lib/module/utils/conversion.js +1 -1
  26. package/lib/module/utils/conversion.js.map +1 -1
  27. package/lib/tsconfig.tsbuildinfo +1 -1
  28. package/lib/typescript/ec.d.ts.map +1 -1
  29. package/lib/typescript/specs/keyObjectHandle.nitro.d.ts +1 -0
  30. package/lib/typescript/specs/keyObjectHandle.nitro.d.ts.map +1 -1
  31. package/lib/typescript/specs/rsaCipher.nitro.d.ts +26 -0
  32. package/lib/typescript/specs/rsaCipher.nitro.d.ts.map +1 -0
  33. package/lib/typescript/subtle.d.ts.map +1 -1
  34. package/lib/typescript/utils/conversion.d.ts.map +1 -1
  35. package/lib/typescript/utils/types.d.ts +1 -1
  36. package/lib/typescript/utils/types.d.ts.map +1 -1
  37. package/nitrogen/generated/android/QuickCrypto+autolinking.cmake +1 -0
  38. package/nitrogen/generated/android/QuickCryptoOnLoad.cpp +10 -0
  39. package/nitrogen/generated/ios/QuickCryptoAutolinking.mm +10 -0
  40. package/nitrogen/generated/shared/c++/AsymmetricKeyType.hpp +104 -0
  41. package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.cpp +1 -0
  42. package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.hpp +5 -4
  43. package/nitrogen/generated/shared/c++/HybridRsaCipherSpec.cpp +22 -0
  44. package/nitrogen/generated/shared/c++/HybridRsaCipherSpec.hpp +70 -0
  45. package/package.json +1 -1
  46. package/src/ec.ts +122 -20
  47. package/src/specs/keyObjectHandle.nitro.ts +1 -0
  48. package/src/specs/rsaCipher.nitro.ts +35 -0
  49. package/src/subtle.ts +550 -45
  50. package/src/utils/conversion.ts +3 -1
  51. package/src/utils/types.ts +6 -6
  52. package/nitrogen/generated/shared/c++/CFRGKeyPairType.hpp +0 -84
@@ -225,12 +225,12 @@ export type KeyPairGenConfig = {
225
225
  };
226
226
 
227
227
  export type AsymmetricKeyType =
228
- // 'rsa' |
229
- // 'rsa-pss' |
230
- // 'dsa' |
231
- // 'ec' |
232
- // 'dh' |
233
- CFRGKeyPairType;
228
+ | 'rsa'
229
+ | 'rsa-pss'
230
+ | 'dsa'
231
+ | 'ec'
232
+ | 'dh'
233
+ | CFRGKeyPairType;
234
234
 
235
235
  type JWKkty = 'AES' | 'RSA' | 'EC' | 'oct';
236
236
  type JWKuse = 'sig' | 'enc';
@@ -1,84 +0,0 @@
1
- ///
2
- /// CFRGKeyPairType.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #pragma once
9
-
10
- #if __has_include(<NitroModules/NitroHash.hpp>)
11
- #include <NitroModules/NitroHash.hpp>
12
- #else
13
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
- #endif
15
- #if __has_include(<NitroModules/JSIConverter.hpp>)
16
- #include <NitroModules/JSIConverter.hpp>
17
- #else
18
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
- #endif
20
- #if __has_include(<NitroModules/NitroDefines.hpp>)
21
- #include <NitroModules/NitroDefines.hpp>
22
- #else
23
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
- #endif
25
-
26
- namespace margelo::nitro::crypto {
27
-
28
- /**
29
- * An enum which can be represented as a JavaScript union (CFRGKeyPairType).
30
- */
31
- enum class CFRGKeyPairType {
32
- ED25519 SWIFT_NAME(ed25519) = 0,
33
- ED448 SWIFT_NAME(ed448) = 1,
34
- X25519 SWIFT_NAME(x25519) = 2,
35
- X448 SWIFT_NAME(x448) = 3,
36
- } CLOSED_ENUM;
37
-
38
- } // namespace margelo::nitro::crypto
39
-
40
- namespace margelo::nitro {
41
-
42
- // C++ CFRGKeyPairType <> JS CFRGKeyPairType (union)
43
- template <>
44
- struct JSIConverter<margelo::nitro::crypto::CFRGKeyPairType> final {
45
- static inline margelo::nitro::crypto::CFRGKeyPairType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
46
- std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
47
- switch (hashString(unionValue.c_str(), unionValue.size())) {
48
- case hashString("ed25519"): return margelo::nitro::crypto::CFRGKeyPairType::ED25519;
49
- case hashString("ed448"): return margelo::nitro::crypto::CFRGKeyPairType::ED448;
50
- case hashString("x25519"): return margelo::nitro::crypto::CFRGKeyPairType::X25519;
51
- case hashString("x448"): return margelo::nitro::crypto::CFRGKeyPairType::X448;
52
- default: [[unlikely]]
53
- throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum CFRGKeyPairType - invalid value!");
54
- }
55
- }
56
- static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::crypto::CFRGKeyPairType arg) {
57
- switch (arg) {
58
- case margelo::nitro::crypto::CFRGKeyPairType::ED25519: return JSIConverter<std::string>::toJSI(runtime, "ed25519");
59
- case margelo::nitro::crypto::CFRGKeyPairType::ED448: return JSIConverter<std::string>::toJSI(runtime, "ed448");
60
- case margelo::nitro::crypto::CFRGKeyPairType::X25519: return JSIConverter<std::string>::toJSI(runtime, "x25519");
61
- case margelo::nitro::crypto::CFRGKeyPairType::X448: return JSIConverter<std::string>::toJSI(runtime, "x448");
62
- default: [[unlikely]]
63
- throw std::invalid_argument("Cannot convert CFRGKeyPairType to JS - invalid value: "
64
- + std::to_string(static_cast<int>(arg)) + "!");
65
- }
66
- }
67
- static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
68
- if (!value.isString()) {
69
- return false;
70
- }
71
- std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
72
- switch (hashString(unionValue.c_str(), unionValue.size())) {
73
- case hashString("ed25519"):
74
- case hashString("ed448"):
75
- case hashString("x25519"):
76
- case hashString("x448"):
77
- return true;
78
- default:
79
- return false;
80
- }
81
- }
82
- };
83
-
84
- } // namespace margelo::nitro