Compare commits

..
10 Commits
Author SHA1 Message Date
Github Actions b56e40ea5b [CI Skip] release/stable 3.4.1
skip-checks: true
2020-08-31 07:08:33 +00:00
Jaco Greeff 37d1bcb6eb 3.4 (#674) 2020-08-31 09:00:57 +02:00
Github Actions f2b8c1fb4e [CI Skip] release/beta 3.4.0-beta.3
skip-checks: true
2020-08-28 12:19:52 +00:00
Jaco Greeff 92cc8fc4e3 Add isWasm util (#673) 2020-08-28 14:12:22 +02:00
Github Actions 701bd9335d [CI Skip] release/beta 3.4.0-beta.2
skip-checks: true
2020-08-27 11:26:48 +00:00
Jaco Greeff d176c74715 Bump wasm to 1.4.1 (#672) 2020-08-27 13:19:36 +02:00
Github Actions 0bf7c799f3 [CI Skip] release/beta 3.4.0-beta.1
skip-checks: true
2020-08-26 08:52:16 +00:00
Jaco Greeff 2f7d5cd4e1 Bump deps (#670)
* Bump deps

* Bump crypto

* Bump berry

* Debump markdown plugin

* Explicit add of typedoc plugins

* Bump dev (typedoc exec)

* Bump md
2020-08-26 10:46:33 +02:00
Github Actions c42b517293 [CI Skip] release/beta 3.4.0-beta.0
skip-checks: true
2020-08-25 19:22:10 +00:00
Jaco Greeff e5dd55e419 Allow for WASM-as-available mnemonicToBip39 call (#669) 2020-08-25 21:16:22 +02:00
14 changed files with 468 additions and 363 deletions
+5
View File
@@ -7,5 +7,10 @@ module.exports = {
project: [
'./tsconfig.json'
]
},
rules: {
...base.rules,
// this seems very broken atm, false positives
'@typescript-eslint/unbound-method': 'off'
}
};
+1 -1
View File
@@ -8,4 +8,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.js
spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-2.1.1.js
yarnPath: .yarn/releases/yarn-2.1.1.cjs
+6
View File
@@ -1,5 +1,11 @@
# CHANGELOG
## 3.4.1 Aug 31, 2020
- Allow for WASM-as-available `mnemonicToBip39` call (used for Ethereum-compatible keypairs)
- Add `isWasm` utility to check for valid WASM headers
- `@polkadot/wasm-crypto` 1.4.1
## 3.3.1 Aug 24, 2020
- Add `addressRaw` to Keyring interface (if address encoding is different to publicKey)
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "3.3.1"
"version": "3.4.1"
}
+8 -5
View File
@@ -21,10 +21,13 @@
"test:one": "polkadot-dev-run-test"
},
"devDependencies": {
"@babel/core": "^7.11.1",
"@polkadot/dev": "^0.55.39",
"@polkadot/ts": "^0.3.39",
"@types/jest": "^26.0.10"
"@babel/core": "^7.11.4",
"@polkadot/dev": "^0.55.43",
"@polkadot/ts": "^0.3.40",
"@types/jest": "^26.0.10",
"typedoc": "^0.18.0",
"typedoc-plugin-markdown": "^2.4.2",
"typedoc-plugin-no-inherit": "^1.1.10"
},
"version": "3.3.1"
"version": "3.4.1"
}
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/keyring",
"version": "3.3.1",
"version": "3.4.1",
"description": "Keyring management",
"main": "index.js",
"publishConfig": {
@@ -28,7 +28,7 @@
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/keyring#readme",
"dependencies": {
"@babel/runtime": "^7.11.2",
"@polkadot/util": "3.3.1",
"@polkadot/util-crypto": "3.3.1"
"@polkadot/util": "3.4.1",
"@polkadot/util-crypto": "3.4.1"
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/util-crypto",
"version": "3.3.1",
"version": "3.4.1",
"description": "A collection of useful crypto utilities for @polkadot",
"main": "index.js",
"keywords": [
@@ -26,8 +26,8 @@
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util-crypto#readme",
"dependencies": {
"@babel/runtime": "^7.11.2",
"@polkadot/util": "3.3.1",
"@polkadot/wasm-crypto": "^1.3.1",
"@polkadot/util": "3.4.1",
"@polkadot/wasm-crypto": "^1.4.1",
"base-x": "^3.0.8",
"bip39": "^3.0.2",
"blakejs": "^1.1.0",
@@ -3,6 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util';
import { waitReady } from '@polkadot/wasm-crypto';
import { mnemonicToBip39 } from './';
@@ -14,4 +15,14 @@ describe('mnemonicToBip39Seed', (): void => {
)
).toEqual('0x3c121e20de068083b49c2315697fb59a2d9e8643c24e5ea7628132c58969a027');
});
it('generates the seed via WASM', async (): Promise<void> => {
await waitReady();
expect(
u8aToHex(
mnemonicToBip39('seed sock milk update focus rotate barely fade car face mechanic mercy')
)
).toEqual('0x3c121e20de068083b49c2315697fb59a2d9e8643c24e5ea7628132c58969a027');
});
});
+4 -6
View File
@@ -5,7 +5,7 @@
import { mnemonicToSeedSync } from 'bip39';
import { bufferToU8a } from '@polkadot/util';
// import { bip39ToSeed, isReady } from '@polkadot/wasm-crypto';
import { bip39ToSeed, isReady } from '@polkadot/wasm-crypto';
/**
* @name toSeed
@@ -25,9 +25,7 @@ import { bufferToU8a } from '@polkadot/util';
* ```
*/
export default function toBip39 (mnemonic: string, password = ''): Uint8Array {
// FIXMe Re-add when we have support in the WASM libs again
// return isReady()
// ? bip39ToSeed(mnemonic, password)
return bufferToU8a(mnemonicToSeedSync(mnemonic, password)).subarray(0, 32);
return isReady()
? bip39ToSeed(mnemonic, password)
: bufferToU8a(mnemonicToSeedSync(mnemonic, password)).subarray(0, 32);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/util",
"version": "3.3.1",
"version": "3.4.1",
"description": "A collection of useful utilities for @polkadot",
"main": "index.js",
"keywords": [
+1
View File
@@ -27,3 +27,4 @@ export { default as isToBn } from './toBn';
export { default as isU8a } from './u8a';
export { default as isUndefined } from './undefined';
export { default as isUtf8 } from './utf8';
export { default as isWasm } from './wasm';
+17
View File
@@ -0,0 +1,17 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import u8aEq from '../u8a/eq';
const WASM_MAGIC = new Uint8Array([0, 97, 115, 109]); // \0asm
/**
* @name isWasm
* @summary Tests if the input has a WASM header
* @description
* Checks to see if the input Uint8Array contains a valid WASM header
*/
export default function isWasm (value?: Uint8Array): boolean {
return !!value && u8aEq(value.subarray(0, 4), WASM_MAGIC);
}
+407 -343
View File
File diff suppressed because it is too large Load Diff