react-native-quick-crypto 1.0.0-beta.11 → 1.0.0-beta.13
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/android/CMakeLists.txt +4 -0
- package/cpp/ed25519/HybridEdKeyPair.cpp +32 -89
- package/cpp/ed25519/HybridEdKeyPair.hpp +24 -54
- package/cpp/hash/HybridHash.cpp +151 -0
- package/cpp/hash/HybridHash.hpp +41 -0
- package/cpp/hmac/HybridHmac.cpp +95 -0
- package/cpp/hmac/HybridHmac.hpp +31 -0
- package/cpp/pbkdf2/HybridPbkdf2.cpp +34 -55
- package/cpp/pbkdf2/HybridPbkdf2.hpp +5 -16
- package/cpp/random/HybridRandom.cpp +5 -16
- package/cpp/random/HybridRandom.hpp +5 -6
- package/cpp/utils/Utils.hpp +1 -2
- package/lib/commonjs/hash.js +168 -0
- package/lib/commonjs/hash.js.map +1 -0
- package/lib/commonjs/hmac.js +109 -0
- package/lib/commonjs/hmac.js.map +1 -0
- package/lib/commonjs/index.js +26 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/hash.nitro.js +6 -0
- package/lib/commonjs/specs/hash.nitro.js.map +1 -0
- package/lib/commonjs/specs/hmac.nitro.js +6 -0
- package/lib/commonjs/specs/hmac.nitro.js.map +1 -0
- package/lib/module/hash.js +162 -0
- package/lib/module/hash.js.map +1 -0
- package/lib/module/hmac.js +104 -0
- package/lib/module/hmac.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/hash.nitro.js +4 -0
- package/lib/module/specs/hash.nitro.js.map +1 -0
- package/lib/module/specs/hmac.nitro.js +4 -0
- package/lib/module/specs/hmac.nitro.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/typescript/hash.d.ts +110 -0
- package/lib/typescript/hash.d.ts.map +1 -0
- package/lib/typescript/hmac.d.ts +67 -0
- package/lib/typescript/hmac.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/specs/hash.nitro.d.ts +12 -0
- package/lib/typescript/specs/hash.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/hmac.nitro.d.ts +10 -0
- package/lib/typescript/specs/hmac.nitro.d.ts.map +1 -0
- package/lib/typescript/utils/types.d.ts +4 -0
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/nitrogen/generated/android/QuickCrypto+autolinking.cmake +2 -0
- package/nitrogen/generated/android/QuickCryptoOnLoad.cpp +20 -0
- package/nitrogen/generated/ios/QuickCryptoAutolinking.mm +20 -0
- package/nitrogen/generated/shared/c++/HybridHashSpec.cpp +25 -0
- package/nitrogen/generated/shared/c++/HybridHashSpec.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridHmacSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridHmacSpec.hpp +66 -0
- package/package.json +1 -1
- package/src/hash.ts +208 -0
- package/src/hmac.ts +135 -0
- package/src/index.ts +6 -0
- package/src/specs/hash.nitro.ts +9 -0
- package/src/specs/hmac.nitro.ts +7 -0
- package/src/utils/types.ts +9 -0
|
@@ -3,70 +3,49 @@
|
|
|
3
3
|
|
|
4
4
|
namespace margelo::nitro::crypto {
|
|
5
5
|
|
|
6
|
-
std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const std::shared_ptr<ArrayBuffer>& salt,
|
|
10
|
-
double iterations,
|
|
11
|
-
double keylen,
|
|
12
|
-
const std::string& digest
|
|
13
|
-
) {
|
|
6
|
+
std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>> HybridPbkdf2::pbkdf2(const std::shared_ptr<ArrayBuffer>& password,
|
|
7
|
+
const std::shared_ptr<ArrayBuffer>& salt, double iterations,
|
|
8
|
+
double keylen, const std::string& digest) {
|
|
14
9
|
// get owned NativeArrayBuffers before passing to sync function
|
|
15
10
|
auto nativePassword = ToNativeArrayBuffer(password);
|
|
16
11
|
auto nativeSalt = ToNativeArrayBuffer(salt);
|
|
17
12
|
|
|
18
|
-
return Promise<std::shared_ptr<ArrayBuffer>>::async(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
);
|
|
13
|
+
return Promise<std::shared_ptr<ArrayBuffer>>::async([this, nativePassword, nativeSalt, iterations, keylen, digest]() {
|
|
14
|
+
return this->pbkdf2Sync(nativePassword, nativeSalt, iterations, keylen, digest);
|
|
15
|
+
});
|
|
23
16
|
}
|
|
24
17
|
|
|
25
|
-
std::shared_ptr<ArrayBuffer>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const std::string& digest
|
|
32
|
-
) {
|
|
33
|
-
size_t bufferSize = static_cast<size_t>(keylen);
|
|
34
|
-
uint8_t* data = new uint8_t[bufferSize];
|
|
35
|
-
auto result = std::make_shared<NativeArrayBuffer>(data, bufferSize, [=]() { delete[] data; });
|
|
18
|
+
std::shared_ptr<ArrayBuffer> HybridPbkdf2::pbkdf2Sync(const std::shared_ptr<ArrayBuffer>& password,
|
|
19
|
+
const std::shared_ptr<ArrayBuffer>& salt, double iterations, double keylen,
|
|
20
|
+
const std::string& digest) {
|
|
21
|
+
size_t bufferSize = static_cast<size_t>(keylen);
|
|
22
|
+
uint8_t* data = new uint8_t[bufferSize];
|
|
23
|
+
auto result = std::make_shared<NativeArrayBuffer>(data, bufferSize, [=]() { delete[] data; });
|
|
36
24
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
result.get()->data(), result.get()->size());
|
|
53
|
-
} else {
|
|
54
|
-
// fallback to OpenSSL
|
|
55
|
-
auto *digestByName = EVP_get_digestbyname(digest.c_str());
|
|
56
|
-
if (digestByName == nullptr) {
|
|
57
|
-
throw std::runtime_error("Invalid hash-algorithm: " + digest);
|
|
58
|
-
}
|
|
59
|
-
char *passAsCharA = reinterpret_cast<char *>(password.get()->data());
|
|
60
|
-
const unsigned char *saltAsCharA =
|
|
61
|
-
reinterpret_cast<const unsigned char *>(salt.get()->data());
|
|
62
|
-
unsigned char *resultAsCharA =
|
|
63
|
-
reinterpret_cast<unsigned char *>(result.get()->data());
|
|
64
|
-
PKCS5_PBKDF2_HMAC(passAsCharA, password.get()->size(), saltAsCharA,
|
|
65
|
-
salt.get()->size(), static_cast<uint32_t>(iterations),
|
|
66
|
-
digestByName, result.get()->size(), resultAsCharA);
|
|
25
|
+
// use fastpbkdf2 when possible
|
|
26
|
+
if (digest == "sha1") {
|
|
27
|
+
fastpbkdf2_hmac_sha1(password.get()->data(), password.get()->size(), salt.get()->data(), salt.get()->size(),
|
|
28
|
+
static_cast<uint32_t>(iterations), result.get()->data(), result.get()->size());
|
|
29
|
+
} else if (digest == "sha256") {
|
|
30
|
+
fastpbkdf2_hmac_sha256(password.get()->data(), password.get()->size(), salt.get()->data(), salt.get()->size(),
|
|
31
|
+
static_cast<uint32_t>(iterations), result.get()->data(), result.get()->size());
|
|
32
|
+
} else if (digest == "sha512") {
|
|
33
|
+
fastpbkdf2_hmac_sha512(password.get()->data(), password.get()->size(), salt.get()->data(), salt.get()->size(),
|
|
34
|
+
static_cast<uint32_t>(iterations), result.get()->data(), result.get()->size());
|
|
35
|
+
} else {
|
|
36
|
+
// fallback to OpenSSL
|
|
37
|
+
auto* digestByName = EVP_get_digestbyname(digest.c_str());
|
|
38
|
+
if (digestByName == nullptr) {
|
|
39
|
+
throw std::runtime_error("Invalid hash-algorithm: " + digest);
|
|
67
40
|
}
|
|
41
|
+
char* passAsCharA = reinterpret_cast<char*>(password.get()->data());
|
|
42
|
+
const unsigned char* saltAsCharA = reinterpret_cast<const unsigned char*>(salt.get()->data());
|
|
43
|
+
unsigned char* resultAsCharA = reinterpret_cast<unsigned char*>(result.get()->data());
|
|
44
|
+
PKCS5_PBKDF2_HMAC(passAsCharA, password.get()->size(), saltAsCharA, salt.get()->size(), static_cast<uint32_t>(iterations), digestByName,
|
|
45
|
+
result.get()->size(), resultAsCharA);
|
|
46
|
+
}
|
|
68
47
|
|
|
69
|
-
|
|
48
|
+
return result;
|
|
70
49
|
}
|
|
71
50
|
|
|
72
51
|
} // namespace margelo::nitro::crypto
|
|
@@ -13,23 +13,12 @@ class HybridPbkdf2 : public HybridPbkdf2Spec {
|
|
|
13
13
|
|
|
14
14
|
public:
|
|
15
15
|
// Methods
|
|
16
|
-
std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const std::shared_ptr<ArrayBuffer>& salt,
|
|
20
|
-
double iterations,
|
|
21
|
-
double keylen,
|
|
22
|
-
const std::string& digest
|
|
23
|
-
) override;
|
|
16
|
+
std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>> pbkdf2(const std::shared_ptr<ArrayBuffer>& password,
|
|
17
|
+
const std::shared_ptr<ArrayBuffer>& salt, double iterations, double keylen,
|
|
18
|
+
const std::string& digest) override;
|
|
24
19
|
|
|
25
|
-
std::shared_ptr<ArrayBuffer>
|
|
26
|
-
|
|
27
|
-
const std::shared_ptr<ArrayBuffer>& password,
|
|
28
|
-
const std::shared_ptr<ArrayBuffer>& salt,
|
|
29
|
-
double iterations,
|
|
30
|
-
double keylen,
|
|
31
|
-
const std::string& digest
|
|
32
|
-
) override;
|
|
20
|
+
std::shared_ptr<ArrayBuffer> pbkdf2Sync(const std::shared_ptr<ArrayBuffer>& password, const std::shared_ptr<ArrayBuffer>& salt,
|
|
21
|
+
double iterations, double keylen, const std::string& digest) override;
|
|
33
22
|
};
|
|
34
23
|
|
|
35
24
|
} // namespace margelo::nitro::crypto
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
#include "HybridRandom.hpp"
|
|
5
5
|
#include "Utils.hpp"
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
size_t checkSize(double size) {
|
|
9
8
|
if (!CheckIsUint32(size)) {
|
|
10
9
|
throw std::runtime_error("size must be uint32");
|
|
@@ -25,33 +24,23 @@ size_t checkOffset(double size, double offset) {
|
|
|
25
24
|
return static_cast<size_t>(offset);
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
|
|
29
27
|
namespace margelo::nitro::crypto {
|
|
30
28
|
|
|
31
|
-
std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>>
|
|
32
|
-
|
|
33
|
-
double dOffset,
|
|
34
|
-
double dSize) {
|
|
29
|
+
std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>> HybridRandom::randomFill(const std::shared_ptr<ArrayBuffer>& buffer, double dOffset,
|
|
30
|
+
double dSize) {
|
|
35
31
|
// get owned NativeArrayBuffer before passing to sync function
|
|
36
32
|
auto nativeBuffer = ToNativeArrayBuffer(buffer);
|
|
37
33
|
|
|
38
34
|
return Promise<std::shared_ptr<ArrayBuffer>>::async(
|
|
39
|
-
|
|
40
|
-
return this->randomFillSync(nativeBuffer, dOffset, dSize);
|
|
41
|
-
}
|
|
42
|
-
);
|
|
35
|
+
[this, nativeBuffer, dOffset, dSize]() { return this->randomFillSync(nativeBuffer, dOffset, dSize); });
|
|
43
36
|
};
|
|
44
37
|
|
|
45
|
-
std::shared_ptr<ArrayBuffer>
|
|
46
|
-
HybridRandom::randomFillSync(const std::shared_ptr<ArrayBuffer>& buffer,
|
|
47
|
-
double dOffset,
|
|
48
|
-
double dSize) {
|
|
38
|
+
std::shared_ptr<ArrayBuffer> HybridRandom::randomFillSync(const std::shared_ptr<ArrayBuffer>& buffer, double dOffset, double dSize) {
|
|
49
39
|
size_t size = checkSize(dSize);
|
|
50
40
|
size_t offset = checkOffset(dSize, dOffset);
|
|
51
41
|
uint8_t* data = buffer.get()->data();
|
|
52
42
|
if (RAND_bytes(data + offset, (int)size) != 1) {
|
|
53
|
-
throw std::runtime_error("error calling RAND_bytes" +
|
|
54
|
-
std::to_string(ERR_get_error()));
|
|
43
|
+
throw std::runtime_error("error calling RAND_bytes" + std::to_string(ERR_get_error()));
|
|
55
44
|
}
|
|
56
45
|
return buffer;
|
|
57
46
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#include <cmath>
|
|
2
2
|
#include <future>
|
|
3
|
-
#include <memory>
|
|
4
3
|
#include <iostream>
|
|
4
|
+
#include <memory>
|
|
5
5
|
|
|
6
6
|
#include "HybridRandomSpec.hpp"
|
|
7
7
|
|
|
@@ -15,17 +15,16 @@ class HybridRandom : public HybridRandomSpec {
|
|
|
15
15
|
|
|
16
16
|
public:
|
|
17
17
|
// Methods
|
|
18
|
-
std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>>
|
|
19
|
-
|
|
18
|
+
std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>> randomFill(const std::shared_ptr<ArrayBuffer>& buffer, double dOffset,
|
|
19
|
+
double dSize) override;
|
|
20
20
|
|
|
21
|
-
std::shared_ptr<ArrayBuffer>
|
|
22
|
-
randomFillSync(const std::shared_ptr<ArrayBuffer>& buffer, double dOffset, double dSize) override;
|
|
21
|
+
std::shared_ptr<ArrayBuffer> randomFillSync(const std::shared_ptr<ArrayBuffer>& buffer, double dOffset, double dSize) override;
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
inline void printData(std::string name, uint8_t* data, size_t size) {
|
|
26
25
|
std::cout << "data - " << name << std::endl;
|
|
27
26
|
for (size_t i = 0; i < size; i++) {
|
|
28
|
-
|
|
27
|
+
printf("%u ", data[i]);
|
|
29
28
|
}
|
|
30
29
|
printf("\n");
|
|
31
30
|
}
|
package/cpp/utils/Utils.hpp
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
#include <NitroModules/ArrayBuffer.hpp>
|
|
4
4
|
|
|
5
5
|
// copy a JSArrayBuffer that we do not own into a NativeArrayBuffer that we do own
|
|
6
|
-
inline std::shared_ptr<margelo::nitro::NativeArrayBuffer>
|
|
7
|
-
ToNativeArrayBuffer(const std::shared_ptr<margelo::nitro::ArrayBuffer>& buffer) {
|
|
6
|
+
inline std::shared_ptr<margelo::nitro::NativeArrayBuffer> ToNativeArrayBuffer(const std::shared_ptr<margelo::nitro::ArrayBuffer>& buffer) {
|
|
8
7
|
size_t bufferSize = buffer.get()->size();
|
|
9
8
|
uint8_t* data = new uint8_t[bufferSize];
|
|
10
9
|
memcpy(data, buffer.get()->data(), bufferSize);
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createHash = createHash;
|
|
7
|
+
exports.getHashes = getHashes;
|
|
8
|
+
exports.hashExports = void 0;
|
|
9
|
+
var _readableStream = require("readable-stream");
|
|
10
|
+
var _reactNativeNitroModules = require("react-native-nitro-modules");
|
|
11
|
+
var _utils = require("./utils");
|
|
12
|
+
class HashUtils {
|
|
13
|
+
static native = _reactNativeNitroModules.NitroModules.createHybridObject('Hash');
|
|
14
|
+
static getSupportedHashAlgorithms() {
|
|
15
|
+
return this.native.getSupportedHashAlgorithms();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function getHashes() {
|
|
19
|
+
return HashUtils.getSupportedHashAlgorithms();
|
|
20
|
+
}
|
|
21
|
+
class Hash extends _readableStream.Stream.Transform {
|
|
22
|
+
validate(args) {
|
|
23
|
+
if (typeof args.algorithm !== 'string' || args.algorithm.length === 0) throw new Error('Algorithm must be a non-empty string');
|
|
24
|
+
if (args.options?.outputLength !== undefined && args.options.outputLength < 0) throw new Error('Output length must be a non-negative number');
|
|
25
|
+
if (args.options?.outputLength !== undefined && typeof args.options.outputLength !== 'number') throw new Error('Output length must be a number');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @internal use `createHash()` instead
|
|
30
|
+
*/
|
|
31
|
+
constructor(args) {
|
|
32
|
+
super(args.options);
|
|
33
|
+
this.validate(args);
|
|
34
|
+
this.algorithm = args.algorithm;
|
|
35
|
+
this.options = args.options ?? {};
|
|
36
|
+
if (args.native) {
|
|
37
|
+
this.native = args.native;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.native = _reactNativeNitroModules.NitroModules.createHybridObject('Hash');
|
|
41
|
+
this.native.createHash(this.algorithm, this.options.outputLength);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Updates the hash content with the given `data`, the encoding of which
|
|
46
|
+
* is given in `inputEncoding`.
|
|
47
|
+
* If `encoding` is not provided, and the `data` is a string, an
|
|
48
|
+
* encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored.
|
|
49
|
+
*
|
|
50
|
+
* This can be called many times with new data as it is streamed.
|
|
51
|
+
* @since v1.0.0
|
|
52
|
+
* @param inputEncoding The `encoding` of the `data` string.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
update(data, inputEncoding) {
|
|
56
|
+
const defaultEncoding = 'utf8';
|
|
57
|
+
inputEncoding = inputEncoding ?? defaultEncoding;
|
|
58
|
+
this.native.update((0, _utils.binaryLikeToArrayBuffer)(data, inputEncoding));
|
|
59
|
+
return this; // to support chaining syntax createHash().update().digest()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Calculates the digest of all of the data passed to be hashed (using the `hash.update()` method).
|
|
64
|
+
* If `encoding` is provided a string will be returned; otherwise
|
|
65
|
+
* a `Buffer` is returned.
|
|
66
|
+
*
|
|
67
|
+
* The `Hash` object can not be used again after `hash.digest()` method has been
|
|
68
|
+
* called. Multiple calls will cause an error to be thrown.
|
|
69
|
+
* @since v1.0.0
|
|
70
|
+
* @param encoding The `encoding` of the return value.
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
digest(encoding) {
|
|
74
|
+
const nativeDigest = this.native.digest(encoding);
|
|
75
|
+
if (encoding && encoding !== 'buffer') {
|
|
76
|
+
return (0, _utils.ab2str)(nativeDigest, encoding);
|
|
77
|
+
}
|
|
78
|
+
return Buffer.from(nativeDigest);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Creates a new `Hash` object that contains a deep copy of the internal state
|
|
83
|
+
* of the current `Hash` object.
|
|
84
|
+
*
|
|
85
|
+
* The optional `options` argument controls stream behavior. For XOF hash
|
|
86
|
+
* functions such as `'shake256'`, the `outputLength` option can be used to
|
|
87
|
+
* specify the desired output length in bytes.
|
|
88
|
+
*
|
|
89
|
+
* An error is thrown when an attempt is made to copy the `Hash` object after
|
|
90
|
+
* its `hash.digest()` method has been called.
|
|
91
|
+
*
|
|
92
|
+
* ```js
|
|
93
|
+
* // Calculate a rolling hash.
|
|
94
|
+
* import { createHash } from 'react-native-quick-crypto';
|
|
95
|
+
*
|
|
96
|
+
* const hash = createHash('sha256');
|
|
97
|
+
*
|
|
98
|
+
* hash.update('one');
|
|
99
|
+
* console.log(hash.copy().digest('hex'));
|
|
100
|
+
*
|
|
101
|
+
* hash.update('two');
|
|
102
|
+
* console.log(hash.copy().digest('hex'));
|
|
103
|
+
*
|
|
104
|
+
* hash.update('three');
|
|
105
|
+
* console.log(hash.copy().digest('hex'));
|
|
106
|
+
*
|
|
107
|
+
* // Etc.
|
|
108
|
+
* ```
|
|
109
|
+
* @since v1.0.0
|
|
110
|
+
* @param options `stream.transform` options
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
copy(options) {
|
|
114
|
+
const newOptions = options ?? this.options;
|
|
115
|
+
const newNativeHash = this.native.copy(newOptions.outputLength);
|
|
116
|
+
const hash = new Hash({
|
|
117
|
+
algorithm: this.algorithm,
|
|
118
|
+
options: newOptions,
|
|
119
|
+
native: newNativeHash
|
|
120
|
+
});
|
|
121
|
+
return hash;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// stream interface
|
|
125
|
+
_transform(chunk, encoding, callback) {
|
|
126
|
+
this.update(chunk, encoding);
|
|
127
|
+
callback();
|
|
128
|
+
}
|
|
129
|
+
_flush(callback) {
|
|
130
|
+
this.push(this.digest());
|
|
131
|
+
callback();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Creates and returns a `Hash` object that can be used to generate hash digests
|
|
137
|
+
* using the given `algorithm`. Optional `options` argument controls stream
|
|
138
|
+
* behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option
|
|
139
|
+
* can be used to specify the desired output length in bytes.
|
|
140
|
+
*
|
|
141
|
+
* The `algorithm` is dependent on the available algorithms supported by the
|
|
142
|
+
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
|
143
|
+
* On recent releases of OpenSSL, `openssl list -digest-algorithms` will
|
|
144
|
+
* display the available digest algorithms.
|
|
145
|
+
*
|
|
146
|
+
* Example: generating the sha256 sum of a file
|
|
147
|
+
*
|
|
148
|
+
* ```js
|
|
149
|
+
* import crypto from 'react-native-quick-crypto';
|
|
150
|
+
*
|
|
151
|
+
* const hash = crypto.createHash('sha256').update('Test123').digest('hex');
|
|
152
|
+
* console.log('SHA-256 of "Test123":', hash);
|
|
153
|
+
* ```
|
|
154
|
+
* @since v1.0.0
|
|
155
|
+
* @param options `stream.transform` options
|
|
156
|
+
*/
|
|
157
|
+
function createHash(algorithm, options) {
|
|
158
|
+
// @ts-expect-error private constructor
|
|
159
|
+
return new Hash({
|
|
160
|
+
algorithm,
|
|
161
|
+
options
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
const hashExports = exports.hashExports = {
|
|
165
|
+
createHash,
|
|
166
|
+
getHashes
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_readableStream","require","_reactNativeNitroModules","_utils","HashUtils","native","NitroModules","createHybridObject","getSupportedHashAlgorithms","getHashes","Hash","Stream","Transform","validate","args","algorithm","length","Error","options","outputLength","undefined","constructor","createHash","update","data","inputEncoding","defaultEncoding","binaryLikeToArrayBuffer","digest","encoding","nativeDigest","ab2str","Buffer","from","copy","newOptions","newNativeHash","hash","_transform","chunk","callback","_flush","push","hashExports","exports"],"sourceRoot":"../../src","sources":["hash.ts"],"mappings":";;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AAIA,IAAAE,MAAA,GAAAF,OAAA;AAEA,MAAMG,SAAS,CAAC;EACd,OAAeC,MAAM,GAAGC,qCAAY,CAACC,kBAAkB,CAAa,MAAM,CAAC;EAC3E,OAAcC,0BAA0BA,CAAA,EAAa;IACnD,OAAO,IAAI,CAACH,MAAM,CAACG,0BAA0B,CAAC,CAAC;EACjD;AACF;AAEO,SAASC,SAASA,CAAA,EAAG;EAC1B,OAAOL,SAAS,CAACI,0BAA0B,CAAC,CAAC;AAC/C;AAgBA,MAAME,IAAI,SAASC,sBAAM,CAACC,SAAS,CAAC;EAK1BC,QAAQA,CAACC,IAAc,EAAE;IAC/B,IAAI,OAAOA,IAAI,CAACC,SAAS,KAAK,QAAQ,IAAID,IAAI,CAACC,SAAS,CAACC,MAAM,KAAK,CAAC,EACnE,MAAM,IAAIC,KAAK,CAAC,sCAAsC,CAAC;IACzD,IACEH,IAAI,CAACI,OAAO,EAAEC,YAAY,KAAKC,SAAS,IACxCN,IAAI,CAACI,OAAO,CAACC,YAAY,GAAG,CAAC,EAE7B,MAAM,IAAIF,KAAK,CAAC,6CAA6C,CAAC;IAChE,IACEH,IAAI,CAACI,OAAO,EAAEC,YAAY,KAAKC,SAAS,IACxC,OAAON,IAAI,CAACI,OAAO,CAACC,YAAY,KAAK,QAAQ,EAE7C,MAAM,IAAIF,KAAK,CAAC,gCAAgC,CAAC;EACrD;;EAEA;AACF;AACA;EACUI,WAAWA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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGEI,IAAIA,CAAChB,OAAqB,EAAQ;IAChC,MAAMiB,UAAU,GAAGjB,OAAO,IAAI,IAAI,CAACA,OAAO;IAC1C,MAAMkB,aAAa,GAAG,IAAI,CAAC/B,MAAM,CAAC6B,IAAI,CAACC,UAAU,CAAChB,YAAY,CAAC;IAC/D,MAAMkB,IAAI,GAAG,IAAI3B,IAAI,CAAC;MACpBK,SAAS,EAAE,IAAI,CAACA,SAAS;MACzBG,OAAO,EAAEiB,UAAU;MACnB9B,MAAM,EAAE+B;IACV,CAAC,CAAC;IACF,OAAOC,IAAI;EACb;;EAEA;EACAC,UAAUA,CACRC,KAAiB,EACjBV,QAAwB,EACxBW,QAAoB,EACpB;IACA,IAAI,CAACjB,MAAM,CAACgB,KAAK,EAAEV,QAAoB,CAAC;IACxCW,QAAQ,CAAC,CAAC;EACZ;EACAC,MAAMA,CAACD,QAAoB,EAAE;IAC3B,IAAI,CAACE,IAAI,CAAC,IAAI,CAACd,MAAM,CAAC,CAAC,CAAC;IACxBY,QAAQ,CAAC,CAAC;EACZ;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASlB,UAAUA,CAACP,SAAiB,EAAEG,OAAqB,EAAQ;EACzE;EACA,OAAO,IAAIR,IAAI,CAAC;IACdK,SAAS;IACTG;EACF,CAAC,CAAC;AACJ;AAEO,MAAMyB,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzBrB,UAAU;EACVb;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createHmac = createHmac;
|
|
7
|
+
exports.hmacExports = void 0;
|
|
8
|
+
var _reactNativeBuffer = require("@craftzdog/react-native-buffer");
|
|
9
|
+
var _readableStream = require("readable-stream");
|
|
10
|
+
var _reactNativeNitroModules = require("react-native-nitro-modules");
|
|
11
|
+
var _conversion = require("./utils/conversion");
|
|
12
|
+
class Hmac extends _readableStream.Stream.Transform {
|
|
13
|
+
validate(args) {
|
|
14
|
+
if (typeof args.algorithm !== 'string' || args.algorithm.length === 0) throw new Error('Algorithm must be a non-empty string');
|
|
15
|
+
if (args.key === null || args.key === undefined) throw new Error('Key must not be null or undefined');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @internal use `createHmac()` instead
|
|
20
|
+
*/
|
|
21
|
+
constructor(args) {
|
|
22
|
+
super(args.options);
|
|
23
|
+
this.validate(args);
|
|
24
|
+
this.algorithm = args.algorithm;
|
|
25
|
+
this.key = args.key;
|
|
26
|
+
this.native = _reactNativeNitroModules.NitroModules.createHybridObject('Hmac');
|
|
27
|
+
this.native.createHmac(this.algorithm, (0, _conversion.binaryLikeToArrayBuffer)(this.key));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Updates the `Hmac` content with the given `data`, the encoding of which is given in `inputEncoding`.
|
|
32
|
+
* If `encoding` is not provided, and the `data` is a string, an encoding of `'utf8'` is enforced.
|
|
33
|
+
* If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored.
|
|
34
|
+
*
|
|
35
|
+
* This can be called many times with new data as it is streamed.
|
|
36
|
+
* @since v1.0.0
|
|
37
|
+
* @param inputEncoding The `encoding` of the `data` string.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
update(data, inputEncoding) {
|
|
41
|
+
const defaultEncoding = 'utf8';
|
|
42
|
+
inputEncoding = inputEncoding ?? defaultEncoding;
|
|
43
|
+
this.native.update((0, _conversion.binaryLikeToArrayBuffer)(data, inputEncoding));
|
|
44
|
+
return this; // to support chaining syntax createHmac().update().digest()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Calculates the HMAC digest of all of the data passed using `hmac.update()`.
|
|
49
|
+
* If `encoding` is provided a string is returned; otherwise a `Buffer` is returned;
|
|
50
|
+
*
|
|
51
|
+
* The `Hmac` object can not be used again after `hmac.digest()` has been
|
|
52
|
+
* called. Multiple calls to `hmac.digest()` will result in an error being thrown.
|
|
53
|
+
* @since v1.0.0
|
|
54
|
+
* @param encoding The `encoding` of the return value.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
digest(encoding) {
|
|
58
|
+
const nativeDigest = this.native.digest();
|
|
59
|
+
if (encoding && encoding !== 'buffer') {
|
|
60
|
+
return (0, _conversion.ab2str)(nativeDigest, encoding);
|
|
61
|
+
}
|
|
62
|
+
return _reactNativeBuffer.Buffer.from(nativeDigest);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// stream interface
|
|
66
|
+
_transform(chunk, encoding, callback) {
|
|
67
|
+
this.update(chunk, encoding);
|
|
68
|
+
callback();
|
|
69
|
+
}
|
|
70
|
+
_flush(callback) {
|
|
71
|
+
this.push(this.digest());
|
|
72
|
+
callback();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Creates and returns an `Hmac` object that uses the given `algorithm` and `key`.
|
|
78
|
+
* Optional `options` argument controls stream behavior.
|
|
79
|
+
*
|
|
80
|
+
* The `algorithm` is dependent on the available algorithms supported by the
|
|
81
|
+
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
|
82
|
+
* On recent releases of OpenSSL, `openssl list -digest-algorithms` will
|
|
83
|
+
* display the available digest algorithms.
|
|
84
|
+
*
|
|
85
|
+
* Example: generating the sha256 HMAC of a file
|
|
86
|
+
*
|
|
87
|
+
* ```js
|
|
88
|
+
* import crypto from 'react-native-quick-crypto';
|
|
89
|
+
*
|
|
90
|
+
* const hmac = crypto.createHmac('sha256', 'secret-key');
|
|
91
|
+
* hmac.update('message to hash');
|
|
92
|
+
* const digest = hmac.digest('hex');
|
|
93
|
+
* console.log(digest); // prints HMAC digest in hexadecimal format
|
|
94
|
+
* ```
|
|
95
|
+
* @since v1.0.0
|
|
96
|
+
* @param options `stream.transform` options
|
|
97
|
+
*/
|
|
98
|
+
function createHmac(algorithm, key, options) {
|
|
99
|
+
// @ts-expect-error private constructor
|
|
100
|
+
return new Hmac({
|
|
101
|
+
algorithm,
|
|
102
|
+
key,
|
|
103
|
+
options
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
const hmacExports = exports.hmacExports = {
|
|
107
|
+
createHmac
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=hmac.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNativeBuffer","require","_readableStream","_reactNativeNitroModules","_conversion","Hmac","Stream","Transform","validate","args","algorithm","length","Error","key","undefined","constructor","options","native","NitroModules","createHybridObject","createHmac","binaryLikeToArrayBuffer","update","data","inputEncoding","defaultEncoding","digest","encoding","nativeDigest","ab2str","Buffer","from","_transform","chunk","callback","_flush","push","hmacExports","exports"],"sourceRoot":"../../src","sources":["hmac.ts"],"mappings":";;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,WAAA,GAAAH,OAAA;AAQA,MAAMI,IAAI,SAASC,sBAAM,CAACC,SAAS,CAAC;EAK1BC,QAAQA,CAACC,IAAc,EAAE;IAC/B,IAAI,OAAOA,IAAI,CAACC,SAAS,KAAK,QAAQ,IAAID,IAAI,CAACC,SAAS,CAACC,MAAM,KAAK,CAAC,EACnE,MAAM,IAAIC,KAAK,CAAC,sCAAsC,CAAC;IACzD,IAAIH,IAAI,CAACI,GAAG,KAAK,IAAI,IAAIJ,IAAI,CAACI,GAAG,KAAKC,SAAS,EAC7C,MAA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O,QAAQ,CAAC,CAAC;EACZ;EACAC,MAAMA,CAACD,QAAoB,EAAE;IAC3B,IAAI,CAACE,IAAI,CAAC,IAAI,CAACV,MAAM,CAAC,CAAC,CAAC;IACxBQ,QAAQ,CAAC,CAAC;EACZ;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASd,UAAUA,CACxBV,SAAiB,EACjBG,GAAe,EACfG,OAA0B,EACpB;EACN;EACA,OAAO,IAAIX,IAAI,CAAC;IACdK,SAAS;IACTG,GAAG;IACHG;EACF,CAAC,CAAC;AACJ;AAEO,MAAMqB,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzBjB;AACF,CAAC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -9,6 +9,30 @@ var _exportNames = {
|
|
|
9
9
|
exports.install = exports.default = void 0;
|
|
10
10
|
var _reactNativeBuffer = require("@craftzdog/react-native-buffer");
|
|
11
11
|
var keys = _interopRequireWildcard(require("./keys"));
|
|
12
|
+
var _hash = require("./hash");
|
|
13
|
+
Object.keys(_hash).forEach(function (key) {
|
|
14
|
+
if (key === "default" || key === "__esModule") return;
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
|
+
if (key in exports && exports[key] === _hash[key]) return;
|
|
17
|
+
Object.defineProperty(exports, key, {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return _hash[key];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
var _hmac = require("./hmac");
|
|
25
|
+
Object.keys(_hmac).forEach(function (key) {
|
|
26
|
+
if (key === "default" || key === "__esModule") return;
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
+
if (key in exports && exports[key] === _hmac[key]) return;
|
|
29
|
+
Object.defineProperty(exports, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return _hmac[key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
12
36
|
var ed = _interopRequireWildcard(require("./ed"));
|
|
13
37
|
Object.keys(ed).forEach(function (key) {
|
|
14
38
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -88,6 +112,8 @@ const QuickCrypto = {
|
|
|
88
112
|
// subtle,
|
|
89
113
|
// constants,
|
|
90
114
|
...keys,
|
|
115
|
+
..._hash.hashExports,
|
|
116
|
+
..._hmac.hmacExports,
|
|
91
117
|
...ed,
|
|
92
118
|
...pbkdf2,
|
|
93
119
|
...random,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeBuffer","require","keys","_interopRequireWildcard","
|
|
1
|
+
{"version":3,"names":["_reactNativeBuffer","require","keys","_interopRequireWildcard","_hash","Object","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_hmac","ed","pbkdf2","random","utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","QuickCrypto","hash","hmac","install","global","Buffer","crypto","process","nextTick","setImmediate","_default","module"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;AACA,IAAAA,kBAAA,GAAAC,OAAA;AAGA,IAAAC,IAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AA4DAI,MAAA,CAAAH,IAAA,CAAAE,KAAA,EAAAE,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAF,MAAA,CAAAG,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAH,KAAA,CAAAG,GAAA;EAAAF,MAAA,CAAAQ,c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AAI;EACP,GAAGmC,iBAAI;EACP,GAAGC,iBAAI;EACP,GAAGrB,EAAE;EACL,GAAGC,MAAM;EACT,GAAGC,MAAM;EACT;EACA;EACA;EACA,GAAGC;AACL,CAAC;;AAED;AACA;AACA;AACA;AACO,MAAMmB,OAAO,GAAGA,CAAA,KAAM;EAC3B;EACAC,MAAM,CAACC,MAAM,GAAGA,yBAAM;;EAEtB;EACAD,MAAM,CAACE,MAAM,GAAGN,WAAW;AAC7B,CAAC;;AAED;AAAAxB,OAAA,CAAA2B,OAAA,GAAAA,OAAA;AACAC,MAAM,CAACG,OAAO,CAACC,QAAQ,GAAGC,YAAY;;AAEtC;AAAA,IAAAC,QAAA,GAAAlC,OAAA,CAAAe,OAAA,GACeS,WAAW;AAQ1B;AACAW,MAAM,CAACnC,OAAO,GAAGwB,WAAW;AAC5BW,MAAM,CAACnC,OAAO,CAACe,OAAO,GAAGS,WAAW;AACpCW,MAAM,CAACnC,OAAO,CAAC2B,OAAO,GAAGA,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/hash.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/hmac.nitro.ts"],"mappings":"","ignoreList":[]}
|