Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions app/fileReceiver.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Nanobus from 'nanobus';
import Keychain from './keychain';
import { delay, bytes, streamToArrayBuffer } from './utils';
import { downloadFile, metadata, getApiUrl, reportLink } from './api';
import { downloadFile, metadata, getApiUrl } from './api';
import { blobStream } from './streams';
import Zip from './zip';

Expand Down Expand Up @@ -53,10 +53,6 @@ export default class FileReceiver extends Nanobus {
this.state = 'ready';
}

async reportLink(reason) {
await reportLink(this.fileInfo.id, this.keychain, reason);
}

sendMessageToSw(msg) {
return new Promise((resolve, reject) => {
const channel = new MessageChannel();
Expand Down
33 changes: 33 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"@fullhuman/postcss-purgecss": "^4.1.3",
"@mattiasbuelens/web-streams-polyfill": "0.2.1",
"asmcrypto.js": "^0.22.0",
"assert": "^2.1.0",
"babel-loader": "^8.2.4",
"babel-plugin-istanbul": "^5.2.0",
"base64-js": "^1.5.1",
Expand Down Expand Up @@ -103,6 +104,7 @@
"postcss-loader": "^8.1.1",
"postcss-preset-env": "^7.7.2",
"prettier": "^1.19.1",
"process": "^0.11.10",
"proxyquire": "^2.1.3",
"puppeteer": "^2.0.0",
"raw-loader": "^3.1.0",
Expand Down
24 changes: 11 additions & 13 deletions test/frontend/tests/streaming-tests.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
const ece = require('http_ece');
require('buffer');

import assert from 'assert';
import Archive from '../../../app/archive';
import { b64ToArray } from '../../../app/utils';
Expand All @@ -15,16 +12,17 @@ const testSalt = 'I1BsxtFttlv3u_Oo94xnmw';
const keystr = 'yqdlZ-tYemfogSmv7Ws5PQ';

const buffer = Buffer.from(str);
const params = {
version: 'aes128gcm',
rs: rs,
salt: testSalt,
keyid: '',
key: keystr
};

const encrypted = ece.encrypt(buffer, params);
const decrypted = ece.decrypt(encrypted, params);

// Reference ciphertext for the params { version: 'aes128gcm', rs: 36,
// salt: testSalt, key: keystr }, produced once by the http_ece library
// in Node. Frozen here as a golden vector so the browser test bundle
// doesn't have to run the Node-only http_ece (and its node:crypto
// dependency) in-browser. ECE/aes128gcm (RFC 8188) output is stable.
const encrypted = Buffer.from(
'I1BsxtFttlv3u/Oo94xnmwAAACQA6J8B9PysG0UQpgbdfI4E2pBumJk+XsSviMkGvlSpyrsiKCXwIw8SNTVexOXMwoXXFbcrUth/qV/ZCMLiWQ78S7XTBFAXwaBazYaD2hM93TBw2xLZk3AGMVLF9XgSkzqbdkLj+6K8+tSYgmhvz6Xan0muK+wZZ1jbchmyMYvuyA==',
'base64'
);
const decrypted = buffer;

describe('Streaming', function() {
describe('blobStream', function() {
Expand Down
10 changes: 8 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ const web = {
new webpack.EnvironmentPlugin(['NODE_ENV']),
new webpack.IgnorePlugin({ resourceRegExp: /\.\.\/dist/ }), // used in common/*.js
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
Buffer: ['buffer', 'Buffer'],
// assert polyfill (test bundle) needs process; require.resolve so
// .mjs deps (asmcrypto) get a fully-specified path
process: require.resolve('process/browser')
}),
new MiniCssExtractPlugin({
filename: '[name].[contenthash:8].css'
Expand All @@ -235,7 +238,10 @@ const web = {
resolve: {
fallback: {
buffer: require.resolve('buffer/'),
path: require.resolve('path-browserify')
path: require.resolve('path-browserify'),
// only the frontend test bundle (dev mode) imports assert; lazy,
// so it stays out of the production app bundle
assert: require.resolve('assert/')
}
},
devtool: 'source-map',
Expand Down
Loading