Skip to content

Commit

Permalink
Merge pull request #264 from transcend-io/dmattia/more_updates
Browse files Browse the repository at this point in the history
More dependency updates
  • Loading branch information
dmattia authored Dec 6, 2023
2 parents d8e2202 + fbbd721 commit 3478e87
Show file tree
Hide file tree
Showing 45 changed files with 5,102 additions and 7,047 deletions.
2 changes: 1 addition & 1 deletion .depcheckrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ignores: ["core-js", "@yarnpkg/pnpify", "@yarnpkg/sdks", "babel-loader", "@babel/core", "@babel/plugin-proposal-class-properties", "@babel/preset-env", "@babel/preset-typescript", "depcheck", "karma-browserstack-launcher", "karma-chrome-launcher", "karma-firefox-launcher", "karma-safari-launcher", "karma-coverage", "karma-sourcemap-loader", "karma-tap", "karma-webpack", "nyc", "prettier", "webpack-cli", "worker-plugin", "buffer", "process"]
ignores: ["core-js", "@yarnpkg/sdks", "babel-loader", "@babel/core", "@babel/plugin-proposal-class-properties", "@babel/preset-env", "@babel/preset-typescript", "depcheck", "karma-browserstack-launcher", "karma-chrome-launcher", "karma-firefox-launcher", "karma-safari-launcher", "karma-coverage", "karma-sourcemap-loader", "karma-tap", "karma-webpack", "nyc", "prettier", "webpack-cli", "worker-plugin", "buffer", "process"]
skip-missing: true
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
"pipeable",
"playsinline",
"plusplus",
"pnpify",
"Ponyfill",
"preact",
"preconnect",
Expand Down
546 changes: 0 additions & 546 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

This file was deleted.

823 changes: 0 additions & 823 deletions .yarn/releases/yarn-3.3.1.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

npmPublishAccess: public

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"

yarnPath: .yarn/releases/yarn-3.3.1.cjs
yarnPath: .yarn/releases/yarn-4.0.2.cjs
32 changes: 15 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@transcend-io/penumbra",
"version": "5.3.3",
"version": "5.4.0",
"description": "Crypto streams for the browser.",
"main": "dist/main.penumbra.js",
"types": "ts-build/src/index.d.ts",
Expand All @@ -20,10 +20,10 @@
"test:local:rebuild": "yarn && karma start karma.local.js",
"test:browserstack": "karma start karma.browserstack.js",
"####### Build #######": "",
"clean": "rimraf dist && rimraf ts-build && rimraf coverage",
"clean": "rm -rf dist && rm -rf ts-build && rm -rf coverage",
"build": "yarn clean && mkdir -p dist && webpack --config webpack.prod.js && tsc",
"build:example": "rimraf example/build && yarn build && mkdir -p example/build && cp example/*.* example/build/ && cp -a dist/. example/build/",
"build:demo": "rimraf demo/build && yarn build && mkdir -p demo/build && cp demo/*.* demo/build/ && cp -a dist/. demo/build/",
"build:example": "rm -rf example/build && yarn build && mkdir -p example/build && cp example/*.* example/build/ && cp -a dist/. example/build/",
"build:demo": "rm -rf demo/build && yarn build && mkdir -p demo/build && cp demo/*.* demo/build/ && cp -a dist/. demo/build/",
"webpack:watch": "yarn clean && webpack --config webpack.dev.js --watch"
},
"repository": {
Expand Down Expand Up @@ -55,7 +55,7 @@
"@transcend-io/conflux": "^4.1.0",
"@transcend-io/remote-web-streams": "1.0.5",
"comlink": "^4.4.1",
"core-js": "^3.33.3",
"core-js": "^3.34.0",
"crypto-browserify": "^3.12.0",
"mime-types": "^2.1.35",
"promise.allsettled": "^1.0.7",
Expand All @@ -65,25 +65,24 @@
"web-streams-polyfill": "^3.2.1"
},
"devDependencies": {
"@babel/core": "^7.18.2",
"@babel/plugin-proposal-class-properties": "^7.17.12",
"@babel/preset-env": "^7.18.2",
"@babel/preset-typescript": "^7.17.12",
"@babel/core": "^7.23.5",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.23.5",
"@babel/preset-typescript": "^7.23.3",
"@types/mime-types": "^2.1.4",
"@types/node": "^20.9.0",
"@types/tape": "^4.13.4",
"@types/node": "^20.10.3",
"@types/tape": "^5.6.4",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"@yarnpkg/pnpify": "^3.1.7",
"@yarnpkg/sdks": "^2.7.2",
"@yarnpkg/sdks": "^3.1.0",
"babel-loader": "^8.2.5",
"buffer": "^6.0.3",
"depcheck": "^1.4.7",
"eslint": "^8.55.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jsdoc": "^46.9.0",
"git-rev-sync": "^3.0.2",
"http-server": "^14.1.1",
Expand All @@ -98,14 +97,13 @@
"karma-webpack": "^4.0.2",
"nyc": "^15.1.0",
"prettier": "^3.1.0",
"rimraf": "^3.0.2",
"tape": "^5.7.2",
"terser-webpack-plugin": "^2.3.8",
"typescript": "^4.9.5",
"typescript": "^5.3.2",
"webpack": "^4.47.0",
"webpack-cli": "^3.3.12",
"webpack-merge": "^5.10.0",
"worker-plugin": "^5.0.1"
},
"packageManager": "yarn@3.3.1"
"packageManager": "yarn@4.0.2"
}
6 changes: 6 additions & 0 deletions src/@types/conflux/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ declare module '@transcend-io/conflux' {
// TypeScript isn't aware of TransformStream
/** Conflux Zip Writer class */
export class Writer extends TransformStream {
/**
* Constructor
*/
constructor();

/** Write stream to filename in zip */
Expand All @@ -16,6 +19,9 @@ declare module '@transcend-io/conflux' {
stream(): ReadableStream;
}): void;

/**
* Closes the stream
*/
close(): void;
}
}
10 changes: 10 additions & 0 deletions src/@types/crypto-browserify/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ declare module 'crypto-browserify' {

/**
* Create cipher iv
* @param algorithm - Cipher algorithm
* @param key - Cipher key
* @param iv - Cipher iv
* @param options - Cipher options
* @returns Cipher
*/
export function createCipheriv(
algorithm: CipherGCMTypes,
Expand All @@ -21,6 +26,11 @@ declare module 'crypto-browserify' {

/**
* Create decipher iv
* @param algorithm - Cipher algorithm
* @param key - Cipher key
* @param iv - Cipher iv
* @param options - Cipher options
* @returns Decipher iv
*/
export function createDecipheriv(
algorithm: CipherGCMTypes,
Expand Down
3 changes: 3 additions & 0 deletions src/@types/streamsaver/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
declare module 'streamsaver' {
/**
* Create a write stream
* @param filename - Filename
* @param size - Size
* @returns WritableStream
*/
export function createWriteStream(
filename: string,
Expand Down
6 changes: 5 additions & 1 deletion src/@types/typedarray-to-buffer/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/** typedarray-to-buffer types */
/**
* typedarray-to-buffer types
* @param arr - Typed array
* @returns Buffer
*/
declare module 'typedarray-to-buffer' {
function toBuffer(arr: NodeJS.TypedArray): Buffer;

Expand Down
38 changes: 13 additions & 25 deletions src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const resolver = document.createElementNS(

/**
* Retrieve and decrypt files (batch job)
*
* @param resources - Resources
* @returns Penumbra files
*/
Expand Down Expand Up @@ -95,25 +94,24 @@ async function getJob(...resources: RemoteResource[]): Promise<PenumbraFile[]> {
*
* // Buffer all responses & read them as text
* await Promise.all((await penumbra.get(resources)).map(({ stream }) =>
* new Response(stream).text()
* new Response(stream).text()
* ));
*
* // Buffer a response & read as text
* await new Response((await penumbra.get(resource))[0].stream).text();
*
* // Example call with an included resource
* await penumbra.get({
* url: 'https://s3-us-west-2.amazonaws.com/bencmbrook/NYT.txt.enc',
* filePrefix: 'NYT',
* mimetype: 'text/plain',
* decryptionOptions: {
* key: 'vScyqmJKqGl73mJkuwm/zPBQk0wct9eQ5wPE8laGcWM=',
* iv: '6lNU+2vxJw6SFgse',
* authTag: 'gadZhS1QozjEmfmHLblzbg==',
* },
* url: 'https://s3-us-west-2.amazonaws.com/bencmbrook/NYT.txt.enc',
* filePrefix: 'NYT',
* mimetype: 'text/plain',
* decryptionOptions: {
* key: 'vScyqmJKqGl73mJkuwm/zPBQk0wct9eQ5wPE8laGcWM=',
* iv: '6lNU+2vxJw6SFgse',
* authTag: 'gadZhS1QozjEmfmHLblzbg==',
* },
* });
* ```
*
* @param resources - Resources to fetch
* @returns Penumbra files
*/
Expand All @@ -130,7 +128,6 @@ const MAX_ALLOWED_SIZE_MAIN_THREAD = 32 * 1024 * 1024; // 32 MiB

/**
* Save a zip containing files retrieved by Penumbra
*
* @param options - ZipOptions
* @returns PenumbraZipWriter class instance
*/
Expand All @@ -140,7 +137,6 @@ function saveZip(options?: ZipOptions): PenumbraZipWriter {

/**
* Save files retrieved by Penumbra
*
* @param files - Files to save
* @param fileName - The name of the file to save to
* @param controller - Controller
Expand Down Expand Up @@ -197,7 +193,6 @@ function save(

/**
* Load files retrieved by Penumbra into memory as a Blob
*
* @param files - Files to load
* @param type - Mimetype
* @returns A blob of the data
Expand Down Expand Up @@ -267,7 +262,6 @@ const trackJobCompletion = (
* ```ts
* penumbra.getDecryptionInfo(file: PenumbraEncryptedFile): Promise<PenumbraDecryptionInfo>
* ```
*
* @param file - File to get info for
* @returns Decryption info
*/
Expand All @@ -284,7 +278,6 @@ export function getDecryptionInfo(

/**
* Encrypt files (batch job)
*
* @param options - Options
* @param files - Files to operate on
* @returns Encrypted files
Expand Down Expand Up @@ -334,7 +327,6 @@ async function encryptJob(
* PenumbraWorkerAPI.encrypt calls require('./encrypt').encrypt()
* from the worker thread and starts reading the input stream from
* [remoteWritableStream.writable]
*
* @param thread - Thread
*/
(thread) => {
Expand Down Expand Up @@ -408,11 +400,10 @@ async function encryptJob(
* file = penumbra.encrypt(null, {stream: new Uint8Array(size), size});
* let data = [];
* file.then(async ([encrypted]) => {
* console.log('encryption started');
* data.push(new Uint8Array(await new Response(encrypted.stream).arrayBuffer()));
* console.log('encryption started');
* data.push(new Uint8Array(await new Response(encrypted.stream).arrayBuffer()));
* });
* ```
*
* @param options - Options
* @param files - Files
* @returns Encrypted files
Expand All @@ -428,7 +419,6 @@ export function encrypt(

/**
* Decrypt files encrypted by penumbra.encrypt() (batch job)
*
* @param options - Options
* @param files - Files
* @returns Penumbra files
Expand Down Expand Up @@ -539,11 +529,10 @@ async function decryptJob(
* file = penumbra.encrypt(null, {stream: new Uint8Array(size), size});
* let data = [];
* file.then(async ([encrypted]) => {
* console.log('encryption started');
* data.push(new Uint8Array(await new Response(encrypted.stream).arrayBuffer()));
* console.log('encryption started');
* data.push(new Uint8Array(await new Response(encrypted.stream).arrayBuffer()));
* });
* ```
*
* @param options - Options
* @param files - Files
* @returns Files
Expand All @@ -559,7 +548,6 @@ export function decrypt(

/**
* Get file text (if content is viewable) or URI (if content is not viewable)
*
* @param files - A list of files to get the text of
* @returns A list with the text itself or a URI encoding the file if applicable
*/
Expand Down
3 changes: 0 additions & 3 deletions src/decrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { emitJobCompletion, emitProgress, toBuff } from './utils';

/**
* Decrypts a readable stream
*
* @param stream - A readable stream of encrypted data
* @param decipher - The crypto module's decipher
* @param contentLength - The content length of the file, in bytes
Expand Down Expand Up @@ -71,7 +70,6 @@ export function decryptStream(
return new ReadableStream({
/**
* Controller
*
* @param controller - Controller
*/
start(controller) {
Expand Down Expand Up @@ -112,7 +110,6 @@ export function decryptStream(

/**
* Decrypts a file and returns a ReadableStream
*
* @param options - Options
* @param file - The remote resource to download
* @param size - Size
Expand Down
4 changes: 0 additions & 4 deletions src/encrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { logger } from './logger';

/**
* Encrypts a readable stream
*
* @param jobID - Job ID
* @param rs - A readable stream of encrypted data
* @param cipher - The crypto module's cipher
Expand Down Expand Up @@ -72,7 +71,6 @@ export function encryptStream(
return new ReadableStream({
/**
* Controller
*
* @param controller - Controller
*/
start(controller) {
Expand Down Expand Up @@ -116,7 +114,6 @@ export function encryptStream(

/**
* Encrypt a buffer
*
* @returns Buffer
*/
export function encryptBuffer(): ArrayBuffer {
Expand All @@ -130,7 +127,6 @@ const IV_RANDOMNESS = 12;

/**
* Encrypts a file and returns a ReadableStream
*
* @param options - Options
* @param file - The remote resource to download
* @param size - Size
Expand Down
2 changes: 0 additions & 2 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export class PenumbraError extends Error {

/**
* Extend new Error
*
* @param error - Error
* @param id - ID
*/
Expand All @@ -39,7 +38,6 @@ export class PenumbraError extends Error {

/**
* Error name
*
* @returns Name
*/
get [Symbol.toStringTag](): string {
Expand Down
1 change: 0 additions & 1 deletion src/fetchAndDecrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import emitError from './utils/emitError';

/**
* Fetches a remote file from a URL, deciphers it (if encrypted), and returns a ReadableStream
*
* @param resource - The remote resource to download
* @returns A readable stream of the deciphered file
*/
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Penumbra
* Fetch and decrypt files in the browser using whatwg streams and web workers.
*
* @module penumbra
* @author Transcend Inc. <https://transcend.io>
* @license Apache-2.0
Expand Down
Loading

1 comment on commit 3478e87

@vercel
Copy link

@vercel vercel bot commented on 3478e87 Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.