asherah 1.0.43 → 1.0.44
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.
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/asherah.js
CHANGED
|
@@ -11,6 +11,7 @@ const libasherah = (0, cobhan_1.load_platform_library)(binaries_path, 'libashera
|
|
|
11
11
|
'SetupJson': ['int32', ['pointer']],
|
|
12
12
|
'EncryptToJson': ['int32', ['pointer', 'pointer', 'pointer']],
|
|
13
13
|
'DecryptFromJson': ['int32', ['pointer', 'pointer', 'pointer']],
|
|
14
|
+
'EstimateBuffer': ['int32', ['int32', 'int32']],
|
|
14
15
|
'Shutdown': ['void', []]
|
|
15
16
|
});
|
|
16
17
|
function find_binaries() {
|
|
@@ -46,10 +47,9 @@ function decrypt(partitionId, dataRowRecord) {
|
|
|
46
47
|
}
|
|
47
48
|
exports.decrypt = decrypt;
|
|
48
49
|
function encrypt(partitionId, data) {
|
|
49
|
-
const json_overhead = 256;
|
|
50
50
|
const partitionIdBuffer = (0, cobhan_1.string_to_cbuffer)(partitionId);
|
|
51
51
|
const dataBuffer = (0, cobhan_1.buffer_to_cbuffer)(data);
|
|
52
|
-
const outputJsonBuffer = (0, cobhan_1.allocate_cbuffer)(data.byteLength
|
|
52
|
+
const outputJsonBuffer = (0, cobhan_1.allocate_cbuffer)(libasherah.EstimateBuffer(data.byteLength, partitionId.length));
|
|
53
53
|
const result = libasherah.EncryptToJson(partitionIdBuffer, dataBuffer, outputJsonBuffer);
|
|
54
54
|
if (result < 0) {
|
|
55
55
|
throw new Error('encrypt failed: ' + result);
|