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.
- package/QuickCrypto.podspec +11 -1
- package/android/CMakeLists.txt +2 -0
- package/cpp/cipher/GCMCipher.cpp +68 -0
- package/cpp/cipher/GCMCipher.hpp +14 -0
- package/cpp/cipher/HybridCipherFactory.hpp +8 -0
- package/cpp/cipher/HybridRsaCipher.cpp +229 -0
- package/cpp/cipher/HybridRsaCipher.hpp +23 -0
- package/cpp/keys/HybridKeyObjectHandle.cpp +508 -9
- package/cpp/keys/HybridKeyObjectHandle.hpp +10 -1
- package/cpp/utils/base64.h +309 -0
- package/lib/commonjs/ec.js +85 -17
- package/lib/commonjs/ec.js.map +1 -1
- package/lib/commonjs/specs/rsaCipher.nitro.js +6 -0
- package/lib/commonjs/specs/rsaCipher.nitro.js.map +1 -0
- package/lib/commonjs/subtle.js +420 -17
- package/lib/commonjs/subtle.js.map +1 -1
- package/lib/commonjs/utils/conversion.js +1 -1
- package/lib/commonjs/utils/conversion.js.map +1 -1
- package/lib/module/ec.js +86 -18
- package/lib/module/ec.js.map +1 -1
- package/lib/module/specs/rsaCipher.nitro.js +4 -0
- package/lib/module/specs/rsaCipher.nitro.js.map +1 -0
- package/lib/module/subtle.js +421 -18
- package/lib/module/subtle.js.map +1 -1
- package/lib/module/utils/conversion.js +1 -1
- package/lib/module/utils/conversion.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/typescript/ec.d.ts.map +1 -1
- package/lib/typescript/specs/keyObjectHandle.nitro.d.ts +1 -0
- package/lib/typescript/specs/keyObjectHandle.nitro.d.ts.map +1 -1
- package/lib/typescript/specs/rsaCipher.nitro.d.ts +26 -0
- package/lib/typescript/specs/rsaCipher.nitro.d.ts.map +1 -0
- package/lib/typescript/subtle.d.ts.map +1 -1
- package/lib/typescript/utils/conversion.d.ts.map +1 -1
- package/lib/typescript/utils/types.d.ts +1 -1
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/nitrogen/generated/android/QuickCrypto+autolinking.cmake +1 -0
- package/nitrogen/generated/android/QuickCryptoOnLoad.cpp +10 -0
- package/nitrogen/generated/ios/QuickCryptoAutolinking.mm +10 -0
- package/nitrogen/generated/shared/c++/AsymmetricKeyType.hpp +104 -0
- package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.hpp +5 -4
- package/nitrogen/generated/shared/c++/HybridRsaCipherSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridRsaCipherSpec.hpp +70 -0
- package/package.json +1 -1
- package/src/ec.ts +122 -20
- package/src/specs/keyObjectHandle.nitro.ts +1 -0
- package/src/specs/rsaCipher.nitro.ts +35 -0
- package/src/subtle.ts +550 -45
- package/src/utils/conversion.ts +3 -1
- package/src/utils/types.ts +6 -6
- package/nitrogen/generated/shared/c++/CFRGKeyPairType.hpp +0 -84
package/src/utils/types.ts
CHANGED
|
@@ -225,12 +225,12 @@ export type KeyPairGenConfig = {
|
|
|
225
225
|
};
|
|
226
226
|
|
|
227
227
|
export type AsymmetricKeyType =
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|