FileCrypt
A webcrypto wrapper for files
Install:
npm i --save-dev filecrypt
Usage:
;
Generating an encryption key:
FileCrypt;
Generating an encryption key from a password:
FileCrypt;
Wrapping and unwrapping a CryptoKey for storage:
FileCrypt;FileCrypt;
Importing and exporting a CryptoKey for insecure storage:
FileCrypt;FileCrypt;
Encrypting and decrypting:
input; FileCrypt;
Saving the iv together with the encrypted file:
var merged = FileCrypt;// merged is iv buffer prepended to result buffer let iv data = FileCrypt;console;console;// iv and data are ArrayBuffers
Extra utilities:
// ArrayBuffer to base64 stringFileCrypt; // base64 string to ArrayBufferFileCrypt; // ArrayBuffer to FileFileCrypt; // File to ArrayBufferFileCrypt;