@trustvc/trustvc 1.0.0-alpha.5 → 1.0.0-alpha.6
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/core/encrypt.js
CHANGED
|
@@ -14,7 +14,7 @@ function encrypt(message, key, nonce) {
|
|
|
14
14
|
const keyBuffer = stringUtils.stringToUint8Array(key);
|
|
15
15
|
const nonceBuffer = stringUtils.stringToUint8Array(nonce);
|
|
16
16
|
const chacha20 = new tsChacha20.Chacha20(keyBuffer, nonceBuffer);
|
|
17
|
-
const messageBuffer =
|
|
17
|
+
const messageBuffer = stringUtils.stringToUint8Array(message);
|
|
18
18
|
const encrypted = chacha20.encrypt(messageBuffer);
|
|
19
19
|
return Buffer.from(encrypted).toString("hex");
|
|
20
20
|
}
|
package/dist/esm/core/encrypt.js
CHANGED
|
@@ -12,7 +12,7 @@ function encrypt(message, key, nonce) {
|
|
|
12
12
|
const keyBuffer = stringToUint8Array(key);
|
|
13
13
|
const nonceBuffer = stringToUint8Array(nonce);
|
|
14
14
|
const chacha20 = new Chacha20(keyBuffer, nonceBuffer);
|
|
15
|
-
const messageBuffer =
|
|
15
|
+
const messageBuffer = stringToUint8Array(message);
|
|
16
16
|
const encrypted = chacha20.encrypt(messageBuffer);
|
|
17
17
|
return Buffer.from(encrypted).toString("hex");
|
|
18
18
|
}
|
|
@@ -3,8 +3,7 @@ import { shake256 } from 'js-sha3';
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
5
|
function stringToUint8Array(str) {
|
|
6
|
-
|
|
7
|
-
return encoder.encode(str);
|
|
6
|
+
return new Uint8Array(Buffer.from(str, "utf-8"));
|
|
8
7
|
}
|
|
9
8
|
__name(stringToUint8Array, "stringToUint8Array");
|
|
10
9
|
function generate32ByteKey(input) {
|
|
@@ -5,8 +5,7 @@ var jsSha3 = require('js-sha3');
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
7
|
function stringToUint8Array(str) {
|
|
8
|
-
|
|
9
|
-
return encoder.encode(str);
|
|
8
|
+
return new Uint8Array(Buffer.from(str, "utf-8"));
|
|
10
9
|
}
|
|
11
10
|
__name(stringToUint8Array, "stringToUint8Array");
|
|
12
11
|
function generate32ByteKey(input) {
|