react-native-quick-crypto 0.7.0-rc.7 → 0.7.0-rc.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-quick-crypto",
3
- "version": "0.7.0-rc.7",
3
+ "version": "0.7.0-rc.8",
4
4
  "description": "A fast implementation of Node's `crypto` module written in C/C++ JSI",
5
5
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
6
6
  "main": "lib/commonjs/index",
@@ -1,31 +0,0 @@
1
- #include "MGLKeyPair.h"
2
-
3
- namespace margelo {
4
-
5
- void KeyPairGen::GenerateKeyPair() {
6
- CheckEntropy();
7
-
8
- // Generate the key
9
- EVP_PKEY* pkey = nullptr;
10
- if (!EVP_PKEY_keygen(this->ctx.get(), &pkey)) {
11
- throw std::runtime_error("Error generating key (RSA)");
12
- }
13
-
14
- this->key = ManagedEVPPKey(EVPKeyPointer(pkey));
15
-
16
- std::shared_ptr<KeyObjectData> publicBuffer =
17
- ManagedEVPPKey::ToEncodedPublicKey(std::move(this->key),
18
- this->public_key_encoding);
19
- std::shared_ptr<KeyObjectData> privateBuffer =
20
- ManagedEVPPKey::ToEncodedPrivateKey(std::move(this->key),
21
- this->private_key_encoding);
22
-
23
- if (publicBuffer.isUndefined() || privateBuffer.isUndefined()) {
24
- throw std::runtime_error("Failed to encode public and/or private key (RSA)");
25
- }
26
-
27
- this->publicKey = std::move(publicBuffer);
28
- this->privateKey = std::move(privateBuffer);
29
- }
30
-
31
- } // namespace margelo
package/cpp/MGLKeyPair.h DELETED
@@ -1,41 +0,0 @@
1
- #ifndef MGLKeyPair_h
2
- #define MGLKeyPair_h
3
-
4
- #include <jsi/jsi.h>
5
- #include "MGLKeys.h"
6
-
7
- #ifdef ANDROID
8
- // #include "Utils/MGLUtils.h"
9
- // #include "JSIUtils/MGLSmartHostObject.h"
10
- #else
11
- // #include "MGLUtils.h"
12
- // #include "MGLSmartHostObject.h"
13
- #endif
14
-
15
- namespace margelo {
16
-
17
- namespace jsi = facebook::jsi;
18
-
19
- class KeyPairGen {
20
- public:
21
- // KeyPairGen() {};
22
- virtual void PrepareConfig(jsi::Runtime& rt, const jsi::Value* args);
23
- virtual void GenerateKeyPair();
24
- inline static jsi::Value toJSI(jsi::Runtime& rt, std::shared_ptr<KeyObjectData> data) {
25
- auto handle = KeyObjectHandle::Create(rt, data);
26
- auto out = jsi::Object::createFromHostObject(rt, handle);
27
- return jsi::Value(std::move(out));
28
- };
29
- protected:
30
- KeyVariant variant;
31
- ManagedEVPPKey key;
32
- EVPKeyCtxPointer ctx;
33
- PublicKeyEncodingConfig public_key_encoding;
34
- PrivateKeyEncodingConfig private_key_encoding;
35
- std::shared_ptr<KeyObjectData> publicKey;
36
- std::shared_ptr<KeyObjectData> privateKey;
37
- };
38
-
39
- } // namespace margelo
40
-
41
- #endif /* MGLKeyPair_h */