Skip to content

Commit 4839202

Browse files
committed
feat: successful build with update and digest empty methods
1 parent 783b696 commit 4839202

File tree

6 files changed

+68
-7
lines changed

6 files changed

+68
-7
lines changed

example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1940,7 +1940,7 @@ SPEC CHECKSUMS:
19401940
fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
19411941
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
19421942
hermes-engine: 46f1ffbf0297f4298862068dd4c274d4ac17a1fd
1943-
NitroModules: 3a58d9bc70815a0d5de4476ed6a36eff05a6a0ae
1943+
NitroModules: c36d6f656038a56beb1b1bcab2d0252d71744013
19441944
OpenSSL-Universal: b60a3702c9fea8b3145549d421fdb018e53ab7b4
19451945
QuickCrypto: 11878b44cfc77fad2ea8f387a16e315841651305
19461946
RCT-Folly: 84578c8756030547307e4572ab1947de1685c599
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <memory>
2+
#include <NitroModules/ArrayBuffer.hpp>
3+
#include <OpenSSL/evp.h>
4+
#include <optional>
5+
#include <string>
6+
#include <vector>
7+
8+
#include "HybridHash.hpp"
9+
10+
namespace margelo::nitro::crypto {
11+
12+
HybridHash::~HybridHash() {
13+
if (ctx) {
14+
EVP_MD_CTX_free(ctx);
15+
}
16+
}
17+
18+
void
19+
HybridHash::update() {
20+
// TODO
21+
}
22+
23+
void
24+
HybridHash::digest() {
25+
// TODO
26+
}
27+
28+
} // namespace margelo::nitro::crypto
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <memory>
2+
#include <NitroModules/ArrayBuffer.hpp>
3+
#include <OpenSSL/evp.h>
4+
#include <optional>
5+
#include <string>
6+
#include <vector>
7+
8+
#include "HybridHashSpec.hpp"
9+
10+
namespace margelo::nitro::crypto {
11+
12+
using namespace facebook;
13+
14+
class HybridHash : public HybridHashSpec {
15+
public:
16+
HybridHash() : HybridObject(TAG) {}
17+
~HybridHash();
18+
19+
public:
20+
// Methods
21+
void
22+
update() override;
23+
void
24+
digest() override;
25+
26+
private:
27+
// Properties
28+
EVP_MD_CTX *ctx = nullptr;
29+
};
30+
31+
} // margelo::nitro::crypto

packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridHashSpec.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ namespace margelo::nitro::crypto {
1414
HybridObject::loadHybridMethods();
1515
// load custom methods/properties
1616
registerHybrids(this, [](Prototype& prototype) {
17-
prototype.registerHybridMethod("copy", &HybridHashSpec::copy);
17+
prototype.registerHybridMethod("update", &HybridHashSpec::update);
18+
prototype.registerHybridMethod("digest", &HybridHashSpec::digest);
1819
});
1920
}
2021

packages/react-native-quick-crypto/nitrogen/generated/shared/c++/HybridHashSpec.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
1414
#endif
1515

16-
// Forward declaration of `ArrayBuffer` to properly resolve imports.
17-
namespace NitroModules { class ArrayBuffer; }
1816

19-
#include <NitroModules/ArrayBuffer.hpp>
17+
18+
2019

2120
namespace margelo::nitro::crypto {
2221

@@ -49,7 +48,8 @@ namespace margelo::nitro::crypto {
4948

5049
public:
5150
// Methods
52-
virtual std::shared_ptr<ArrayBuffer> copy() = 0;
51+
virtual void update() = 0;
52+
virtual void digest() = 0;
5353

5454
protected:
5555
// Hybrid Setup
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { HybridObject } from 'react-native-nitro-modules';
22

33
export interface Hash extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
4-
copy(): ArrayBuffer;
4+
update(): void;
5+
digest(): void;
56
}

0 commit comments

Comments
 (0)