forked from margelo/react-native-quick-crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHybridUtils.hpp
More file actions
28 lines (20 loc) · 956 Bytes
/
HybridUtils.hpp
File metadata and controls
28 lines (20 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#include "HybridUtilsSpec.hpp"
namespace margelo::nitro::crypto {
class HybridUtils : public HybridUtilsSpec {
public:
HybridUtils() : HybridObject(TAG) {}
public:
bool timingSafeEqual(const std::shared_ptr<ArrayBuffer>& a, const std::shared_ptr<ArrayBuffer>& b) override;
protected:
void loadHybridMethods() override;
private:
facebook::jsi::Runtime* cachedRuntime_ = nullptr;
bool cachedIsHermesRuntime_ = false;
bool isHermesRuntime(facebook::jsi::Runtime& runtime);
facebook::jsi::Value bufferToJsiString(facebook::jsi::Runtime& runtime, const facebook::jsi::Value& thisArg,
const facebook::jsi::Value* args, size_t argCount);
facebook::jsi::Value jsiStringToBuffer(facebook::jsi::Runtime& runtime, const facebook::jsi::Value& thisArg,
const facebook::jsi::Value* args, size_t argCount);
};
} // namespace margelo::nitro::crypto