From ec71003e7800d8e09b33a7313bce3af32853c8b4 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Fri, 12 Oct 2018 17:05:36 +0200 Subject: [PATCH] Add mnemonic support to keyring & util-crypto (#222) --- jest.config.js | 3 +- lerna.json | 2 +- packages/db/package.json | 6 +- packages/{util-keyring => keyring}/LICENSE | 2 +- packages/{util-keyring => keyring}/README.md | 8 +- .../{util-keyring => keyring}/docs/README.md | 0 .../{util-keyring => keyring}/docs/address.md | 0 .../{util-keyring => keyring}/docs/pair.md | 0 .../{util-keyring => keyring}/package.json | 10 +- .../src/address/decode.spec.js | 2 +- .../src/address/decode.ts | 2 +- .../src/address/encode.spec.js | 2 +- .../src/address/encode.ts | 2 +- .../src/address/index.ts | 2 +- .../src/index.spec.js | 8 +- .../{util-keyring => keyring}/src/index.ts | 10 +- .../src/pair/decode.spec.js | 2 +- .../src/pair/decode.ts | 2 +- .../src/pair/defaults.ts | 2 +- .../src/pair/encode.spec.js | 2 +- .../src/pair/encode.ts | 2 +- .../src/pair/getMeta.ts | 2 +- .../src/pair/index.spec.js | 2 +- .../src/pair/index.ts | 2 +- .../src/pair/nobody.ts | 2 +- .../src/pair/setMeta.ts | 2 +- .../src/pair/toJson.spec.js | 2 +- .../src/pair/toJson.ts | 2 +- .../src/pair/types.d.ts | 2 +- .../{util-keyring => keyring}/src/pairs.ts | 2 +- .../{util-keyring => keyring}/src/testing.ts | 2 +- .../src/testingPairs.spec.js | 2 +- .../src/testingPairs.ts | 2 +- .../{util-keyring => keyring}/src/types.d.ts | 3 +- packages/trie-db/package.json | 12 +- packages/trie-hash/package.json | 8 +- packages/util-crypto/package.json | 6 +- .../util-crypto/src/mnemonic/generate.spec.js | 18 ++ packages/util-crypto/src/mnemonic/generate.ts | 9 + .../util-crypto/src/mnemonic/toSecret.spec.js | 15 ++ packages/util-crypto/src/mnemonic/toSecret.ts | 12 ++ .../util-crypto/src/mnemonic/validate.spec.js | 19 ++ packages/util-crypto/src/mnemonic/validate.ts | 9 + packages/util-rlp/package.json | 4 +- packages/util/package.json | 2 +- yarn.lock | 180 +++++++++++++++++- 46 files changed, 326 insertions(+), 64 deletions(-) rename packages/{util-keyring => keyring}/LICENSE (91%) rename packages/{util-keyring => keyring}/README.md (69%) rename packages/{util-keyring => keyring}/docs/README.md (100%) rename packages/{util-keyring => keyring}/docs/address.md (100%) rename packages/{util-keyring => keyring}/docs/pair.md (100%) rename packages/{util-keyring => keyring}/package.json (82%) rename packages/{util-keyring => keyring}/src/address/decode.spec.js (95%) rename packages/{util-keyring => keyring}/src/address/decode.ts (94%) rename packages/{util-keyring => keyring}/src/address/encode.spec.js (90%) rename packages/{util-keyring => keyring}/src/address/encode.ts (93%) rename packages/{util-keyring => keyring}/src/address/index.ts (78%) rename packages/{util-keyring => keyring}/src/index.spec.js (87%) rename packages/{util-keyring => keyring}/src/index.ts (81%) rename packages/{util-keyring => keyring}/src/pair/decode.spec.js (89%) rename packages/{util-keyring => keyring}/src/pair/decode.ts (96%) rename packages/{util-keyring => keyring}/src/pair/defaults.ts (82%) rename packages/{util-keyring => keyring}/src/pair/encode.spec.js (90%) rename packages/{util-keyring => keyring}/src/pair/encode.ts (92%) rename packages/{util-keyring => keyring}/src/pair/getMeta.ts (81%) rename packages/{util-keyring => keyring}/src/pair/index.spec.js (95%) rename packages/{util-keyring => keyring}/src/pair/index.ts (96%) rename packages/{util-keyring => keyring}/src/pair/nobody.ts (94%) rename packages/{util-keyring => keyring}/src/pair/setMeta.ts (83%) rename packages/{util-keyring => keyring}/src/pair/toJson.spec.js (94%) rename packages/{util-keyring => keyring}/src/pair/toJson.ts (89%) rename packages/{util-keyring => keyring}/src/pair/types.d.ts (77%) rename packages/{util-keyring => keyring}/src/pairs.ts (95%) rename packages/{util-keyring => keyring}/src/testing.ts (94%) rename packages/{util-keyring => keyring}/src/testingPairs.spec.js (79%) rename packages/{util-keyring => keyring}/src/testingPairs.ts (90%) rename packages/{util-keyring => keyring}/src/types.d.ts (92%) create mode 100644 packages/util-crypto/src/mnemonic/generate.spec.js create mode 100644 packages/util-crypto/src/mnemonic/generate.ts create mode 100644 packages/util-crypto/src/mnemonic/toSecret.spec.js create mode 100644 packages/util-crypto/src/mnemonic/toSecret.ts create mode 100644 packages/util-crypto/src/mnemonic/validate.spec.js create mode 100644 packages/util-crypto/src/mnemonic/validate.ts diff --git a/jest.config.js b/jest.config.js index 6ef8a93fd..979d4440e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,8 +3,9 @@ const config = require('@polkadot/dev/config/jest'); module.exports = Object.assign({}, config, { moduleNameMapper: { '@polkadot/db(.*)$': '/packages/db/src/$1', + '@polkadot/keyring(.*)$': '/packages/keyring/src/$1', '@polkadot/trie-(db-old|db|hash)(.*)$': '/packages/trie-$1/src/$2', - '@polkadot/util-(crypto|keyring|rlp)(.*)$': '/packages/util-$1/src/$2', + '@polkadot/util-(crypto|rlp)(.*)$': '/packages/util-$1/src/$2', '@polkadot/util(.*)$': '/packages/util/src/$1' } }); diff --git a/lerna.json b/lerna.json index d1fe88c7c..34970b432 100644 --- a/lerna.json +++ b/lerna.json @@ -9,5 +9,5 @@ "packages": [ "packages/*" ], - "version": "0.30.7" + "version": "0.31.0" } diff --git a/packages/db/package.json b/packages/db/package.json index 1c8d852ac..8dd945514 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/db", - "version": "0.30.7", + "version": "0.31.0", "description": "Implementation of a basic sync in-memory and on-disk databases with overlays", "main": "index.js", "keywords": [ @@ -29,8 +29,8 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/db#readme", "dependencies": { "@babel/runtime": "^7.0.0", - "@polkadot/trie-hash": "^0.30.7", - "@polkadot/util": "^0.30.7", + "@polkadot/trie-hash": "^0.31.0", + "@polkadot/util": "^0.31.0", "@types/mkdirp": "^0.5.2", "@types/snappy": "^6.0.0", "lru_map": "^0.3.3", diff --git a/packages/util-keyring/LICENSE b/packages/keyring/LICENSE similarity index 91% rename from packages/util-keyring/LICENSE rename to packages/keyring/LICENSE index cad992556..9b0042066 100644 --- a/packages/util-keyring/LICENSE +++ b/packages/keyring/LICENSE @@ -1,6 +1,6 @@ ISC License (ISC) -Copyright 2017-2018 @polkadot/util-keyring authors & contributors +Copyright 2017-2018 @polkadot/keyring authors & contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/packages/util-keyring/README.md b/packages/keyring/README.md similarity index 69% rename from packages/util-keyring/README.md rename to packages/keyring/README.md index bc3aa7470..7b466e8c6 100644 --- a/packages/util-keyring/README.md +++ b/packages/keyring/README.md @@ -1,13 +1,13 @@ [![polkadotjs](https://img.shields.io/badge/polkadot-js-orange.svg?style=flat-square)](https://polkadot.js.org) ![isc](https://img.shields.io/badge/license-ISC-lightgrey.svg?style=flat-square) [![style](https://img.shields.io/badge/code%20style-semistandard-lightgrey.svg?style=flat-square)](https://github.com/Flet/semistandard) -[![npm](https://img.shields.io/npm/v/@polkadot/util-keyring.svg?style=flat-square)](https://www.npmjs.com/package/@polkadot/util-keyring) +[![npm](https://img.shields.io/npm/v/@polkadot/keyring.svg?style=flat-square)](https://www.npmjs.com/package/@polkadot/keyring) [![travis](https://img.shields.io/travis/polkadot-js/client.svg?style=flat-square)](https://travis-ci.org/polkadot-js/client) [![maintainability](https://img.shields.io/codeclimate/maintainability/polkadot-js/client.svg?style=flat-square)](https://codeclimate.com/github/polkadot-js/client/maintainability) [![coverage](https://img.shields.io/coveralls/polkadot-js/client.svg?style=flat-square)](https://coveralls.io/github/polkadot-js/client?branch=master) -[![dependency](https://david-dm.org/polkadot-js/client.svg?style=flat-square&path=packages/util-keyring)](https://david-dm.org/polkadot-js/client?path=packages/util-keyring) -[![devDependency](https://david-dm.org/polkadot-js/client/dev-status.svg?style=flat-square&path=packages/util-keyring)](https://david-dm.org/polkadot-js/client?path=packages/util-keyring#info=devDependencies) +[![dependency](https://david-dm.org/polkadot-js/client.svg?style=flat-square&path=packages/keyring)](https://david-dm.org/polkadot-js/client?path=packages/keyring) +[![devDependency](https://david-dm.org/polkadot-js/client/dev-status.svg?style=flat-square&path=packages/keyring)](https://david-dm.org/polkadot-js/client?path=packages/keyring#info=devDependencies) -# @polkadot/util-keyring +# @polkadot/keyring Key management diff --git a/packages/util-keyring/docs/README.md b/packages/keyring/docs/README.md similarity index 100% rename from packages/util-keyring/docs/README.md rename to packages/keyring/docs/README.md diff --git a/packages/util-keyring/docs/address.md b/packages/keyring/docs/address.md similarity index 100% rename from packages/util-keyring/docs/address.md rename to packages/keyring/docs/address.md diff --git a/packages/util-keyring/docs/pair.md b/packages/keyring/docs/pair.md similarity index 100% rename from packages/util-keyring/docs/pair.md rename to packages/keyring/docs/pair.md diff --git a/packages/util-keyring/package.json b/packages/keyring/package.json similarity index 82% rename from packages/util-keyring/package.json rename to packages/keyring/package.json index 279b69333..eeb57fb74 100644 --- a/packages/util-keyring/package.json +++ b/packages/keyring/package.json @@ -1,6 +1,6 @@ { - "name": "@polkadot/util-keyring", - "version": "0.30.7", + "name": "@polkadot/keyring", + "version": "0.31.0", "description": "Keyring management", "main": "index.js", "engines": { @@ -28,11 +28,11 @@ "bugs": { "url": "https://github.com/polkadot-js/client/issues" }, - "homepage": "https://github.com/polkadot-js/client/tree/master/packages/util-keyring#readme", + "homepage": "https://github.com/polkadot-js/client/tree/master/packages/keyring#readme", "dependencies": { "@babel/runtime": "^7.0.0", - "@polkadot/util": "^0.30.7", - "@polkadot/util-crypto": "^0.30.7", + "@polkadot/util": "^0.31.0", + "@polkadot/util-crypto": "^0.31.0", "@types/bs58": "^3.0.30", "bs58": "^4.0.1" } diff --git a/packages/util-keyring/src/address/decode.spec.js b/packages/keyring/src/address/decode.spec.js similarity index 95% rename from packages/util-keyring/src/address/decode.spec.js rename to packages/keyring/src/address/decode.spec.js index 3875810e2..ff8fc214d 100644 --- a/packages/util-keyring/src/address/decode.spec.js +++ b/packages/keyring/src/address/decode.spec.js @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. // @flow diff --git a/packages/util-keyring/src/address/decode.ts b/packages/keyring/src/address/decode.ts similarity index 94% rename from packages/util-keyring/src/address/decode.ts rename to packages/keyring/src/address/decode.ts index 349b68d28..43c5c91e7 100644 --- a/packages/util-keyring/src/address/decode.ts +++ b/packages/keyring/src/address/decode.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/address/encode.spec.js b/packages/keyring/src/address/encode.spec.js similarity index 90% rename from packages/util-keyring/src/address/encode.spec.js rename to packages/keyring/src/address/encode.spec.js index 0a98aade6..bb46e43ae 100644 --- a/packages/util-keyring/src/address/encode.spec.js +++ b/packages/keyring/src/address/encode.spec.js @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. // @flow diff --git a/packages/util-keyring/src/address/encode.ts b/packages/keyring/src/address/encode.ts similarity index 93% rename from packages/util-keyring/src/address/encode.ts rename to packages/keyring/src/address/encode.ts index e46a985a9..4af1d5492 100644 --- a/packages/util-keyring/src/address/encode.ts +++ b/packages/keyring/src/address/encode.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/address/index.ts b/packages/keyring/src/address/index.ts similarity index 78% rename from packages/util-keyring/src/address/index.ts rename to packages/keyring/src/address/index.ts index 1ac5ed760..befdb6d4e 100644 --- a/packages/util-keyring/src/address/index.ts +++ b/packages/keyring/src/address/index.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/index.spec.js b/packages/keyring/src/index.spec.js similarity index 87% rename from packages/util-keyring/src/index.spec.js rename to packages/keyring/src/index.spec.js index 2fcd5cfc2..1415e8f61 100644 --- a/packages/util-keyring/src/index.spec.js +++ b/packages/keyring/src/index.spec.js @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. @@ -26,6 +26,12 @@ describe('keypair', () => { ).toEqual(publicKeyTwo); }); + it('adds from a mnemonic', () => { + expect( + keypair.addFromMnemonic('seed sock milk update focus rotate barely fade car face mechanic mercy').address() + ).toEqual('5E2DuAdUMXXu8yvuydaEtcGBN6MFJpa9cCmvR1wh9WS3GLg4'); + }); + it('allows publicKeys retrieval', () => { keypair.addFromSeed(seedTwo); diff --git a/packages/util-keyring/src/index.ts b/packages/keyring/src/index.ts similarity index 81% rename from packages/util-keyring/src/index.ts rename to packages/keyring/src/index.ts index 68d403d07..2fa89fda3 100644 --- a/packages/util-keyring/src/index.ts +++ b/packages/keyring/src/index.ts @@ -1,9 +1,11 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. import { KeyringInstance, KeyringPair, KeyringPair$Json, KeyringPair$Meta } from './types'; +import mnemonicToSecret from '@polkadot/util-crypto/mnemonic/toSecret'; +import naclKeypairFromSecret from '@polkadot/util-crypto/nacl/keypair/fromSecret'; import naclKeypairFromSeed from '@polkadot/util-crypto/nacl/keypair/fromSeed'; import hexToU8a from '@polkadot/util/hex/toU8a'; @@ -31,6 +33,10 @@ export default class Keyring implements KeyringInstance { return this.addFromAddress(address, meta, hexToU8a(encoded)); } + addFromMnemonic (mnemonic: string, meta?: KeyringPair$Meta): KeyringPair { + return this.addPair(createPair(naclKeypairFromSecret(mnemonicToSecret(mnemonic)), meta)); + } + addFromSeed (seed: Uint8Array, meta?: KeyringPair$Meta): KeyringPair { return this.addPair(createPair(naclKeypairFromSeed(seed), meta)); } @@ -59,3 +65,5 @@ export default class Keyring implements KeyringInstance { return this._pairs.get(address).toJson(passphrase); } } + +export { Keyring }; diff --git a/packages/util-keyring/src/pair/decode.spec.js b/packages/keyring/src/pair/decode.spec.js similarity index 89% rename from packages/util-keyring/src/pair/decode.spec.js rename to packages/keyring/src/pair/decode.spec.js index 4ea5a1194..76a1d6eba 100644 --- a/packages/util-keyring/src/pair/decode.spec.js +++ b/packages/keyring/src/pair/decode.spec.js @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/decode.ts b/packages/keyring/src/pair/decode.ts similarity index 96% rename from packages/util-keyring/src/pair/decode.ts rename to packages/keyring/src/pair/decode.ts index 18423974b..d450d53ab 100644 --- a/packages/util-keyring/src/pair/decode.ts +++ b/packages/keyring/src/pair/decode.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/defaults.ts b/packages/keyring/src/pair/defaults.ts similarity index 82% rename from packages/util-keyring/src/pair/defaults.ts rename to packages/keyring/src/pair/defaults.ts index 8259bae1e..eaef11c77 100644 --- a/packages/util-keyring/src/pair/defaults.ts +++ b/packages/keyring/src/pair/defaults.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/encode.spec.js b/packages/keyring/src/pair/encode.spec.js similarity index 90% rename from packages/util-keyring/src/pair/encode.spec.js rename to packages/keyring/src/pair/encode.spec.js index fee935379..4b7c7b2bc 100644 --- a/packages/util-keyring/src/pair/encode.spec.js +++ b/packages/keyring/src/pair/encode.spec.js @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/encode.ts b/packages/keyring/src/pair/encode.ts similarity index 92% rename from packages/util-keyring/src/pair/encode.ts rename to packages/keyring/src/pair/encode.ts index ae61bc4cc..42ae39646 100644 --- a/packages/util-keyring/src/pair/encode.ts +++ b/packages/keyring/src/pair/encode.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/getMeta.ts b/packages/keyring/src/pair/getMeta.ts similarity index 81% rename from packages/util-keyring/src/pair/getMeta.ts rename to packages/keyring/src/pair/getMeta.ts index c7a0f815c..b1c0c1039 100644 --- a/packages/util-keyring/src/pair/getMeta.ts +++ b/packages/keyring/src/pair/getMeta.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/index.spec.js b/packages/keyring/src/pair/index.spec.js similarity index 95% rename from packages/util-keyring/src/pair/index.spec.js rename to packages/keyring/src/pair/index.spec.js index 997f585b9..3e3397160 100644 --- a/packages/util-keyring/src/pair/index.spec.js +++ b/packages/keyring/src/pair/index.spec.js @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/index.ts b/packages/keyring/src/pair/index.ts similarity index 96% rename from packages/util-keyring/src/pair/index.ts rename to packages/keyring/src/pair/index.ts index 20b14c0c2..c3bfe4e0f 100644 --- a/packages/util-keyring/src/pair/index.ts +++ b/packages/keyring/src/pair/index.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/nobody.ts b/packages/keyring/src/pair/nobody.ts similarity index 94% rename from packages/util-keyring/src/pair/nobody.ts rename to packages/keyring/src/pair/nobody.ts index d6face3b8..f7711d4da 100644 --- a/packages/util-keyring/src/pair/nobody.ts +++ b/packages/keyring/src/pair/nobody.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/setMeta.ts b/packages/keyring/src/pair/setMeta.ts similarity index 83% rename from packages/util-keyring/src/pair/setMeta.ts rename to packages/keyring/src/pair/setMeta.ts index 5cf5559d0..4ba71bb5e 100644 --- a/packages/util-keyring/src/pair/setMeta.ts +++ b/packages/keyring/src/pair/setMeta.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/toJson.spec.js b/packages/keyring/src/pair/toJson.spec.js similarity index 94% rename from packages/util-keyring/src/pair/toJson.spec.js rename to packages/keyring/src/pair/toJson.spec.js index bf77b08d2..1a6cf545a 100644 --- a/packages/util-keyring/src/pair/toJson.spec.js +++ b/packages/keyring/src/pair/toJson.spec.js @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/toJson.ts b/packages/keyring/src/pair/toJson.ts similarity index 89% rename from packages/util-keyring/src/pair/toJson.ts rename to packages/keyring/src/pair/toJson.ts index 8d5d78343..ce5c20006 100644 --- a/packages/util-keyring/src/pair/toJson.ts +++ b/packages/keyring/src/pair/toJson.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pair/types.d.ts b/packages/keyring/src/pair/types.d.ts similarity index 77% rename from packages/util-keyring/src/pair/types.d.ts rename to packages/keyring/src/pair/types.d.ts index 8cbac1f04..dcc22209e 100644 --- a/packages/util-keyring/src/pair/types.d.ts +++ b/packages/keyring/src/pair/types.d.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/pairs.ts b/packages/keyring/src/pairs.ts similarity index 95% rename from packages/util-keyring/src/pairs.ts rename to packages/keyring/src/pairs.ts index 12413c564..2a89df0e2 100644 --- a/packages/util-keyring/src/pairs.ts +++ b/packages/keyring/src/pairs.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/testing.ts b/packages/keyring/src/testing.ts similarity index 94% rename from packages/util-keyring/src/testing.ts rename to packages/keyring/src/testing.ts index 0f05dff5d..c56349780 100644 --- a/packages/util-keyring/src/testing.ts +++ b/packages/keyring/src/testing.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/testingPairs.spec.js b/packages/keyring/src/testingPairs.spec.js similarity index 79% rename from packages/util-keyring/src/testingPairs.spec.js rename to packages/keyring/src/testingPairs.spec.js index a52c5abcb..ec166c1b0 100644 --- a/packages/util-keyring/src/testingPairs.spec.js +++ b/packages/keyring/src/testingPairs.spec.js @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/testingPairs.ts b/packages/keyring/src/testingPairs.ts similarity index 90% rename from packages/util-keyring/src/testingPairs.ts rename to packages/keyring/src/testingPairs.ts index ac0ced00a..9a7fbd856 100644 --- a/packages/util-keyring/src/testingPairs.ts +++ b/packages/keyring/src/testingPairs.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. diff --git a/packages/util-keyring/src/types.d.ts b/packages/keyring/src/types.d.ts similarity index 92% rename from packages/util-keyring/src/types.d.ts rename to packages/keyring/src/types.d.ts index dd9dc5c30..574779e2b 100644 --- a/packages/util-keyring/src/types.d.ts +++ b/packages/keyring/src/types.d.ts @@ -1,4 +1,4 @@ -// Copyright 2017-2018 @polkadot/util-keyring authors & contributors +// Copyright 2017-2018 @polkadot/keyring authors & contributors // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. @@ -41,6 +41,7 @@ export interface KeyringPairs { export interface KeyringInstance { addPair (pair: KeyringPair): KeyringPair, addFromAddress (address: string | Uint8Array, meta?: KeyringPair$Meta): KeyringPair, + addFromMnemonic (mnemonic: string, meta?: KeyringPair$Meta): KeyringPair, addFromSeed (seed: Uint8Array, meta?: KeyringPair$Meta): KeyringPair, addFromJson (pair: KeyringPair$Json): KeyringPair, getPair (address: string | Uint8Array): KeyringPair, diff --git a/packages/trie-db/package.json b/packages/trie-db/package.json index dc932271c..92c68c7aa 100644 --- a/packages/trie-db/package.json +++ b/packages/trie-db/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/trie-db", - "version": "0.30.7", + "version": "0.31.0", "description": "This is an implementation of the modified merkle patricia tree as speficed in Ethereum's yellow paper, adpated for Polkadot", "main": "index.js", "keywords": [ @@ -29,13 +29,13 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/trie-db#readme", "dependencies": { "@babel/runtime": "^7.0.0", - "@polkadot/trie-hash": "^0.30.7", - "@polkadot/util": "^0.30.7", - "@polkadot/util-crypto": "^0.30.7", - "@polkadot/util-rlp": "^0.30.7" + "@polkadot/trie-hash": "^0.31.0", + "@polkadot/util": "^0.31.0", + "@polkadot/util-crypto": "^0.31.0", + "@polkadot/util-rlp": "^0.31.0" }, "devDependencies": { - "@polkadot/db": "^0.30.7", + "@polkadot/db": "^0.31.0", "ethereumjs-testing": "1.0.4" } } diff --git a/packages/trie-hash/package.json b/packages/trie-hash/package.json index 3285d0fc3..1ffe4e298 100644 --- a/packages/trie-hash/package.json +++ b/packages/trie-hash/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/trie-hash", - "version": "0.30.7", + "version": "0.31.0", "description": "Creation of triehash values", "main": "index.js", "keywords": [ @@ -29,8 +29,8 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/trie-hash#readme", "dependencies": { "@babel/runtime": "^7.0.0", - "@polkadot/util": "^0.30.7", - "@polkadot/util-crypto": "^0.30.7", - "@polkadot/util-rlp": "^0.30.7" + "@polkadot/util": "^0.31.0", + "@polkadot/util-crypto": "^0.31.0", + "@polkadot/util-rlp": "^0.31.0" } } diff --git a/packages/util-crypto/package.json b/packages/util-crypto/package.json index 166e43335..caf88217a 100644 --- a/packages/util-crypto/package.json +++ b/packages/util-crypto/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util-crypto", - "version": "0.30.7", + "version": "0.31.0", "description": "A collection of useful crypto utilities for @polkadot", "main": "index.js", "keywords": [ @@ -29,7 +29,9 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/util-crypto#readme", "dependencies": { "@babel/runtime": "^7.0.0", - "@polkadot/util": "^0.30.7", + "@polkadot/util": "^0.31.0", + "@types/bip39": "^2.4.0", + "bip39": "^2.5.0", "blakejs": "^1.1.0", "js-sha3": "^0.8.0", "tweetnacl": "^1.0.0", diff --git a/packages/util-crypto/src/mnemonic/generate.spec.js b/packages/util-crypto/src/mnemonic/generate.spec.js new file mode 100644 index 000000000..d9ab48c22 --- /dev/null +++ b/packages/util-crypto/src/mnemonic/generate.spec.js @@ -0,0 +1,18 @@ +// Copyright 2017-2018 @polkadot/util-crypto authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import generate from './generate'; +import validate from './validate'; + +describe('mnemonicGenerate', () => { + it('generates a valid mnemonic', () => { + const mnemonic = generate(); + + console.error(mnemonic); + + expect( + validate(mnemonic) + ).toEqual(true); + }); +}); diff --git a/packages/util-crypto/src/mnemonic/generate.ts b/packages/util-crypto/src/mnemonic/generate.ts new file mode 100644 index 000000000..85166f216 --- /dev/null +++ b/packages/util-crypto/src/mnemonic/generate.ts @@ -0,0 +1,9 @@ +// Copyright 2017-2018 @polkadot/util-crypto authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import { generateMnemonic } from 'bip39'; + +export default function mnemonicGenerate (): string { + return generateMnemonic(); +} diff --git a/packages/util-crypto/src/mnemonic/toSecret.spec.js b/packages/util-crypto/src/mnemonic/toSecret.spec.js new file mode 100644 index 000000000..3b66abf7d --- /dev/null +++ b/packages/util-crypto/src/mnemonic/toSecret.spec.js @@ -0,0 +1,15 @@ +// Copyright 2017-2018 @polkadot/util-crypto authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import toSecret from './toSecret'; + +describe('mnemonicToSecret', () => { + it('generates a valid seed', () => { + expect( + toSecret('basket actual') + ).toEqual(new Uint8Array([ + 92, 242, 212, 168, 176, 53, 94, 144, 41, 91, 223, 197, 101, 160, 34, 164, 9, 175, 6, 61, 83, 101, 187, 87, 191, 116, 217, 82, 143, 73, 75, 250, 68, 0, 245, 61, 131, 73, 184, 15, 218, 228, 64, 130, 215, 249, 84, 30, 29, 186, 43, 0, 59, 207, 236, 157, 13, 83, 120, 28, 166, 118, 101, 31 + ])); + }); +}); diff --git a/packages/util-crypto/src/mnemonic/toSecret.ts b/packages/util-crypto/src/mnemonic/toSecret.ts new file mode 100644 index 000000000..b50b500cb --- /dev/null +++ b/packages/util-crypto/src/mnemonic/toSecret.ts @@ -0,0 +1,12 @@ +// Copyright 2017-2018 @polkadot/util-crypto authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import { mnemonicToSeed } from 'bip39'; +import bufferToU8a from '@polkadot/util/buffer/toU8a'; + +export default function toSecret (mnemonic: string): Uint8Array { + return bufferToU8a( + mnemonicToSeed(mnemonic) + ); +} diff --git a/packages/util-crypto/src/mnemonic/validate.spec.js b/packages/util-crypto/src/mnemonic/validate.spec.js new file mode 100644 index 000000000..17e8dce16 --- /dev/null +++ b/packages/util-crypto/src/mnemonic/validate.spec.js @@ -0,0 +1,19 @@ +// Copyright 2017-2018 @polkadot/util-crypto authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import validate from './validate'; + +describe('mnemonicValidate', () => { + it('returns true on valid', () => { + expect( + validate('seed sock milk update focus rotate barely fade car face mechanic mercy') + ).toEqual(true); + }); + + it('returns false on invalid', () => { + expect( + validate('wine photo extra cushion basket dwarf humor cloud truck job boat submit') + ).toEqual(false); + }); +}); diff --git a/packages/util-crypto/src/mnemonic/validate.ts b/packages/util-crypto/src/mnemonic/validate.ts new file mode 100644 index 000000000..b0d85e97e --- /dev/null +++ b/packages/util-crypto/src/mnemonic/validate.ts @@ -0,0 +1,9 @@ +// Copyright 2017-2018 @polkadot/util-crypto authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import { validateMnemonic } from 'bip39'; + +export default function mnemonicValidate (mnemonic: string): boolean { + return validateMnemonic(mnemonic); +} diff --git a/packages/util-rlp/package.json b/packages/util-rlp/package.json index 5dd24209b..48d19d918 100644 --- a/packages/util-rlp/package.json +++ b/packages/util-rlp/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util-rlp", - "version": "0.30.7", + "version": "0.31.0", "description": "RLP encoding and decoding", "main": "index.js", "keywords": [ @@ -31,7 +31,7 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/trie-hash#readme", "dependencies": { "@babel/runtime": "^7.0.0", - "@polkadot/util": "^0.30.7" + "@polkadot/util": "^0.31.0" }, "devDependencies": { "ethereumjs-testing": "1.0.4" diff --git a/packages/util/package.json b/packages/util/package.json index 36abc4877..5bf1a5327 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util", - "version": "0.30.7", + "version": "0.31.0", "description": "A collection of useful utilities for @polkadot", "main": "index.js", "keywords": [ diff --git a/yarn.lock b/yarn.lock index 095760d6f..fe837a326 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1667,7 +1667,31 @@ babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: esutils "^2.0.2" js-tokens "^3.0.2" -babel-core@^6.0.0, babel-core@^7.0.0-bridge.0: +babel-core@^6.0.0, babel-core@^6.26.0: + version "6.26.3" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.3.tgz#b2e2f09e342d0f0c88e2f02e067794125e75c207" + dependencies: + babel-code-frame "^6.26.0" + babel-generator "^6.26.0" + babel-helpers "^6.24.1" + babel-messages "^6.23.0" + babel-register "^6.26.0" + babel-runtime "^6.26.0" + babel-template "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + convert-source-map "^1.5.1" + debug "^2.6.9" + json5 "^0.5.1" + lodash "^4.17.4" + minimatch "^3.0.4" + path-is-absolute "^1.0.1" + private "^0.1.8" + slash "^1.0.0" + source-map "^0.5.7" + +babel-core@^7.0.0-bridge.0: version "7.0.0-bridge.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" @@ -1695,6 +1719,26 @@ babel-generator@^6.18.0: source-map "^0.5.6" trim-right "^1.0.1" +babel-generator@^6.26.0: + version "6.26.1" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" + dependencies: + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.17.4" + source-map "^0.5.7" + trim-right "^1.0.1" + +babel-helpers@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-jest@^23.4.2: version "23.4.2" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-23.4.2.tgz#f276de67798a5d68f2d6e87ff518c2f6e1609877" @@ -1732,6 +1776,18 @@ babel-preset-jest@^23.2.0: babel-plugin-jest-hoist "^23.2.0" babel-plugin-syntax-object-rest-spread "^6.13.0" +babel-register@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.26.0.tgz#6ed021173e2fcb486d7acb45c6009a856f647071" + dependencies: + babel-core "^6.26.0" + babel-runtime "^6.26.0" + core-js "^2.5.0" + home-or-tmp "^2.0.0" + lodash "^4.17.4" + mkdirp "^0.5.1" + source-map-support "^0.4.15" + babel-runtime@^6.22.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" @@ -1739,7 +1795,7 @@ babel-runtime@^6.22.0, babel-runtime@^6.26.0: core-js "^2.4.0" regenerator-runtime "^0.11.0" -babel-template@^6.16.0: +babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" dependencies: @@ -1820,6 +1876,16 @@ bindings@~1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11" +bip39@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/bip39/-/bip39-2.5.0.tgz#51cbd5179460504a63ea3c000db3f787ca051235" + dependencies: + create-hash "^1.1.0" + pbkdf2 "^3.0.9" + randombytes "^2.0.1" + safe-buffer "^5.0.1" + unorm "^1.3.3" + bl@^1.0.0: version "1.2.2" resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.2.tgz#a160911717103c07410cef63ef51b397c025af9c" @@ -2219,6 +2285,13 @@ ci-info@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.2.tgz#03561259db48d0474c8bdc90f5b47b068b6bbfb4" +cipher-base@^1.0.1, cipher-base@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + circular-json@^0.3.1: version "0.3.3" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" @@ -2509,6 +2582,12 @@ convert-source-map@^1.1.0, convert-source-map@^1.4.0: version "1.5.1" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" +convert-source-map@^1.5.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" + dependencies: + safe-buffer "~5.1.1" + copy-concurrently@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0" @@ -2539,7 +2618,7 @@ core-js@^2.4.0: version "2.5.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b" -core-js@^2.5.7: +core-js@^2.5.0, core-js@^2.5.7: version "2.5.7" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" @@ -2571,6 +2650,27 @@ create-error-class@^3.0.0: dependencies: capture-stack-trace "^1.0.0" +create-hash@^1.1.0, create-hash@^1.1.2: + version "1.2.0" + resolved "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +create-hmac@^1.1.4: + version "1.1.7" + resolved "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + dependencies: + cipher-base "^1.0.3" + create-hash "^1.1.0" + inherits "^2.0.1" + ripemd160 "^2.0.0" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" @@ -2676,7 +2776,7 @@ debug@3.1.0, debug@^3.1.0: dependencies: ms "2.0.0" -debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8: +debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: @@ -3998,6 +4098,13 @@ has@^1.0.1: dependencies: function-bind "^1.0.2" +hash-base@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + hawk@3.1.3, hawk@~3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" @@ -4028,6 +4135,13 @@ hoek@4.x.x: version "4.2.0" resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" +home-or-tmp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.1" + home-or-tmp@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-3.0.0.tgz#57a8fe24cf33cdd524860a15821ddc25c86671fb" @@ -5064,7 +5178,7 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" -json5@^0.5.0: +json5@^0.5.0, json5@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" @@ -5460,6 +5574,14 @@ marked@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/marked/-/marked-0.4.0.tgz#9ad2c2a7a1791f10a852e0112f77b571dce10c66" +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + mdurl@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" @@ -6387,7 +6509,7 @@ os-locale@^2.0.0: lcid "^1.0.0" mem "^1.1.0" -os-tmpdir@^1.0.0, os-tmpdir@~1.0.1, os-tmpdir@~1.0.2: +os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -6596,7 +6718,7 @@ path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" -path-is-absolute@^1.0.0: +path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -6632,6 +6754,16 @@ path-type@^3.0.0: dependencies: pify "^3.0.0" +pbkdf2@^3.0.9: + version "3.0.17" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6" + dependencies: + create-hash "^1.1.2" + create-hmac "^1.1.4" + ripemd160 "^2.0.1" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + performance-now@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" @@ -6711,7 +6843,7 @@ pretty-format@^23.5.0: ansi-regex "^3.0.0" ansi-styles "^3.2.0" -private@^0.1.6: +private@^0.1.6, private@^0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" @@ -6859,6 +6991,12 @@ randomatic@^1.1.3: is-number "^3.0.0" kind-of "^4.0.0" +randombytes@^2.0.1: + version "2.0.6" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.6.tgz#d302c522948588848a8d300c932b44c24231da80" + dependencies: + safe-buffer "^5.1.0" + rc@^1.0.1, rc@^1.1.6: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" @@ -7440,6 +7578,13 @@ rimraf@~2.5.4: dependencies: glob "^7.0.5" +ripemd160@^2.0.0, ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" @@ -7556,6 +7701,13 @@ set-value@^2.0.0: is-plain-object "^2.0.3" split-string "^3.0.1" +sha.js@^2.4.0, sha.js@^2.4.8: + version "2.4.11" + resolved "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + sha@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/sha/-/sha-2.0.1.tgz#6030822fbd2c9823949f8f72ed6411ee5cf25aae" @@ -7720,6 +7872,12 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" +source-map-support@^0.4.15: + version "0.4.18" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" + dependencies: + source-map "^0.5.6" + source-map-support@^0.5.6: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13" @@ -7744,7 +7902,7 @@ source-map@^0.4.4: dependencies: amdefine ">=0.0.4" -source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.6: +source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1, source-map@~0.5.6: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -8457,6 +8615,10 @@ universalify@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" +unorm@^1.3.3: + version "1.4.1" + resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.4.1.tgz#364200d5f13646ca8bcd44490271335614792300" + unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"