fix length

This commit is contained in:
fyears 2021-11-04 10:16:07 +08:00
parent f04017e05b
commit 60d5b78df0

View File

@ -58,11 +58,12 @@ export const encryptArrayBuffer = async (
const prefix = new TextEncoder().encode("Salted__"); const prefix = new TextEncoder().encode("Salted__");
const res = new Uint8Array( 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); return bufferToArrayBuffer(res);
}; };