Compare commits

...
6 Commits
Author SHA1 Message Date
Github Actions aceaa90466 [CI Skip] release/stable 3.2.4
skip-checks: true
2021-02-24 16:14:52 +00:00
Jaco Greeff 63622edcf4 Cleanup implicit dependencies, perform base64 decoding using base64-js (#178)
* Cleanup implicit dependencies, perform base64 decoding using base64-js

* base64 decoding

* lint

* remove extra call

* adjust
2021-02-24 17:09:06 +01:00
Github Actions 4a1c0563cb [CI Skip] release/stable 3.2.3
skip-checks: true
2021-02-16 10:55:04 +00:00
Jaco Greeff b34181f104 3.2.3 (#176) 2021-02-16 11:48:28 +01:00
Github Actions 141a067b85 [CI Skip] release/stable 3.2.2
skip-checks: true
2021-01-24 11:00:54 +00:00
Jaco Greeff 4c48d91f8e 3.2.2 (#175) 2021-01-24 11:55:09 +01:00
15 changed files with 1252 additions and 930 deletions
+4
View File
@@ -1 +1,5 @@
4
3.2.2
3.2.3
3.2.4
+21
View File
@@ -1,5 +1,26 @@
# CHANGELOG
## 3.2.4 Feb 24, 2021
Changes:
- Cleanup implicit dependencies, perform base64 decoding using base64-js
## 3.2.3 Feb 16, 2021
Changes:
- Change package detect import to use `.js` source, not `.json`
## 3.2.2 Jan 24, 2021
Changes:
- Remove `module` field in `package.json`
## 3.2.1 Jan 22, 2021
Contributed:
+5 -5
View File
@@ -7,7 +7,7 @@
"packages/*"
],
"resolutions": {
"typescript": "^4.1.3"
"typescript": "^4.1.5"
},
"scripts": {
"build": "yarn build:wasm",
@@ -23,10 +23,10 @@
"test:wasm:rust": "cd packages/wasm-crypto && RUST_BACKTRACE=full cargo test --release -- --nocapture"
},
"devDependencies": {
"@babel/core": "^7.12.10",
"@polkadot/dev": "^0.61.24",
"fflate": "^0.6.0",
"@babel/core": "^7.13.1",
"@polkadot/dev": "^0.61.27",
"fflate": "^0.6.4",
"override-require": "^1.1.1"
},
"version": "3.2.1"
"version": "3.2.4"
}
+2 -3
View File
@@ -1,10 +1,9 @@
{
"name": "@polkadot/wasm-crypto-asmjs",
"version": "3.2.1",
"version": "3.2.4",
"description": "Asm.js content for wasm-crypto",
"browser": "empty.js",
"main": "empty.js",
"module": "empty.mjs",
"react-native": "data.js",
"sideEffects": false,
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -14,6 +13,6 @@
"bugs": "https://github.com/polkadot-js/wasm/issues",
"homepage": "https://github.com/polkadot-js/wasm",
"dependencies": {
"@babel/runtime": "^7.12.5"
"@babel/runtime": "^7.13.7"
}
}
@@ -0,0 +1,6 @@
// Copyright 2017-2021 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', version: '3.2.4' };
+2 -3
View File
@@ -1,10 +1,9 @@
{
"name": "@polkadot/wasm-crypto-wasm",
"version": "3.2.1",
"version": "3.2.4",
"description": "Wasm content for wasm-crypto",
"browser": "data.js",
"main": "data.js",
"module": "data.mjs",
"react-native": "data.js",
"sideEffects": false,
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -14,6 +13,6 @@
"bugs": "https://github.com/polkadot-js/wasm/issues",
"homepage": "https://github.com/polkadot-js/wasm",
"dependencies": {
"@babel/runtime": "^7.12.5"
"@babel/runtime": "^7.13.7"
}
}
+85
View File
@@ -0,0 +1,85 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
// MIT License
//
// Copyright (c) 2014 Jameson Little
//
// https://github.com/beatgammit/base64-js/blob/88957c9943c7e2a0f03cdf73e71d579e433627d3/index.js
// This only contains the toByteArray function (no encoding)
//
// Only tweaks make here are some TS adjustments (we use strict null checks), the code is otherwise as-is with
// only the single required function provided
const CODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const lookup: string[] = [];
const revLookup: number[] = [];
for (let i = 0; i < CODE.length; ++i) {
lookup[i] = CODE[i];
revLookup[CODE.charCodeAt(i)] = i;
}
// Support decoding URL-safe base64 strings, as Node.js does.
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
revLookup['-'.charCodeAt(0)] = 62;
revLookup['_'.charCodeAt(0)] = 63;
function getLens (b64: string): [number, number] {
const len = b64.length;
if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4');
}
// Trim off extra bytes after placeholder bytes are found
// See: https://github.com/beatgammit/base64-js/issues/42
const validLen = b64.indexOf('=');
return validLen === -1
? [len, 0]
: [validLen, 4 - (validLen % 4)];
}
export function toByteArray (b64: string): Uint8Array {
const [validLen, placeHoldersLen] = getLens(b64);
const arr = new Uint8Array(((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen);
let curByte = 0;
let i;
// if there are placeholders, only get up to the last complete 4 chars
const len = placeHoldersLen > 0
? validLen - 4
: validLen;
for (i = 0; i < len; i += 4) {
const tmp =
(revLookup[b64.charCodeAt(i)] << 18) |
(revLookup[b64.charCodeAt(i + 1)] << 12) |
(revLookup[b64.charCodeAt(i + 2)] << 6) |
revLookup[b64.charCodeAt(i + 3)];
arr[curByte++] = (tmp >> 16) & 0xFF;
arr[curByte++] = (tmp >> 8) & 0xFF;
arr[curByte++] = tmp & 0xFF;
}
if (placeHoldersLen === 2) {
const tmp =
(revLookup[b64.charCodeAt(i)] << 2) |
(revLookup[b64.charCodeAt(i + 1)] >> 4);
arr[curByte++] = tmp & 0xFF;
} else if (placeHoldersLen === 1) {
const tmp =
(revLookup[b64.charCodeAt(i)] << 10) |
(revLookup[b64.charCodeAt(i + 1)] << 4) |
(revLookup[b64.charCodeAt(i + 2)] >> 2);
arr[curByte++] = (tmp >> 8) & 0xFF;
arr[curByte++] = tmp & 0xFF;
}
return arr;
}
@@ -1,7 +1,7 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const buffer = Buffer.from([]);
export const bytes = '';
export const sizeCompressed = 0;
+3 -2
View File
@@ -1,7 +1,8 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { buffer, sizeUncompressed } from './buffer';
import { toByteArray } from './base64';
import { bytes, sizeUncompressed } from './bytes';
import { unzlibSync } from './fflate';
export const wasmBytes = unzlibSync(buffer, new Uint8Array(sizeUncompressed));
export const wasmBytes = unzlibSync(toByteArray(bytes), new Uint8Array(sizeUncompressed));
@@ -0,0 +1,6 @@
// Copyright 2017-2021 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', version: '3.2.4' };
+6 -7
View File
@@ -1,21 +1,20 @@
{
"name": "@polkadot/wasm-crypto",
"version": "3.2.1",
"version": "3.2.4",
"author": "Jaco Greeff <jacogr@gmail.com>",
"main": "index.js",
"module": "index.mjs",
"sideEffects": [
"./detectPackage.js",
"./detectPackage.mjs"
],
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/wasm-crypto-asmjs": "^3.2.1",
"@polkadot/wasm-crypto-wasm": "^3.2.1"
"@babel/runtime": "^7.13.7",
"@polkadot/wasm-crypto-asmjs": "^3.2.4",
"@polkadot/wasm-crypto-wasm": "^3.2.4"
},
"devDependencies": {
"@polkadot/util": "^5.3.1",
"@polkadot/x-randomvalues": "^5.3.1"
"@polkadot/util": "^5.7.1",
"@polkadot/x-randomvalues": "^5.7.1"
},
"peerDependencies": {
"@polkadot/util": "*",
+1 -1
View File
@@ -18,7 +18,7 @@
import { detectPackage } from '@polkadot/util';
import packageInfo from './package-info.json';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname);
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2017-2021 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/wasm-crypto', version: '3.2.4' };
+5 -5
View File
@@ -33,16 +33,16 @@ fs.writeFileSync(`./${A_NAME}/build/data.mjs`, `${hdr(A_NAME)}
export { asmJsInit } from './data.js';
`);
fs.writeFileSync(`./${W_NAME}/build/buffer.mjs`, `${hdr(W_NAME)}
export { buffer, sizeCompressed, sizeUncompressed } from './buffer.js';
fs.writeFileSync(`./${W_NAME}/build/bytes.mjs`, `${hdr(W_NAME)}
export { bytes, sizeCompressed, sizeUncompressed } from './bytes.js';
`);
const { compressed, sizeUncompressed } = getWasmBuffer();
fs.writeFileSync(`./${W_NAME}/build/buffer.js`, `${hdr(W_NAME)}
fs.writeFileSync(`./${W_NAME}/build/bytes.js`, `${hdr(W_NAME)}
const sizeCompressed = ${compressed.length};
const sizeUncompressed = ${sizeUncompressed};
const buffer = Buffer.from('${compressed.toString('base64')}', 'base64');
const bytes = '${compressed.toString('base64')}';
module.exports = { buffer, sizeCompressed, sizeUncompressed };
module.exports = { bytes, sizeCompressed, sizeUncompressed };
`);
+1099 -903
View File
File diff suppressed because it is too large Load Diff