engage-wasm 1.246.90860019 → 1.247.90870021
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/engagewasm.api.js +74 -0
- package/engagewasm.js +1 -1
- package/engagewasm.wasm +0 -0
- package/package.json +1 -1
package/engagewasm.api.js
CHANGED
|
@@ -51,6 +51,28 @@ export default class Engage extends EventTarget {
|
|
|
51
51
|
return this.wasmWrapper.engageStop();
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
engageDecrypt(srcUint8Array, srcSize, dstUint8Array, passwordHex) {
|
|
55
|
+
const srcHeap = this.wasm._malloc(srcSize * 1);
|
|
56
|
+
this.wasm.HEAPU8.set(srcUint8Array, srcHeap);
|
|
57
|
+
|
|
58
|
+
const dstHeap = this.wasm._malloc(srcSize + 64);
|
|
59
|
+
|
|
60
|
+
const rc = this.wasmWrapper.engageDecrypt(
|
|
61
|
+
srcHeap,
|
|
62
|
+
srcSize,
|
|
63
|
+
dstHeap,
|
|
64
|
+
passwordHex);
|
|
65
|
+
|
|
66
|
+
if (rc > 0) {
|
|
67
|
+
const dstArray = this.wasm.HEAPU8.subarray(dstHeap, rc);
|
|
68
|
+
dstUint8Array.set(dstArray);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.wasm._free(srcHeap);
|
|
72
|
+
this.wasm._free(dstHeap);
|
|
73
|
+
return rc;
|
|
74
|
+
}
|
|
75
|
+
|
|
54
76
|
engageSetCertStore(csUint8Array, arraySize, passwordHex) {
|
|
55
77
|
const heapSpace = this.wasm._malloc(arraySize * 1);
|
|
56
78
|
this.wasm.HEAPU8.set(csUint8Array, heapSpace);
|
|
@@ -145,6 +167,58 @@ export default class Engage extends EventTarget {
|
|
|
145
167
|
engageQueryGroupTimeline(id, jsonParams) {
|
|
146
168
|
return this.wasmWrapper.engageQueryGroupTimeline(id, jsonParams);
|
|
147
169
|
}
|
|
170
|
+
|
|
171
|
+
engageEncryptWasm(srcUint8Array, srcSize, passwordHex) {
|
|
172
|
+
var srcArrayPtr = this.wasm._malloc(srcSize * 1);
|
|
173
|
+
this.wasm.HEAPU8.set(srcUint8Array, srcArrayPtr);
|
|
174
|
+
|
|
175
|
+
var dstArrayPtr = this.wasm._malloc(srcSize + 64);
|
|
176
|
+
|
|
177
|
+
const rc = this.wasmWrapper.engageEncrypt(
|
|
178
|
+
srcArrayPtr,
|
|
179
|
+
srcSize,
|
|
180
|
+
dstArrayPtr,
|
|
181
|
+
passwordHex);
|
|
182
|
+
|
|
183
|
+
var encryptedBuffer = null;
|
|
184
|
+
|
|
185
|
+
if(rc > 0) {
|
|
186
|
+
var tmp = new Uint8Array(this.wasm.HEAPU8.buffer, dstArrayPtr, rc);
|
|
187
|
+
encryptedBuffer = new Uint8Array(rc);
|
|
188
|
+
encryptedBuffer.set(tmp);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
this.wasm._free(srcArrayPtr);
|
|
192
|
+
this.wasm._free(dstArrayPtr);
|
|
193
|
+
|
|
194
|
+
return encryptedBuffer;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
engageDecryptWasm(srcUint8Array, srcSize, passwordHex) {
|
|
198
|
+
var srcArrayPtr = this.wasm._malloc(srcSize * 1);
|
|
199
|
+
this.wasm.HEAPU8.set(srcUint8Array, srcArrayPtr);
|
|
200
|
+
|
|
201
|
+
var dstArrayPtr = this.wasm._malloc(srcSize + 64);
|
|
202
|
+
|
|
203
|
+
const rc = this.wasmWrapper.engageDecrypt(
|
|
204
|
+
srcArrayPtr,
|
|
205
|
+
srcSize,
|
|
206
|
+
dstArrayPtr,
|
|
207
|
+
passwordHex);
|
|
208
|
+
|
|
209
|
+
var decryptedBuffer = null;
|
|
210
|
+
|
|
211
|
+
if(rc > 0) {
|
|
212
|
+
var tmp = new Uint8Array(this.wasm.HEAPU8.buffer, dstArrayPtr, rc);
|
|
213
|
+
decryptedBuffer = new Uint8Array(rc);
|
|
214
|
+
decryptedBuffer.set(tmp);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
this.wasm._free(srcArrayPtr);
|
|
218
|
+
this.wasm._free(dstArrayPtr);
|
|
219
|
+
|
|
220
|
+
return decryptedBuffer;
|
|
221
|
+
}
|
|
148
222
|
}
|
|
149
223
|
|
|
150
224
|
/*
|