asherah 1.0.45 → 1.0.46
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/dist/asherah.d.ts +1 -0
- package/dist/asherah.js +9 -6
- package/package.json +4 -2
package/dist/asherah.d.ts
CHANGED
package/dist/asherah.js
CHANGED
|
@@ -6,13 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.encrypt_string = exports.decrypt_string = exports.encrypt = exports.decrypt = exports.shutdown = exports.setup = void 0;
|
|
7
7
|
const cobhan_1 = require("cobhan");
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const ref_napi_1 = __importDefault(require("ref-napi"));
|
|
9
10
|
const binaries_path = find_binaries();
|
|
10
11
|
const libasherah = (0, cobhan_1.load_platform_library)(binaries_path, 'libasherah', {
|
|
11
|
-
'SetupJson': [
|
|
12
|
-
'EncryptToJson': [
|
|
13
|
-
'DecryptFromJson': [
|
|
14
|
-
'Shutdown': [
|
|
12
|
+
'SetupJson': [ref_napi_1.default.types.int32, [ref_napi_1.default.refType(ref_napi_1.default.types.void)]],
|
|
13
|
+
'EncryptToJson': [ref_napi_1.default.types.int32, [ref_napi_1.default.refType(ref_napi_1.default.types.void), ref_napi_1.default.refType(ref_napi_1.default.types.void), ref_napi_1.default.refType(ref_napi_1.default.types.void)]],
|
|
14
|
+
'DecryptFromJson': [ref_napi_1.default.types.int32, [ref_napi_1.default.refType(ref_napi_1.default.types.void), ref_napi_1.default.refType(ref_napi_1.default.types.void), ref_napi_1.default.refType(ref_napi_1.default.types.void)]],
|
|
15
|
+
'Shutdown': [ref_napi_1.default.types.void, []]
|
|
15
16
|
});
|
|
17
|
+
const DecryptFromJson = libasherah["DecryptFromJson"];
|
|
18
|
+
const EncryptToJson = libasherah["EncryptToJson"];
|
|
16
19
|
const EstimatedEncryptionOverhead = 48;
|
|
17
20
|
const EstimatedEnvelopeOverhead = 185;
|
|
18
21
|
const Base64Overhead = 1.34;
|
|
@@ -47,7 +50,7 @@ function decrypt(partitionId, dataRowRecord) {
|
|
|
47
50
|
const partitionIdBuffer = (0, cobhan_1.string_to_cbuffer)(partitionId);
|
|
48
51
|
const jsonBuffer = (0, cobhan_1.string_to_cbuffer)(dataRowRecord);
|
|
49
52
|
const outputDataBuffer = (0, cobhan_1.allocate_cbuffer)(jsonBuffer.byteLength);
|
|
50
|
-
const result =
|
|
53
|
+
const result = DecryptFromJson(partitionIdBuffer, jsonBuffer, outputDataBuffer);
|
|
51
54
|
if (result < 0) {
|
|
52
55
|
throw new Error('decrypt failed: ' + result);
|
|
53
56
|
}
|
|
@@ -58,7 +61,7 @@ function encrypt(partitionId, data) {
|
|
|
58
61
|
const partitionIdBuffer = (0, cobhan_1.string_to_cbuffer)(partitionId);
|
|
59
62
|
const dataBuffer = (0, cobhan_1.buffer_to_cbuffer)(data);
|
|
60
63
|
const outputJsonBuffer = (0, cobhan_1.allocate_cbuffer)(estimate_buffer(data.byteLength, partitionId.length));
|
|
61
|
-
const result =
|
|
64
|
+
const result = EncryptToJson(partitionIdBuffer, dataBuffer, outputJsonBuffer);
|
|
62
65
|
if (result < 0) {
|
|
63
66
|
throw new Error('encrypt failed: ' + result);
|
|
64
67
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asherah",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"description": "Asherah envelope encryption and key rotation library",
|
|
5
5
|
"main": "dist/asherah.js",
|
|
6
6
|
"repository": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@types/chai": "^4.3.0",
|
|
28
28
|
"@types/mocha": "^9.1.0",
|
|
29
29
|
"@types/node": "^17.0.21",
|
|
30
|
+
"@types/ref-napi": "^3.0.4",
|
|
30
31
|
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
|
31
32
|
"@typescript-eslint/parser": "^5.13.0",
|
|
32
33
|
"benchmark": "^2.1.4",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
},
|
|
49
50
|
"types": "dist/asherah.d.ts",
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"cobhan": "^1.0.
|
|
52
|
+
"cobhan": "^1.0.33",
|
|
53
|
+
"ref-napi": "^3.0.3"
|
|
52
54
|
}
|
|
53
55
|
}
|