From 60d5b78df07d7ef64b8c69f4a66e779dafedc1c9 Mon Sep 17 00:00:00 2001 From: fyears Date: Thu, 4 Nov 2021 10:16:07 +0800 Subject: [PATCH] fix length --- src/encrypt.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/encrypt.ts b/src/encrypt.ts index 1f41cd3..ddc7a27 100644 --- a/src/encrypt.ts +++ b/src/encrypt.ts @@ -58,11 +58,12 @@ export const encryptArrayBuffer = async ( const prefix = new TextEncoder().encode("Salted__"); const res = new Uint8Array( - prefix.byteLength + salt.byteLength + enc.byteLength + [ + ...prefix, + ...salt, + ...new Uint8Array(enc) + ] ); - res.set(new Uint8Array(prefix)); - res.set(new Uint8Array(salt)); - res.set(new Uint8Array(enc)); return bufferToArrayBuffer(res); };