This commit is contained in:
Emily 2018-07-05 12:40:49 -07:00
parent 38ef52d3ba
commit 62ed0a411f
16 changed files with 245 additions and 133 deletions

View file

@ -13,7 +13,7 @@ describe('API', function() {
describe('websocket upload', function() {
it('returns file info on success', async function() {
const keychain = new Keychain();
const enc = keychain.encryptStream(plaintext);
const enc = await keychain.encryptStream(plaintext);
const meta = await keychain.encryptMetadata(metadata);
const verifierB64 = await keychain.authKeyB64();
const p = function() {};
@ -22,12 +22,12 @@ describe('API', function() {
const result = await up.result;
assert.ok(result.url);
assert.ok(result.id);
assert.ok(result.ownerToken);
assert.ok(result.ownerToken);
});
it('can be cancelled', async function() {
const keychain = new Keychain();
const enc = keychain.encryptStream(plaintext);
const enc = await keychain.encryptStream(plaintext);
const meta = await keychain.encryptMetadata(metadata);
const verifierB64 = await keychain.authKeyB64();
const p = function() {};

View file

@ -31,7 +31,8 @@ describe('Streaming', function() {
const blob = new Blob([str], { type: 'text/plain' });
it('can encrypt', async function() {
const encStream = new ECE(blob, key, 'encrypt', rs, salt).stream;
const ece = new ECE(blob, key, 'encrypt', rs, salt);
const encStream = await ece.transform();
const reader = encStream.getReader();
let result = Buffer.from([]);
@ -47,7 +48,8 @@ describe('Streaming', function() {
it('can decrypt', async function() {
const encBlob = new Blob([encrypted]);
const decStream = await new ECE(encBlob, key, 'decrypt', rs).stream;
const ece = new ECE(encBlob, key, 'decrypt', rs);
const decStream = await ece.transform()
const reader = decStream.getReader();
let result = Buffer.from([]);