add streaming

This commit is contained in:
Emily Hou 2018-06-20 17:05:33 -07:00
parent 34cb970f11
commit 1bd7e4d486
16 changed files with 438 additions and 187 deletions

View file

@ -1,5 +1,5 @@
import { arrayToB64, b64ToArray } from './utils';
import ECE from './ece.js';
const encoder = new TextEncoder();
const decoder = new TextDecoder();
@ -179,6 +179,16 @@ export default class Keychain {
return ciphertext;
}
async encryptStream(plaintext) {
const enc = new ECE(plaintext, this.rawSecret, 'encrypt');
return enc;
}
async decryptStream(encstream) {
const dec = new ECE(encstream, this.rawSecret, 'decrypt');
return dec;
}
async decryptFile(ciphertext) {
const encryptKey = await this.encryptKeyPromise;
const plaintext = await window.crypto.subtle.decrypt(