feat: make file handling more robust (#5057)

This commit is contained in:
David Luzar 2022-05-09 15:53:04 +02:00 committed by GitHub
parent 0d70690ec8
commit d2e687ed0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 328 additions and 152 deletions

View file

@ -1,4 +1,5 @@
import { ENCRYPTION_KEY_BITS } from "../constants";
import { blobToArrayBuffer } from "./blob";
export const IV_LENGTH_BYTES = 12;
@ -58,7 +59,7 @@ export const encryptData = async (
: data instanceof Uint8Array
? data
: data instanceof Blob
? await data.arrayBuffer()
? await blobToArrayBuffer(data)
: data;
// We use symmetric encryption. AES-GCM is the recommended algorithm and