Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b56e40ea5b | ||
|
|
37d1bcb6eb | ||
|
|
f2b8c1fb4e | ||
|
|
92cc8fc4e3 | ||
|
|
701bd9335d | ||
|
|
d176c74715 | ||
|
|
0bf7c799f3 | ||
|
|
2f7d5cd4e1 | ||
|
|
c42b517293 | ||
|
|
e5dd55e419 |
@@ -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
@@ -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
|
||||
|
||||
@@ -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
@@ -9,5 +9,5 @@
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "3.3.1"
|
||||
"version": "3.4.1"
|
||||
}
|
||||
|
||||
+8
-5
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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,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": [
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user