From 3acdb447873e7f92d9cb74cab3d723069adb9843 Mon Sep 17 00:00:00 2001 From: Bradley Hart Date: Fri, 13 Mar 2020 09:37:38 -0400 Subject: [PATCH 01/12] Renamed functions to match ecc method names, added missing ecc functions --- src/PrivateKey.ts | 16 ++++++++++++---- src/PublicKey.ts | 2 +- src/Signature.ts | 14 ++++++++------ src/eosjs-key-conversions.ts | 26 ++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/src/PrivateKey.ts b/src/PrivateKey.ts index d68923cf2..698e7a0b4 100644 --- a/src/PrivateKey.ts +++ b/src/PrivateKey.ts @@ -47,13 +47,14 @@ export class PrivateKey { } /** Retrieve the public key from a private key */ - public getPublicKey(): PublicKey { + public privateToPublic(): PublicKey { const ellipticPrivateKey = this.toElliptic(); return PublicKey.fromElliptic(ellipticPrivateKey, this.getType(), this.ec); } - /** Sign a message digest with private key */ - public sign(digest: BNInput): Signature { + /** Sign a message or hashed message digest with private key */ + public sign(data: BNInput, shouldHash: boolean = true, encoding: string = 'utf8'): Signature { + if (shouldHash) data = this.ec.hash().update(data, encoding).digest(); let tries = 0; let signature: Signature; const isCanonical = (sigData: Uint8Array) => @@ -61,7 +62,7 @@ export class PrivateKey { && !(sigData[33] & 0x80) && !(sigData[33] === 0 && !(sigData[34] & 0x80)); const constructSignature = (options: EC.SignOptions) => { const ellipticPrivateKey = this.toElliptic(); - const ellipticSignature = ellipticPrivateKey.sign(digest, options); + const ellipticSignature = ellipticPrivateKey.sign(data, options); return Signature.fromElliptic(ellipticSignature, this.getType(), this.ec); }; @@ -74,4 +75,11 @@ export class PrivateKey { } return signature; } + + /** Validate a private key */ + public isValidPrivate(): boolean { + const ellipticPrivateKey = this.toElliptic(); + const validationObj = ellipticPrivateKey.validate(); + return validationObj.result; + } } diff --git a/src/PublicKey.ts b/src/PublicKey.ts index efc165922..8abb50202 100644 --- a/src/PublicKey.ts +++ b/src/PublicKey.ts @@ -51,7 +51,7 @@ export class PublicKey { } /** Validate a public key */ - public validate(): boolean { + public isValidPublic(): boolean { const ellipticPublicKey = this.toElliptic(); const validationObj = ellipticPublicKey.validate(); return validationObj.result; diff --git a/src/Signature.ts b/src/Signature.ts index c3d39b768..c881619c3 100644 --- a/src/Signature.ts +++ b/src/Signature.ts @@ -85,18 +85,20 @@ export class Signature { return this.signature.type; } - /** Verify a signature with a message digest and public key */ - public verify(digest: BNInput, publicKey: PublicKey, encoding?: string): boolean { + /** Verify a signature with a message or hashed message digest and public key */ + public verify(data: BNInput, publicKey: PublicKey, shouldHash: boolean = true, encoding: string = 'utf8'): boolean { + if (shouldHash) data = this.ec.hash().update(data, encoding).digest(); const ellipticSignature = this.toElliptic(); const ellipticPublicKey = publicKey.toElliptic(); - return this.ec.verify(digest, ellipticSignature, ellipticPublicKey, encoding); + return this.ec.verify(data, ellipticSignature, ellipticPublicKey, encoding); } - /** Recover a public key from a message digest and signature */ - public recoverPublicKey(digest: BNInput, encoding?: string): PublicKey { + /** Recover a public key from a message or hashed message digest and signature */ + public recover(data: BNInput, shouldHash: boolean = true, encoding: string = 'utf8'): PublicKey { + if (shouldHash) data = this.ec.hash().update(data, encoding).digest(); const ellipticSignature = this.toElliptic(); const recoveredPublicKey = this.ec.recoverPubKey( - digest, + data, ellipticSignature, ellipticSignature.recoveryParam, encoding diff --git a/src/eosjs-key-conversions.ts b/src/eosjs-key-conversions.ts index f813a25c5..7219a48e1 100644 --- a/src/eosjs-key-conversions.ts +++ b/src/eosjs-key-conversions.ts @@ -1,5 +1,8 @@ import {ec as EC} from 'elliptic'; +import * as hash from 'hash.js'; import {KeyType} from './eosjs-numeric'; +import { PublicKey } from './PublicKey'; +import { PrivateKey } from './PrivateKey'; export { PrivateKey } from './PrivateKey'; export { PublicKey } from './PublicKey'; @@ -12,3 +15,26 @@ export const constructElliptic = (type: KeyType): EC => { } return new EC('p256') as any; }; + +export const generateKeyPair = (type: KeyType, options?: EC.GenKeyPairOptions): {publicKey: PublicKey, privateKey: PrivateKey} => { + if (process.env.EOSJS_KEYGEN_ALLOWED !== 'true') { + throw new Error('Key generation is completely INSECURE in production environments in the browser. ' + + 'If you are absolutely certain this does NOT describe your environment, add an environment variable ' + + '`EOSJS_KEYGEN_ALLOWED` set to \'true\'. If this does describe your environment and you add the ' + + 'environment variable, YOU DO SO AT YOUR OWN RISK AND THE RISK OF YOUR USERS.') + } + let ec; + if (type === KeyType.k1) { + ec = new EC('secp256k1') as any; + } else { + ec = new EC('p256') as any; + } + const ellipticKeyPair = ec.genKeyPair(options); + const publicKey = PublicKey.fromElliptic(ellipticKeyPair, type, ec); + const privateKey = PrivateKey.fromElliptic(ellipticKeyPair, type, ec); + return {publicKey, privateKey}; +}; + +export const sha256 = (data: string|Buffer, resultEncoding: 'hex'|undefined) => { + return hash.sha256().update(data).digest(resultEncoding); +}; From 69fe3ee8eaef9a69379c783e52ee8ecbd6c7cb14 Mon Sep 17 00:00:00 2001 From: Bradley Hart Date: Thu, 5 Mar 2020 11:02:53 -0500 Subject: [PATCH 02/12] ecc migration functions --- src/eosjs-ecc-migration.ts | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/eosjs-ecc-migration.ts diff --git a/src/eosjs-ecc-migration.ts b/src/eosjs-ecc-migration.ts new file mode 100644 index 000000000..50923ee0e --- /dev/null +++ b/src/eosjs-ecc-migration.ts @@ -0,0 +1,54 @@ +import { PrivateKey, PublicKey, Signature } from './eosjs-jssig'; + +export const ecc = { + initialize: () => console.error('Method deprecated'), + unsafeRandomKey: () => console.error('Method deprecated'), + randomKey: () => console.error('Method deprecated'), + seedPrivate: () => console.error('Method deprecated'), + privateToPublic: (key: string, pubkey_prefix: string = 'EOS'): string => { + if (pubkey_prefix) console.warn('Argument `pubkey_prefix` is deprecated, keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_'); + + const privateKey = PrivateKey.fromString(key); + const publicKey = privateKey.privateToPublic(); + return publicKey.toString(); + }, + isValidPublic: (pubkey: string, pubkey_prefix: string = 'EOS'): boolean => { + if (pubkey_prefix) console.warn('Argument `pubkey_prefix` is deprecated, keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_'); + + const publicKey = PublicKey.fromString(pubkey); + return publicKey.isValidPublic(); + }, + isValidPrivate: (wif: string): boolean => { + const privateKey = PrivateKey.fromString(wif); + return privateKey.isValidPrivate(); + }, + sign: (data: string|Buffer, privateKey: string|PrivateKey, encoding: string = 'utf8'): string => { + const privKey = typeof privateKey === 'string' ? PrivateKey.fromString(privateKey) : privateKey; + const signature = privKey.sign(data, true, encoding); + return signature.toString(); + }, + signHash: (dataSha256: string|Buffer, privateKey: string|PrivateKey, encoding: string = 'hex') => { + const privKey = typeof privateKey === 'string' ? PrivateKey.fromString(privateKey) : privateKey; + const signature = privKey.sign(dataSha256, false, encoding); + return signature.toString(); + }, + verify: (signature: string, data: string, pubKey: string|PublicKey, encoding: string = 'utf8', hashData: boolean = true): boolean => { + const publicKey = typeof pubKey === 'string' ? PublicKey.fromString(pubKey) : pubKey; + const sig = Signature.fromString(signature); + return sig.verify(data, publicKey, hashData, encoding); + }, + recover: (signature: string, data: string, encoding: string = 'utf8'): string => { + const sig = Signature.fromString(signature); + const publicKey = sig.recover(data, true, encoding); + return publicKey.toString(); + }, + recoverHash: (signature: string, dataSha256: string|Buffer, encoding: string = 'hex'): string => { + const sig = Signature.fromString(signature); + const publicKey = sig.recover(dataSha256, false, encoding); + return publicKey.toString(); + }, + sha256: (data: string|Buffer, resultEncoding?: 'hex', encoding: string = 'utf8'): string|Buffer => { + if (encoding) console.warn('Argument `encoding` is deprecated'); + return require('eosjs-key-conversions').sha256(data, resultEncoding); + } +}; From 0dd699fe72adeea48fa5a8c9cb8b11a4cd03e6e3 Mon Sep 17 00:00:00 2001 From: Bradley Hart Date: Fri, 13 Mar 2020 09:38:08 -0400 Subject: [PATCH 03/12] Adjusting to new method names and `toLegacyString()` method --- src/PublicKey.ts | 8 +++++++- src/eosjs-jssig.ts | 2 +- src/eosjs-numeric.ts | 18 ++++++++++++++++++ src/tests/eosjs-jssig.test.ts | 12 ++++++------ yarn.lock | 4 ++-- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/PublicKey.ts b/src/PublicKey.ts index 8abb50202..17870d257 100644 --- a/src/PublicKey.ts +++ b/src/PublicKey.ts @@ -1,7 +1,8 @@ -import { BNInput, ec as EC } from 'elliptic'; +import { ec as EC } from 'elliptic'; import { Key, KeyType, + publicKeyToLegacyString, publicKeyToString, stringToPublicKey, } from './eosjs-numeric'; @@ -38,6 +39,11 @@ export class PublicKey { return publicKeyToString(this.key); } + /** Export public key as Legacy EOSIO-format public key */ + public toLegacyString(): string { + return publicKeyToLegacyString(this.key); + } + /** Export public key as `elliptic`-format public key */ public toElliptic(): EC.KeyPair { return this.ec.keyPair({ diff --git a/src/eosjs-jssig.ts b/src/eosjs-jssig.ts index 4575498f0..2d5b8da29 100644 --- a/src/eosjs-jssig.ts +++ b/src/eosjs-jssig.ts @@ -47,7 +47,7 @@ class JsSignatureProvider implements SignatureProvider { for (const k of privateKeys) { const priv = PrivateKey.fromString(k); const privElliptic = priv.toElliptic(); - const pubStr = priv.getPublicKey().toString(); + const pubStr = priv.privateToPublic().toString(); this.keys.set(pubStr, privElliptic); this.availableKeys.push(pubStr); } diff --git a/src/eosjs-numeric.ts b/src/eosjs-numeric.ts index cf444ef4b..c6339e8a6 100644 --- a/src/eosjs-numeric.ts +++ b/src/eosjs-numeric.ts @@ -327,6 +327,24 @@ export function stringToPublicKey(s: string): Key { } } +export function publicKeyToLegacyString(key: Key) { + if (key.type === KeyType.k1 && key.data.length === publicKeyDataSize) { + const digest = new Uint8Array(digestSuffixRipemd160(key.data, '')); + const whole = new Uint8Array(key.data.length + 4); + for (let i = 0; i < key.data.length; ++i) { + whole[i] = key.data[i]; + } + for (let i = 0; i < 4; ++i) { + whole[i + key.data.length] = digest[i]; + } + return 'EOS' + binaryToBase58(whole); + } else if (key.type === KeyType.r1 || key.type === KeyType.wa) { + throw new Error('Key format not supported in legacy conversion'); + } else { + throw new Error('unrecognized public key format'); + } +} + /** Convert `key` to string (base-58) form */ export function publicKeyToString(key: Key) { if (key.type === KeyType.k1 && key.data.length === publicKeyDataSize) { diff --git a/src/tests/eosjs-jssig.test.ts b/src/tests/eosjs-jssig.test.ts index 808e8b948..ad6d0db4a 100644 --- a/src/tests/eosjs-jssig.test.ts +++ b/src/tests/eosjs-jssig.test.ts @@ -47,7 +47,7 @@ describe('JsSignatureProvider', () => { describe('secp256k1 elliptic', () => { it('Retrieves the public key from a private key', () => { const privateKey = PrivateKey.fromString(privateKeys[0]); - const publicKey = privateKey.getPublicKey(); + const publicKey = privateKey.privateToPublic(); expect(publicKey.toString()).toEqual(k1FormatPublicKeys[0]); }); @@ -138,7 +138,7 @@ describe('JsSignatureProvider', () => { it('verify that public key validate function correctly assesses public keys', () => { const publicKey = PublicKey.fromString(k1FormatPublicKeys[0]); - expect(publicKey.validate()).toEqual(true); + expect(publicKey.isValidPublic()).toEqual(true); }); it('Ensure elliptic sign, recover, verify flow works', () => { @@ -149,7 +149,7 @@ describe('JsSignatureProvider', () => { const dataAsString = 'some string'; const ellipticHashedString = ellipticEc.hash().update(dataAsString).digest(); const sig = KPriv.sign(ellipticHashedString); - const KPub = sig.recoverPublicKey(ellipticHashedString); + const KPub = sig.recover(ellipticHashedString); expect(KPub.toString()).toEqual(k1FormatPublicKeys[0]); const valid = sig.verify(ellipticHashedString, KPub); @@ -160,7 +160,7 @@ describe('JsSignatureProvider', () => { describe('p256 elliptic', () => { it('Retrieves the public key from a private key', () => { const privateKey = PrivateKey.fromString(privateKeysR1[0]); - const publicKey = privateKey.getPublicKey(); + const publicKey = privateKey.privateToPublic(); expect(publicKey.toString()).toEqual(r1FormatPublicKeys[0]); }); @@ -245,7 +245,7 @@ describe('JsSignatureProvider', () => { it('verify that public key validate function correctly assesses public keys', () => { const publicKey = PublicKey.fromString(r1FormatPublicKeys[0]); - expect(publicKey.validate()).toEqual(true); + expect(publicKey.isValidPublic()).toEqual(true); }); it('Ensure elliptic sign, recover, verify flow works', () => { @@ -256,7 +256,7 @@ describe('JsSignatureProvider', () => { const dataAsString = 'some string'; const ellipticHashedString = ellipticEc.hash().update(dataAsString).digest(); const sig = KPriv.sign(ellipticHashedString); - const KPub = sig.recoverPublicKey(ellipticHashedString); + const KPub = sig.recover(ellipticHashedString); expect(KPub.toString()).toEqual(r1FormatPublicKeys[0]); const valid = sig.verify(ellipticHashedString, KPub); diff --git a/yarn.lock b/yarn.lock index 7885ff81e..ea40a47ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2629,7 +2629,7 @@ enhanced-resolve@^4.0.0, enhanced-resolve@^4.1.0: memory-fs "^0.5.0" tapable "^1.0.0" -eosjs-ecc@^4.0.7: +eosjs-ecc@4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/eosjs-ecc/-/eosjs-ecc-4.0.7.tgz#f5246da3b84839fcc237204768ef6e5ea56cc814" integrity sha512-uuqhqnrDy9XTpKfkhiZqRDUTCCI9oWBalVK5IosL7kpYwA9I3lm68INYFLyWsHpF2xwHqPql8MrMYJ3zfOn5Qg== @@ -3359,7 +3359,7 @@ hash-base@^3.0.0: inherits "^2.0.1" safe-buffer "^5.0.1" -hash.js@^1.0.0, hash.js@^1.0.3: +hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== From 466788aa76f3b57db6314575297cc4b86678d22e Mon Sep 17 00:00:00 2001 From: Bradley Hart Date: Thu, 5 Mar 2020 15:21:08 -0500 Subject: [PATCH 04/12] Fixing linting issues and adding generateKeyPair to ecc migration file --- src/PrivateKey.ts | 4 +++- src/Signature.ts | 8 ++++++-- src/eosjs-ecc-migration.ts | 36 ++++++++++++++++++++++++++++-------- src/eosjs-key-conversions.ts | 7 ++++--- src/eosjs-numeric.ts | 11 ++--------- 5 files changed, 43 insertions(+), 23 deletions(-) diff --git a/src/PrivateKey.ts b/src/PrivateKey.ts index 698e7a0b4..f951537c2 100644 --- a/src/PrivateKey.ts +++ b/src/PrivateKey.ts @@ -54,7 +54,9 @@ export class PrivateKey { /** Sign a message or hashed message digest with private key */ public sign(data: BNInput, shouldHash: boolean = true, encoding: string = 'utf8'): Signature { - if (shouldHash) data = this.ec.hash().update(data, encoding).digest(); + if (shouldHash) { + data = this.ec.hash().update(data, encoding).digest(); + } let tries = 0; let signature: Signature; const isCanonical = (sigData: Uint8Array) => diff --git a/src/Signature.ts b/src/Signature.ts index c881619c3..d82cc40ec 100644 --- a/src/Signature.ts +++ b/src/Signature.ts @@ -87,7 +87,9 @@ export class Signature { /** Verify a signature with a message or hashed message digest and public key */ public verify(data: BNInput, publicKey: PublicKey, shouldHash: boolean = true, encoding: string = 'utf8'): boolean { - if (shouldHash) data = this.ec.hash().update(data, encoding).digest(); + if (shouldHash) { + data = this.ec.hash().update(data, encoding).digest(); + } const ellipticSignature = this.toElliptic(); const ellipticPublicKey = publicKey.toElliptic(); return this.ec.verify(data, ellipticSignature, ellipticPublicKey, encoding); @@ -95,7 +97,9 @@ export class Signature { /** Recover a public key from a message or hashed message digest and signature */ public recover(data: BNInput, shouldHash: boolean = true, encoding: string = 'utf8'): PublicKey { - if (shouldHash) data = this.ec.hash().update(data, encoding).digest(); + if (shouldHash) { + data = this.ec.hash().update(data, encoding).digest(); + } const ellipticSignature = this.toElliptic(); const recoveredPublicKey = this.ec.recoverPubKey( data, diff --git a/src/eosjs-ecc-migration.ts b/src/eosjs-ecc-migration.ts index 50923ee0e..658072675 100644 --- a/src/eosjs-ecc-migration.ts +++ b/src/eosjs-ecc-migration.ts @@ -1,19 +1,35 @@ -import { PrivateKey, PublicKey, Signature } from './eosjs-jssig'; +import {PrivateKey, PublicKey, Signature} from './eosjs-jssig'; +import {generateKeyPair} from './eosjs-key-conversions'; +import {KeyType} from './eosjs-numeric'; export const ecc = { initialize: () => console.error('Method deprecated'), unsafeRandomKey: () => console.error('Method deprecated'), - randomKey: () => console.error('Method deprecated'), + randomKey: (cpuEntropyBits: number = 0): Promise => { + if (cpuEntropyBits) { + console.warn('Argument `cpuEntropyBits` is deprecated, ' + + 'use the options argument instead'); + } + + const { privateKey } = generateKeyPair(KeyType.k1); + return Promise.resolve(privateKey.toString()); + }, seedPrivate: () => console.error('Method deprecated'), - privateToPublic: (key: string, pubkey_prefix: string = 'EOS'): string => { - if (pubkey_prefix) console.warn('Argument `pubkey_prefix` is deprecated, keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_'); + privateToPublic: (key: string, pubkey_prefix: string = 'EOS'): string => { // tslint:disable-line + if (pubkey_prefix) { + console.warn('Argument `pubkey_prefix` is deprecated, ' + + 'keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_ going forward'); + } const privateKey = PrivateKey.fromString(key); const publicKey = privateKey.privateToPublic(); return publicKey.toString(); }, - isValidPublic: (pubkey: string, pubkey_prefix: string = 'EOS'): boolean => { - if (pubkey_prefix) console.warn('Argument `pubkey_prefix` is deprecated, keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_'); + isValidPublic: (pubkey: string, pubkey_prefix: string = 'EOS'): boolean => { // tslint:disable-line + if (pubkey_prefix) { + console.warn('Argument `pubkey_prefix` is deprecated, ' + + 'keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_ going forward'); + } const publicKey = PublicKey.fromString(pubkey); return publicKey.isValidPublic(); @@ -32,7 +48,9 @@ export const ecc = { const signature = privKey.sign(dataSha256, false, encoding); return signature.toString(); }, - verify: (signature: string, data: string, pubKey: string|PublicKey, encoding: string = 'utf8', hashData: boolean = true): boolean => { + verify: ( + signature: string, data: string, pubKey: string|PublicKey, encoding: string = 'utf8', hashData: boolean = true + ): boolean => { const publicKey = typeof pubKey === 'string' ? PublicKey.fromString(pubKey) : pubKey; const sig = Signature.fromString(signature); return sig.verify(data, publicKey, hashData, encoding); @@ -48,7 +66,9 @@ export const ecc = { return publicKey.toString(); }, sha256: (data: string|Buffer, resultEncoding?: 'hex', encoding: string = 'utf8'): string|Buffer => { - if (encoding) console.warn('Argument `encoding` is deprecated'); + if (encoding) { + console.warn('Argument `encoding` is deprecated'); + } return require('eosjs-key-conversions').sha256(data, resultEncoding); } }; diff --git a/src/eosjs-key-conversions.ts b/src/eosjs-key-conversions.ts index 7219a48e1..7308204f7 100644 --- a/src/eosjs-key-conversions.ts +++ b/src/eosjs-key-conversions.ts @@ -16,12 +16,13 @@ export const constructElliptic = (type: KeyType): EC => { return new EC('p256') as any; }; -export const generateKeyPair = (type: KeyType, options?: EC.GenKeyPairOptions): {publicKey: PublicKey, privateKey: PrivateKey} => { +export const generateKeyPair = (type: KeyType, options?: EC.GenKeyPairOptions): + {publicKey: PublicKey, privateKey: PrivateKey} => { if (process.env.EOSJS_KEYGEN_ALLOWED !== 'true') { throw new Error('Key generation is completely INSECURE in production environments in the browser. ' + 'If you are absolutely certain this does NOT describe your environment, add an environment variable ' + '`EOSJS_KEYGEN_ALLOWED` set to \'true\'. If this does describe your environment and you add the ' + - 'environment variable, YOU DO SO AT YOUR OWN RISK AND THE RISK OF YOUR USERS.') + 'environment variable, YOU DO SO AT YOUR OWN RISK AND THE RISK OF YOUR USERS.'); } let ec; if (type === KeyType.k1) { @@ -36,5 +37,5 @@ export const generateKeyPair = (type: KeyType, options?: EC.GenKeyPairOptions): }; export const sha256 = (data: string|Buffer, resultEncoding: 'hex'|undefined) => { - return hash.sha256().update(data).digest(resultEncoding); + return hash.sha256().update(data).digest(resultEncoding); }; diff --git a/src/eosjs-numeric.ts b/src/eosjs-numeric.ts index c6339e8a6..a35d3e1ff 100644 --- a/src/eosjs-numeric.ts +++ b/src/eosjs-numeric.ts @@ -327,17 +327,10 @@ export function stringToPublicKey(s: string): Key { } } +/** Convert `key` to legacy string (base-58) form */ export function publicKeyToLegacyString(key: Key) { if (key.type === KeyType.k1 && key.data.length === publicKeyDataSize) { - const digest = new Uint8Array(digestSuffixRipemd160(key.data, '')); - const whole = new Uint8Array(key.data.length + 4); - for (let i = 0; i < key.data.length; ++i) { - whole[i] = key.data[i]; - } - for (let i = 0; i < 4; ++i) { - whole[i + key.data.length] = digest[i]; - } - return 'EOS' + binaryToBase58(whole); + return keyToString(key, '', 'EOS'); } else if (key.type === KeyType.r1 || key.type === KeyType.wa) { throw new Error('Key format not supported in legacy conversion'); } else { From 33bf70e471ad5c8e1cb99fc1a4b5c4ec45d7e913 Mon Sep 17 00:00:00 2001 From: Bradley Hart Date: Thu, 5 Mar 2020 16:46:01 -0500 Subject: [PATCH 05/12] tests for new functions --- src/eosjs-key-conversions.ts | 2 +- src/tests/eosjs-jssig.test.ts | 85 ++++++++++++++++++++++++++++++----- 2 files changed, 74 insertions(+), 13 deletions(-) diff --git a/src/eosjs-key-conversions.ts b/src/eosjs-key-conversions.ts index 7308204f7..9cb3c6555 100644 --- a/src/eosjs-key-conversions.ts +++ b/src/eosjs-key-conversions.ts @@ -36,6 +36,6 @@ export const generateKeyPair = (type: KeyType, options?: EC.GenKeyPairOptions): return {publicKey, privateKey}; }; -export const sha256 = (data: string|Buffer, resultEncoding: 'hex'|undefined) => { +export const sha256 = (data: string|Buffer, resultEncoding?: 'hex') => { return hash.sha256().update(data).digest(resultEncoding); }; diff --git a/src/tests/eosjs-jssig.test.ts b/src/tests/eosjs-jssig.test.ts index ad6d0db4a..75d034cd5 100644 --- a/src/tests/eosjs-jssig.test.ts +++ b/src/tests/eosjs-jssig.test.ts @@ -1,12 +1,9 @@ -import { ec } from 'elliptic'; +import {ec} from 'elliptic'; -import { Signature, PrivateKey, PublicKey } from '../eosjs-key-conversions'; -import { - JsSignatureProvider, - digestFromSerializedData -} from '../eosjs-jssig'; -import { KeyType } from '../eosjs-numeric'; -import { SignatureProviderArgs } from '../eosjs-api-interfaces'; +import {generateKeyPair, PrivateKey, PublicKey, sha256, Signature} from '../eosjs-key-conversions'; +import {digestFromSerializedData, JsSignatureProvider} from '../eosjs-jssig'; +import {KeyType} from '../eosjs-numeric'; +import {SignatureProviderArgs} from '../eosjs-api-interfaces'; describe('JsSignatureProvider', () => { const privateKeys = [ @@ -45,6 +42,20 @@ describe('JsSignatureProvider', () => { // These are simplified tests simply to verify a refactor didn't mess with existing code describe('secp256k1 elliptic', () => { + it('generates a private and public key pair', () => { + process.env.EOSJS_KEYGEN_ALLOWED = 'true'; + const {privateKey, publicKey} = generateKeyPair(KeyType.k1); + expect(privateKey).toBeInstanceOf(PrivateKey); + expect(privateKey.isValidPrivate()).toBeTruthy(); + expect(publicKey).toBeInstanceOf(PublicKey); + expect(publicKey.isValidPublic()).toBeTruthy(); + }); + + it('throws error with no EOSJS_KEYGEN_ALLOWED environment variable', () => { + process.env.EOSJS_KEYGEN_ALLOWED = null; + expect(() => generateKeyPair(KeyType.k1)).toThrowError(); + }); + it('Retrieves the public key from a private key', () => { const privateKey = PrivateKey.fromString(privateKeys[0]); const publicKey = privateKey.privateToPublic(); @@ -128,6 +139,13 @@ describe('JsSignatureProvider', () => { expect(PublicKey.fromElliptic(ellipticPubKey, KeyType.k1).toString()).toEqual(k1FormatPublicKeys[0]); }); + it('verify that toLegacyString() and toString() are consistent', () => { + const pubKeyFromK1 = PublicKey.fromString(k1FormatPublicKeys[0]); + const pubKeyFromLegacy = PublicKey.fromString(legacyPublicKeys[0]); + expect(pubKeyFromK1.toLegacyString()).toEqual(legacyPublicKeys[0]); + expect(pubKeyFromLegacy.toString()).toEqual(k1FormatPublicKeys[0]); + }); + it('ensure private key functions are actual inverses of each other', async () => { const priv = privateKeys[0]; const privEosioKey = PrivateKey.fromString(priv); @@ -142,12 +160,11 @@ describe('JsSignatureProvider', () => { }); it('Ensure elliptic sign, recover, verify flow works', () => { - const ellipticEc = new ec('secp256k1'); const KPrivStr = privateKeys[0]; const KPriv = PrivateKey.fromString(KPrivStr); const dataAsString = 'some string'; - const ellipticHashedString = ellipticEc.hash().update(dataAsString).digest(); + const ellipticHashedString = sha256(dataAsString, 'hex'); const sig = KPriv.sign(ellipticHashedString); const KPub = sig.recover(ellipticHashedString); @@ -155,9 +172,41 @@ describe('JsSignatureProvider', () => { const valid = sig.verify(ellipticHashedString, KPub); expect(valid).toEqual(true); }); + + it('Ensure elliptic sign, recover, verify flow works with shouldHash', () => { + const KPrivStr = privateKeys[0]; + const KPriv = PrivateKey.fromString(KPrivStr); + + const dataAsString = 'some string'; + const sig = KPriv.sign(dataAsString, true); + const KPub = sig.recover(dataAsString, true); + + expect(KPub.toString()).toEqual(k1FormatPublicKeys[0]); + const valid = sig.verify(dataAsString, KPub, true); + expect(valid).toEqual(true); + }); }); describe('p256 elliptic', () => { + it('generates a private and public key pair', () => { + process.env.EOSJS_KEYGEN_ALLOWED = 'true'; + const {privateKey, publicKey} = generateKeyPair(KeyType.r1); + expect(privateKey).toBeInstanceOf(PrivateKey); + expect(privateKey.isValidPrivate()).toBeTruthy(); + expect(publicKey).toBeInstanceOf(PublicKey); + expect(publicKey.isValidPublic()).toBeTruthy(); + }); + + it('throws error with no EOSJS_KEYGEN_ALLOWED environment variable', () => { + process.env.EOSJS_KEYGEN_ALLOWED = null; + expect(() => generateKeyPair(KeyType.r1)).toThrowError(); + }); + + it('throws error when attempting a legacy key from r1 format', () => { + const publicKey = PublicKey.fromString(r1FormatPublicKeys[0]); + expect(() => publicKey.toLegacyString()).toThrowError('Key format not supported in legacy conversion'); + }); + it('Retrieves the public key from a private key', () => { const privateKey = PrivateKey.fromString(privateKeysR1[0]); const publicKey = privateKey.privateToPublic(); @@ -249,12 +298,11 @@ describe('JsSignatureProvider', () => { }); it('Ensure elliptic sign, recover, verify flow works', () => { - const ellipticEc = new ec('p256'); const KPrivStr = privateKeysR1[0]; const KPriv = PrivateKey.fromString(KPrivStr); const dataAsString = 'some string'; - const ellipticHashedString = ellipticEc.hash().update(dataAsString).digest(); + const ellipticHashedString = sha256(dataAsString, 'hex'); const sig = KPriv.sign(ellipticHashedString); const KPub = sig.recover(ellipticHashedString); @@ -262,5 +310,18 @@ describe('JsSignatureProvider', () => { const valid = sig.verify(ellipticHashedString, KPub); expect(valid).toEqual(true); }); + + it('Ensure elliptic sign, recover, verify flow works with shouldHash', () => { + const KPrivStr = privateKeysR1[0]; + const KPriv = PrivateKey.fromString(KPrivStr); + + const dataAsString = 'some string'; + const sig = KPriv.sign(dataAsString, true); + const KPub = sig.recover(dataAsString, true); + + expect(KPub.toString()).toEqual(r1FormatPublicKeys[0]); + const valid = sig.verify(dataAsString, KPub, true); + expect(valid).toEqual(true); + }); }); }); From 8127e9afaf7556fa25c5a73b0d9b1fc3714a51ff Mon Sep 17 00:00:00 2001 From: Bradley Hart Date: Thu, 5 Mar 2020 16:47:18 -0500 Subject: [PATCH 06/12] Removing stress test file, it is comparably same as other ecc test file --- .../eosjs-ecc-verification-stress.test.js | 145 ------------------ 1 file changed, 145 deletions(-) delete mode 100644 src/tests/eosjs-ecc-verification-stress.test.js diff --git a/src/tests/eosjs-ecc-verification-stress.test.js b/src/tests/eosjs-ecc-verification-stress.test.js deleted file mode 100644 index d55adf9bc..000000000 --- a/src/tests/eosjs-ecc-verification-stress.test.js +++ /dev/null @@ -1,145 +0,0 @@ -// eosjs-ecc stuff -const ecc = require('eosjs-ecc') - -const { ec } = require('elliptic'); - -const { Signature, PrivateKey, PublicKey } = require('../eosjs-key-conversions'); -const { - JsSignatureProvider, -} = require('../eosjs-jssig'); -const { KeyType } = require('../eosjs-numeric'); -const { SignatureProviderArgs } = require('../eosjs-api-interfaces'); - -describe('JsSignatureProvider', () => { - const privateKeys = [ - '5Juww5SS6aLWxopXBAWzwqrwadiZKz7XpKAiktXTKcfBGi1DWg8', - '5JnHjSFwe4r7xyqAUAaVs51G7HmzE86DWGa3VAA5VvQriGYnSUr', - '5K4XZH5XR2By7Q5KTcZnPAmUMU5yjUNBdoKzzXyrLfmiEZJqoKE', - ]; - const legacyPublicKeys = [ - 'EOS7tgwU6E7pAUQJgqEJt66Yi8cWvanTUW8ZfBjeXeJBQvhTU9ypi', - 'EOS8VaY5CiTexYqgQZyPTJkc3qvWuZUi12QrZL9ssjqW2es6aQk2F', - 'EOS7VGhqctkKprW1VUj19DZZiiZLX3YcJqUJCuEcahJmUCw3wJEMu', - ]; - const k1FormatPublicKeys = [ - 'PUB_K1_7tgwU6E7pAUQJgqEJt66Yi8cWvanTUW8ZfBjeXeJBQvhYTBFvY', - 'PUB_K1_8VaY5CiTexYqgQZyPTJkc3qvWuZUi12QrZL9ssjqW2es7e7bRJ', - 'PUB_K1_7VGhqctkKprW1VUj19DZZiiZLX3YcJqUJCuEcahJmUCw9RT8v2', - ]; - const signatures = [ - 'SIG_K1_HKkqi3zray76i63ZQwAHWMjoLk3wTa1ajZWPcUnrhgmSWQYEHDJsxkny6VDTWEmVdfktxpGoTA81qe6QuCrDmazeQndmxh', - 'SIG_K1_HCaY9Y9qdjnkRhE9hokAyp3pFtkMmjpxF6xTd514Vo8vLVSWKek5m5aHfCaka9TqZUbajkhhd4BfBLxSwCwZUEmy8cvt1x', - 'SIG_K1_GrZqp9ZkuhBeNpeQ5b2L2UWUUrNU1gHbTyMzkyWRhiXNkxPP84Aq9eziU399eBf9xJw8MqHHjz7R2wMTMXhXjHLgpZYFeA', - ]; - const eccSignatures = [ - 'SIG_K1_KeEyJFpkp63Qq5E1zRD9aNZtTjpStvdkdnL31Z7wVmhYtrKGtpVdMBJnXyEUXNkNEyo4d4i4Q79qmRpCUsCRdFqhV6KAeF', - 'SIG_K1_JvgMmFSDhipS1SeBLNBMdAxayAsWS3GuVGSHS7YQth5Z5ZpijxnZgaa23dYD1efQhpEgtEggdRfHMmp31RDXjmJdZYoKLm', - 'SIG_K1_JwMqV2nbEntHSq9AuG3Zq1JBc5YqD2SftMHCTGK4A8DYGn1VPQ8QAduwCNksT5JhYgAmGMzPyJdZ2Ws4p8TCvQ16LeNhrw', - ]; - - // These are simplified tests simply to verify a refactor didn't mess with existing code - - it('(NOTE: sigs are different): ensure elliptic does what eosjs-ecc used to do', () => { - const ellipticEc = new ec('secp256k1'); - for (let idx=0; idx { - const ellipticEc = new ec('secp256k1'); - for (let idx=0; idx - !(sigData[1] & 0x80) && !(sigData[1] === 0 && !(sigData[2] & 0x80)) - && !(sigData[33] & 0x80) && !(sigData[33] === 0 && !(sigData[34] & 0x80)); - - const eccSig = ecc.sign(dataAsString, KPriv); - - const ellipticSig = Signature.fromString(eccSig).toElliptic(); - const recoveredKPub = ecc.recover(eccSig, dataAsString); - const ellipticRecoveredKPub = ellipticEc.recoverPubKey( - ellipticHashedStringAsBuffer, - ellipticSig, - ellipticSig.recoveryParam - ); - - const recoveredEllipticKPub = ellipticEc.keyFromPublic(ellipticRecoveredKPub); - expect(PublicKey.fromElliptic(recoveredEllipticKPub, KeyType.k1).toString()).toEqual(PublicKey.fromString(recoveredKPub).toString()); - expect(PublicKey.fromElliptic(recoveredEllipticKPub, KeyType.k1).toString()).toEqual(k1FormatPublicKeys[idx]); - - const ellipticValid = ellipticEc.verify( - ellipticHashedStringAsBuffer, - ellipticSig, - ellipticEc.keyFromPublic(recoveredEllipticKPub) - ); - expect(ellipticValid).toEqual(true); - } - }); - - it('ensure ecc verifies elliptic\'s Sigs', () => { - const ellipticEc = new ec('secp256k1'); - for (let idx=0; idx Date: Thu, 5 Mar 2020 17:46:52 -0500 Subject: [PATCH 07/12] tests for eosjs-ecc-migration --- src/eosjs-ecc-migration.ts | 28 ++++--- src/eosjs-key-conversions.ts | 4 +- src/tests/eosjs-ecc-migration.test.ts | 107 ++++++++++++++++++++++++++ src/tests/eosjs-jssig.test.ts | 4 +- 4 files changed, 127 insertions(+), 16 deletions(-) create mode 100644 src/tests/eosjs-ecc-migration.test.ts diff --git a/src/eosjs-ecc-migration.ts b/src/eosjs-ecc-migration.ts index 658072675..46c6d1cb9 100644 --- a/src/eosjs-ecc-migration.ts +++ b/src/eosjs-ecc-migration.ts @@ -5,8 +5,8 @@ import {KeyType} from './eosjs-numeric'; export const ecc = { initialize: () => console.error('Method deprecated'), unsafeRandomKey: () => console.error('Method deprecated'), - randomKey: (cpuEntropyBits: number = 0): Promise => { - if (cpuEntropyBits) { + randomKey: (cpuEntropyBits?: number): Promise => { + if (cpuEntropyBits !== undefined) { console.warn('Argument `cpuEntropyBits` is deprecated, ' + 'use the options argument instead'); } @@ -15,18 +15,18 @@ export const ecc = { return Promise.resolve(privateKey.toString()); }, seedPrivate: () => console.error('Method deprecated'), - privateToPublic: (key: string, pubkey_prefix: string = 'EOS'): string => { // tslint:disable-line - if (pubkey_prefix) { + privateToPublic: (key: string, pubkey_prefix?: string): string => { // tslint:disable-line + if (pubkey_prefix !== undefined) { console.warn('Argument `pubkey_prefix` is deprecated, ' + 'keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_ going forward'); } const privateKey = PrivateKey.fromString(key); const publicKey = privateKey.privateToPublic(); - return publicKey.toString(); + return publicKey.toLegacyString(); }, - isValidPublic: (pubkey: string, pubkey_prefix: string = 'EOS'): boolean => { // tslint:disable-line - if (pubkey_prefix) { + isValidPublic: (pubkey: string, pubkey_prefix?: string): boolean => { // tslint:disable-line + if (pubkey_prefix !== undefined) { console.warn('Argument `pubkey_prefix` is deprecated, ' + 'keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_ going forward'); } @@ -58,17 +58,21 @@ export const ecc = { recover: (signature: string, data: string, encoding: string = 'utf8'): string => { const sig = Signature.fromString(signature); const publicKey = sig.recover(data, true, encoding); - return publicKey.toString(); + return publicKey.toLegacyString(); }, recoverHash: (signature: string, dataSha256: string|Buffer, encoding: string = 'hex'): string => { const sig = Signature.fromString(signature); const publicKey = sig.recover(dataSha256, false, encoding); - return publicKey.toString(); + return publicKey.toLegacyString(); }, - sha256: (data: string|Buffer, resultEncoding?: 'hex', encoding: string = 'utf8'): string|Buffer => { - if (encoding) { + sha256: (data: string|Buffer, resultEncoding?: string, encoding?: string): string|Buffer => { + if (encoding !== undefined) { console.warn('Argument `encoding` is deprecated'); } - return require('eosjs-key-conversions').sha256(data, resultEncoding); + if (resultEncoding !== undefined) { + console.warn('Argument `resultEncoding` is deprecated'); + } + + return require('./eosjs-key-conversions').sha256(data); } }; diff --git a/src/eosjs-key-conversions.ts b/src/eosjs-key-conversions.ts index 9cb3c6555..7cc8ac05c 100644 --- a/src/eosjs-key-conversions.ts +++ b/src/eosjs-key-conversions.ts @@ -36,6 +36,6 @@ export const generateKeyPair = (type: KeyType, options?: EC.GenKeyPairOptions): return {publicKey, privateKey}; }; -export const sha256 = (data: string|Buffer, resultEncoding?: 'hex') => { - return hash.sha256().update(data).digest(resultEncoding); +export const sha256 = (data: string|Buffer) => { + return hash.sha256().update(data).digest(); }; diff --git a/src/tests/eosjs-ecc-migration.test.ts b/src/tests/eosjs-ecc-migration.test.ts new file mode 100644 index 000000000..09fd8174e --- /dev/null +++ b/src/tests/eosjs-ecc-migration.test.ts @@ -0,0 +1,107 @@ +const ecc = require('eosjs-ecc'); +import { ecc as eccMigration } from '../eosjs-ecc-migration'; + +import { PrivateKey } from '../eosjs-key-conversions'; + +describe('ecc Migration', () => { + const privateKeys = [ + '5Juww5SS6aLWxopXBAWzwqrwadiZKz7XpKAiktXTKcfBGi1DWg8', + '5JnHjSFwe4r7xyqAUAaVs51G7HmzE86DWGa3VAA5VvQriGYnSUr', + '5K4XZH5XR2By7Q5KTcZnPAmUMU5yjUNBdoKzzXyrLfmiEZJqoKE', + ]; + const legacyPublicKeys = [ + 'EOS7tgwU6E7pAUQJgqEJt66Yi8cWvanTUW8ZfBjeXeJBQvhTU9ypi', + 'EOS8VaY5CiTexYqgQZyPTJkc3qvWuZUi12QrZL9ssjqW2es6aQk2F', + 'EOS7VGhqctkKprW1VUj19DZZiiZLX3YcJqUJCuEcahJmUCw3wJEMu', + ]; + + it('verifies `initialize` returns console.error message', () => { + console.error = jest.fn(); + eccMigration.initialize(); + expect(console.error).toHaveBeenCalledWith('Method deprecated'); + }); + + it('verifies `unsafeRandomKey` returns console.error message', () => { + console.error = jest.fn(); + eccMigration.unsafeRandomKey(); + expect(console.error).toHaveBeenCalledWith('Method deprecated'); + }); + + it('verifies `randomKey` calls generateKeyPair', async () => { + process.env.EOSJS_KEYGEN_ALLOWED = 'true'; + console.warn = jest.fn(); + const privateKey = await eccMigration.randomKey(0); + expect(console.warn).toHaveBeenCalledWith('Argument `cpuEntropyBits` is deprecated, ' + + 'use the options argument instead'); + expect(typeof privateKey).toEqual('string'); + expect(PrivateKey.fromString(privateKey).isValidPrivate()).toBeTruthy(); + }); + + it('verifies `seedPrivate` returns console.error message', () => { + console.error = jest.fn(); + eccMigration.seedPrivate(); + expect(console.error).toHaveBeenCalledWith('Method deprecated'); + }); + + it('verifies `privateToPublic` function is consistent between ecc objects', () => { + console.warn = jest.fn(); + const eccPublicKey = ecc.privateToPublic(privateKeys[0], 'EOS'); + const eccMigrationPublicKey = eccMigration.privateToPublic(privateKeys[0], 'EOS'); + expect(console.warn).toHaveBeenCalledWith('Argument `pubkey_prefix` is deprecated, ' + + 'keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_ going forward'); + expect(eccPublicKey).toEqual(eccMigrationPublicKey); + }); + + it('verifies `isValidPublic` function is consistent between ecc objects', () => { + console.warn = jest.fn(); + const eccValid = ecc.isValidPublic(legacyPublicKeys[0], 'EOS'); + const eccMigrationValid = eccMigration.isValidPublic(legacyPublicKeys[0], 'EOS'); + expect(console.warn).toHaveBeenCalledWith('Argument `pubkey_prefix` is deprecated, ' + + 'keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_ going forward'); + expect(eccValid).toEqual(eccMigrationValid); + expect(eccValid).toBeTruthy(); + expect(eccMigrationValid).toBeTruthy(); + }); + + it('verifies `isValidPrivate` function is consistent between ecc objects', () => { + const eccValid = ecc.isValidPrivate(privateKeys[0]); + const eccMigrationValid = eccMigration.isValidPrivate(privateKeys[0]); + expect(eccValid).toEqual(eccMigrationValid); + expect(eccValid).toBeTruthy(); + expect(eccMigrationValid).toBeTruthy(); + }); + + it('verifies `sign`, `recover`, and `verify` functions are consistent between ecc objects', () => { + const dataAsString = 'some string'; + const eccSig = ecc.sign(dataAsString, privateKeys[0]); + const eccMigrationSig = eccMigration.sign(dataAsString, privateKeys[0]); + + // signatures are different + expect(eccSig).not.toEqual(eccMigrationSig); + + const eccKPub = ecc.recover(eccSig, dataAsString); + const eccMigrationKPub = eccMigration.recover(eccMigrationSig, dataAsString); + expect(eccKPub).toEqual(eccMigrationKPub); + }); + + it('verifies `signHash`, `recoverHash`, and `sha256` functions are consistent between ecc objects', () => { + console.warn = jest.fn(); + const dataAsString = 'some string'; + + const eccHash = Buffer.from(ecc.sha256(dataAsString, 'hex', 'utf8'), 'hex'); + const eccMigrationHash = Buffer.from(eccMigration.sha256(dataAsString, 'hex', 'utf8') as Buffer); + expect(console.warn).toBeCalledWith('Argument `encoding` is deprecated'); + expect(console.warn).toBeCalledWith('Argument `resultEncoding` is deprecated'); + expect(eccHash).toEqual(eccMigrationHash); + + const eccSig = ecc.signHash(eccHash, privateKeys[0]); + const eccMigrationSig = eccMigration.signHash(eccMigrationHash, privateKeys[0]); + + // signatures are different + expect(eccSig).not.toEqual(eccMigrationSig); + + const eccKPub = ecc.recoverHash(eccSig, eccHash); + const eccMigrationKPub = eccMigration.recoverHash(eccSig, eccMigrationHash); + expect(eccKPub).toEqual(eccMigrationKPub); + }); +}); diff --git a/src/tests/eosjs-jssig.test.ts b/src/tests/eosjs-jssig.test.ts index 75d034cd5..7f91a06f0 100644 --- a/src/tests/eosjs-jssig.test.ts +++ b/src/tests/eosjs-jssig.test.ts @@ -164,7 +164,7 @@ describe('JsSignatureProvider', () => { const KPriv = PrivateKey.fromString(KPrivStr); const dataAsString = 'some string'; - const ellipticHashedString = sha256(dataAsString, 'hex'); + const ellipticHashedString = sha256(dataAsString); const sig = KPriv.sign(ellipticHashedString); const KPub = sig.recover(ellipticHashedString); @@ -302,7 +302,7 @@ describe('JsSignatureProvider', () => { const KPriv = PrivateKey.fromString(KPrivStr); const dataAsString = 'some string'; - const ellipticHashedString = sha256(dataAsString, 'hex'); + const ellipticHashedString = sha256(dataAsString); const sig = KPriv.sign(ellipticHashedString); const KPub = sig.recover(ellipticHashedString); From a4e82d33decf2254b49170dbbdf4eb1b77fc8322 Mon Sep 17 00:00:00 2001 From: Bradley Hart Date: Fri, 6 Mar 2020 20:08:21 -0500 Subject: [PATCH 08/12] private key toLegacyString() --- src/PrivateKey.ts | 5 +++++ src/eosjs-ecc-migration.ts | 2 +- src/eosjs-numeric.ts | 31 ++++++++++++++++++++++++++++++- src/tests/eosjs-jssig.test.ts | 21 +++++++++++++++++++-- 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/PrivateKey.ts b/src/PrivateKey.ts index f951537c2..6a2d78a61 100644 --- a/src/PrivateKey.ts +++ b/src/PrivateKey.ts @@ -2,6 +2,7 @@ import { BNInput, ec as EC } from 'elliptic'; import { Key, KeyType, + privateKeyToLegacyString, privateKeyToString, stringToPrivateKey, } from './eosjs-numeric'; @@ -36,6 +37,10 @@ export class PrivateKey { return this.ec.keyFromPrivate(this.key.data); } + public toLegacyString(): string { + return privateKeyToLegacyString(this.key); + } + /** Export private key as EOSIO-format private key */ public toString(): string { return privateKeyToString(this.key); diff --git a/src/eosjs-ecc-migration.ts b/src/eosjs-ecc-migration.ts index 46c6d1cb9..975ed6709 100644 --- a/src/eosjs-ecc-migration.ts +++ b/src/eosjs-ecc-migration.ts @@ -12,7 +12,7 @@ export const ecc = { } const { privateKey } = generateKeyPair(KeyType.k1); - return Promise.resolve(privateKey.toString()); + return Promise.resolve(privateKey.toLegacyString()); }, seedPrivate: () => console.error('Method deprecated'), privateToPublic: (key: string, pubkey_prefix?: string): string => { // tslint:disable-line diff --git a/src/eosjs-numeric.ts b/src/eosjs-numeric.ts index a35d3e1ff..c5d48c994 100644 --- a/src/eosjs-numeric.ts +++ b/src/eosjs-numeric.ts @@ -1,6 +1,8 @@ /** * @module Numeric */ +import { sha256 } from 'hash.js'; + // copyright defined in eosjs/LICENSE.txt const ripemd160 = require('./ripemd').RIPEMD160.hash as (a: Uint8Array) => ArrayBuffer; @@ -327,7 +329,7 @@ export function stringToPublicKey(s: string): Key { } } -/** Convert `key` to legacy string (base-58) form */ +/** Convert public `key` to legacy string (base-58) form */ export function publicKeyToLegacyString(key: Key) { if (key.type === KeyType.k1 && key.data.length === publicKeyDataSize) { return keyToString(key, '', 'EOS'); @@ -393,6 +395,33 @@ export function stringToPrivateKey(s: string): Key { } } +/** Convert private `key` to legacy string (base-58) form */ +export function privateKeyToLegacyString(key: Key) { + if (key.type === KeyType.k1 && key.data.length === privateKeyDataSize) { + const whole = [] as number[]; + whole.push(128); + key.data.forEach((byte) => whole.push(byte)); + const digest = new Uint8Array( + sha256().update( + sha256().update(whole).digest() + ).digest() + ); + + const result = new Uint8Array(privateKeyDataSize + 5); + for (let i = 0; i < whole.length; i++) { + result[i] = whole[i]; + } + for (let i = 0; i < 4; i++) { + result[i + whole.length] = digest[i]; + } + return binaryToBase58(result); + } else if (key.type === KeyType.r1 || key.type === KeyType.wa) { + throw new Error('Key format not supported in legacy conversion'); + } else { + throw new Error('unrecognized public key format'); + } +} + /** Convert `key` to string (base-58) form */ export function privateKeyToString(key: Key) { if (key.type === KeyType.r1) { diff --git a/src/tests/eosjs-jssig.test.ts b/src/tests/eosjs-jssig.test.ts index 7f91a06f0..6b8db90fd 100644 --- a/src/tests/eosjs-jssig.test.ts +++ b/src/tests/eosjs-jssig.test.ts @@ -11,6 +11,11 @@ describe('JsSignatureProvider', () => { '5JnHjSFwe4r7xyqAUAaVs51G7HmzE86DWGa3VAA5VvQriGYnSUr', '5K4XZH5XR2By7Q5KTcZnPAmUMU5yjUNBdoKzzXyrLfmiEZJqoKE', ]; + const privateKeysK1 = [ + 'PVT_K1_26fMPzM27mXhoSF8y56ro7pN2te7rFT6W6wXiUi5joY79NHfZf', + 'PVT_K1_y19korZcH8hyStRy8bn2G8tgx51zE8nTWGFz7LG3ZDYkaELTY', + 'PVT_K1_2FEybdSLZcyrPh3RR7tJ82M8sG4XLW6uzGDmMw76nv54xk8FLu', + ]; const privateKeysR1 = [ 'PVT_R1_GrfEfbv5at9kbeHcGagQmvbFLdm6jqEpgE1wsGbrfbZNjpVgT', 'PVT_R1_wCpPsaY9o8NU9ZsuwaYVQUDkCfj1aWJZGVcmMM6XyYHJVqvqp', @@ -139,7 +144,14 @@ describe('JsSignatureProvider', () => { expect(PublicKey.fromElliptic(ellipticPubKey, KeyType.k1).toString()).toEqual(k1FormatPublicKeys[0]); }); - it('verify that toLegacyString() and toString() are consistent', () => { + it('verify that privateKey toLegacyString() and toString() are consistent', () => { + const privKeyFromK1 = PrivateKey.fromString(privateKeysK1[0]); + const privKeyFromLegacy = PrivateKey.fromString(privateKeys[0]); + expect(privKeyFromK1.toLegacyString()).toEqual(privateKeys[0]); + expect(privKeyFromLegacy.toString()).toEqual(privateKeysK1[0]); + }); + + it('verify that publicKey toLegacyString() and toString() are consistent', () => { const pubKeyFromK1 = PublicKey.fromString(k1FormatPublicKeys[0]); const pubKeyFromLegacy = PublicKey.fromString(legacyPublicKeys[0]); expect(pubKeyFromK1.toLegacyString()).toEqual(legacyPublicKeys[0]); @@ -202,7 +214,12 @@ describe('JsSignatureProvider', () => { expect(() => generateKeyPair(KeyType.r1)).toThrowError(); }); - it('throws error when attempting a legacy key from r1 format', () => { + it('throws error when attempting a legacy private key from r1 format', () => { + const privateKey = PrivateKey.fromString(privateKeysR1[0]); + expect(() => privateKey.toLegacyString()).toThrowError('Key format not supported in legacy conversion'); + }); + + it('throws error when attempting a legacy public key from r1 format', () => { const publicKey = PublicKey.fromString(r1FormatPublicKeys[0]); expect(() => publicKey.toLegacyString()).toThrowError('Key format not supported in legacy conversion'); }); From b853cffe545e749192c0a2f24f169565580c711e Mon Sep 17 00:00:00 2001 From: Bradley Hart Date: Fri, 6 Mar 2020 20:41:40 -0500 Subject: [PATCH 09/12] try/catch for ec validate --- src/PrivateKey.ts | 10 +++++++--- src/PublicKey.ts | 12 ++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/PrivateKey.ts b/src/PrivateKey.ts index 6a2d78a61..1987ce193 100644 --- a/src/PrivateKey.ts +++ b/src/PrivateKey.ts @@ -85,8 +85,12 @@ export class PrivateKey { /** Validate a private key */ public isValidPrivate(): boolean { - const ellipticPrivateKey = this.toElliptic(); - const validationObj = ellipticPrivateKey.validate(); - return validationObj.result; + try { + const ellipticPrivateKey = this.toElliptic(); + const validationObj = ellipticPrivateKey.validate(); + return validationObj.result; + } catch { + return false; + } } } diff --git a/src/PublicKey.ts b/src/PublicKey.ts index 17870d257..781d3a8e1 100644 --- a/src/PublicKey.ts +++ b/src/PublicKey.ts @@ -6,7 +6,7 @@ import { publicKeyToString, stringToPublicKey, } from './eosjs-numeric'; -import { constructElliptic, PrivateKey, Signature } from './eosjs-key-conversions'; +import { constructElliptic } from './eosjs-key-conversions'; /** Represents/stores a public key and provides easy conversion for use with `elliptic` lib */ export class PublicKey { @@ -58,8 +58,12 @@ export class PublicKey { /** Validate a public key */ public isValidPublic(): boolean { - const ellipticPublicKey = this.toElliptic(); - const validationObj = ellipticPublicKey.validate(); - return validationObj.result; + try { + const ellipticPublicKey = this.toElliptic(); + const validationObj = ellipticPublicKey.validate(); + return validationObj.result; + } catch { + return false; + } } } From 58ee3d0a1855dd3fa0ed2a3bc219abba50dc3c3d Mon Sep 17 00:00:00 2001 From: Bradley Hart Date: Mon, 9 Mar 2020 11:54:50 -0400 Subject: [PATCH 10/12] Returning the method names from exact ecc to better naming convention --- src/PrivateKey.ts | 4 ++-- src/PublicKey.ts | 2 +- src/eosjs-ecc-migration.ts | 6 +++--- src/eosjs-jssig.ts | 2 +- src/tests/eosjs-ecc-migration.test.ts | 2 +- src/tests/eosjs-jssig.test.ts | 16 ++++++++-------- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/PrivateKey.ts b/src/PrivateKey.ts index 1987ce193..f81748169 100644 --- a/src/PrivateKey.ts +++ b/src/PrivateKey.ts @@ -52,7 +52,7 @@ export class PrivateKey { } /** Retrieve the public key from a private key */ - public privateToPublic(): PublicKey { + public getPublicKey(): PublicKey { const ellipticPrivateKey = this.toElliptic(); return PublicKey.fromElliptic(ellipticPrivateKey, this.getType(), this.ec); } @@ -84,7 +84,7 @@ export class PrivateKey { } /** Validate a private key */ - public isValidPrivate(): boolean { + public isValid(): boolean { try { const ellipticPrivateKey = this.toElliptic(); const validationObj = ellipticPrivateKey.validate(); diff --git a/src/PublicKey.ts b/src/PublicKey.ts index 781d3a8e1..da9525df9 100644 --- a/src/PublicKey.ts +++ b/src/PublicKey.ts @@ -57,7 +57,7 @@ export class PublicKey { } /** Validate a public key */ - public isValidPublic(): boolean { + public isValid(): boolean { try { const ellipticPublicKey = this.toElliptic(); const validationObj = ellipticPublicKey.validate(); diff --git a/src/eosjs-ecc-migration.ts b/src/eosjs-ecc-migration.ts index 975ed6709..c16faee52 100644 --- a/src/eosjs-ecc-migration.ts +++ b/src/eosjs-ecc-migration.ts @@ -22,7 +22,7 @@ export const ecc = { } const privateKey = PrivateKey.fromString(key); - const publicKey = privateKey.privateToPublic(); + const publicKey = privateKey.getPublicKey(); return publicKey.toLegacyString(); }, isValidPublic: (pubkey: string, pubkey_prefix?: string): boolean => { // tslint:disable-line @@ -32,11 +32,11 @@ export const ecc = { } const publicKey = PublicKey.fromString(pubkey); - return publicKey.isValidPublic(); + return publicKey.isValid(); }, isValidPrivate: (wif: string): boolean => { const privateKey = PrivateKey.fromString(wif); - return privateKey.isValidPrivate(); + return privateKey.isValid(); }, sign: (data: string|Buffer, privateKey: string|PrivateKey, encoding: string = 'utf8'): string => { const privKey = typeof privateKey === 'string' ? PrivateKey.fromString(privateKey) : privateKey; diff --git a/src/eosjs-jssig.ts b/src/eosjs-jssig.ts index 2d5b8da29..4575498f0 100644 --- a/src/eosjs-jssig.ts +++ b/src/eosjs-jssig.ts @@ -47,7 +47,7 @@ class JsSignatureProvider implements SignatureProvider { for (const k of privateKeys) { const priv = PrivateKey.fromString(k); const privElliptic = priv.toElliptic(); - const pubStr = priv.privateToPublic().toString(); + const pubStr = priv.getPublicKey().toString(); this.keys.set(pubStr, privElliptic); this.availableKeys.push(pubStr); } diff --git a/src/tests/eosjs-ecc-migration.test.ts b/src/tests/eosjs-ecc-migration.test.ts index 09fd8174e..1a5e55d0c 100644 --- a/src/tests/eosjs-ecc-migration.test.ts +++ b/src/tests/eosjs-ecc-migration.test.ts @@ -34,7 +34,7 @@ describe('ecc Migration', () => { expect(console.warn).toHaveBeenCalledWith('Argument `cpuEntropyBits` is deprecated, ' + 'use the options argument instead'); expect(typeof privateKey).toEqual('string'); - expect(PrivateKey.fromString(privateKey).isValidPrivate()).toBeTruthy(); + expect(PrivateKey.fromString(privateKey).isValid()).toBeTruthy(); }); it('verifies `seedPrivate` returns console.error message', () => { diff --git a/src/tests/eosjs-jssig.test.ts b/src/tests/eosjs-jssig.test.ts index 6b8db90fd..13d3ab0b0 100644 --- a/src/tests/eosjs-jssig.test.ts +++ b/src/tests/eosjs-jssig.test.ts @@ -51,9 +51,9 @@ describe('JsSignatureProvider', () => { process.env.EOSJS_KEYGEN_ALLOWED = 'true'; const {privateKey, publicKey} = generateKeyPair(KeyType.k1); expect(privateKey).toBeInstanceOf(PrivateKey); - expect(privateKey.isValidPrivate()).toBeTruthy(); + expect(privateKey.isValid()).toBeTruthy(); expect(publicKey).toBeInstanceOf(PublicKey); - expect(publicKey.isValidPublic()).toBeTruthy(); + expect(publicKey.isValid()).toBeTruthy(); }); it('throws error with no EOSJS_KEYGEN_ALLOWED environment variable', () => { @@ -63,7 +63,7 @@ describe('JsSignatureProvider', () => { it('Retrieves the public key from a private key', () => { const privateKey = PrivateKey.fromString(privateKeys[0]); - const publicKey = privateKey.privateToPublic(); + const publicKey = privateKey.getPublicKey(); expect(publicKey.toString()).toEqual(k1FormatPublicKeys[0]); }); @@ -168,7 +168,7 @@ describe('JsSignatureProvider', () => { it('verify that public key validate function correctly assesses public keys', () => { const publicKey = PublicKey.fromString(k1FormatPublicKeys[0]); - expect(publicKey.isValidPublic()).toEqual(true); + expect(publicKey.isValid()).toEqual(true); }); it('Ensure elliptic sign, recover, verify flow works', () => { @@ -204,9 +204,9 @@ describe('JsSignatureProvider', () => { process.env.EOSJS_KEYGEN_ALLOWED = 'true'; const {privateKey, publicKey} = generateKeyPair(KeyType.r1); expect(privateKey).toBeInstanceOf(PrivateKey); - expect(privateKey.isValidPrivate()).toBeTruthy(); + expect(privateKey.isValid()).toBeTruthy(); expect(publicKey).toBeInstanceOf(PublicKey); - expect(publicKey.isValidPublic()).toBeTruthy(); + expect(publicKey.isValid()).toBeTruthy(); }); it('throws error with no EOSJS_KEYGEN_ALLOWED environment variable', () => { @@ -226,7 +226,7 @@ describe('JsSignatureProvider', () => { it('Retrieves the public key from a private key', () => { const privateKey = PrivateKey.fromString(privateKeysR1[0]); - const publicKey = privateKey.privateToPublic(); + const publicKey = privateKey.getPublicKey(); expect(publicKey.toString()).toEqual(r1FormatPublicKeys[0]); }); @@ -311,7 +311,7 @@ describe('JsSignatureProvider', () => { it('verify that public key validate function correctly assesses public keys', () => { const publicKey = PublicKey.fromString(r1FormatPublicKeys[0]); - expect(publicKey.isValidPublic()).toEqual(true); + expect(publicKey.isValid()).toEqual(true); }); it('Ensure elliptic sign, recover, verify flow works', () => { From 0b34a5f1144cfeee7a195b2b21b6664348434ca7 Mon Sep 17 00:00:00 2001 From: Bradley Hart Date: Wed, 11 Mar 2020 18:12:24 -0400 Subject: [PATCH 11/12] Adding more consistency between ecc and ecc migration --- src/eosjs-ecc-migration.ts | 16 ++++++++++++---- src/tests/eosjs-ecc-migration.test.ts | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/eosjs-ecc-migration.ts b/src/eosjs-ecc-migration.ts index c16faee52..b75e8c409 100644 --- a/src/eosjs-ecc-migration.ts +++ b/src/eosjs-ecc-migration.ts @@ -31,12 +31,20 @@ export const ecc = { 'keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_ going forward'); } - const publicKey = PublicKey.fromString(pubkey); - return publicKey.isValid(); + try { + const publicKey = PublicKey.fromString(pubkey); + return publicKey.isValid(); + } catch { + return false; + } }, isValidPrivate: (wif: string): boolean => { - const privateKey = PrivateKey.fromString(wif); - return privateKey.isValid(); + try { + const privateKey = PrivateKey.fromString(wif); + return privateKey.isValid(); + } catch { + return false; + } }, sign: (data: string|Buffer, privateKey: string|PrivateKey, encoding: string = 'utf8'): string => { const privKey = typeof privateKey === 'string' ? PrivateKey.fromString(privateKey) : privateKey; diff --git a/src/tests/eosjs-ecc-migration.test.ts b/src/tests/eosjs-ecc-migration.test.ts index 1a5e55d0c..25f293cbb 100644 --- a/src/tests/eosjs-ecc-migration.test.ts +++ b/src/tests/eosjs-ecc-migration.test.ts @@ -63,6 +63,17 @@ describe('ecc Migration', () => { expect(eccMigrationValid).toBeTruthy(); }); + it('verifies `isValidPublic` function is consistent during an error', () => { + console.warn = jest.fn(); + const eccValid = ecc.isValidPublic('publickey', 'EOS'); + const eccMigrationValid = eccMigration.isValidPublic('publickey', 'EOS'); + expect(console.warn).toHaveBeenCalledWith('Argument `pubkey_prefix` is deprecated, ' + + 'keys prefixed with PUB_K1_/PUB_R1_/PUB_WA_ going forward'); + expect(eccValid).toEqual(eccMigrationValid); + expect(eccValid).toBeFalsy(); + expect(eccMigrationValid).toBeFalsy(); + }); + it('verifies `isValidPrivate` function is consistent between ecc objects', () => { const eccValid = ecc.isValidPrivate(privateKeys[0]); const eccMigrationValid = eccMigration.isValidPrivate(privateKeys[0]); @@ -71,6 +82,14 @@ describe('ecc Migration', () => { expect(eccMigrationValid).toBeTruthy(); }); + it('verifies `isValidPrivate` function is consistent during an error', () => { + const eccValid = ecc.isValidPrivate('privatekey'); + const eccMigrationValid = eccMigration.isValidPrivate('privatekey'); + expect(eccValid).toEqual(eccMigrationValid); + expect(eccValid).toBeFalsy(); + expect(eccMigrationValid).toBeFalsy(); + }); + it('verifies `sign`, `recover`, and `verify` functions are consistent between ecc objects', () => { const dataAsString = 'some string'; const eccSig = ecc.sign(dataAsString, privateKeys[0]); From 6d8bc8d3c702c8c11b67d2157ce0269072333995 Mon Sep 17 00:00:00 2001 From: Bradley Hart Date: Fri, 13 Mar 2020 09:49:52 -0400 Subject: [PATCH 12/12] Updating yarn.lock --- yarn.lock | 224 ++++-------------------------------------------------- 1 file changed, 13 insertions(+), 211 deletions(-) diff --git a/yarn.lock b/yarn.lock index ea40a47ff..fae4ab538 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1278,11 +1278,6 @@ abab@^2.0.0: resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" integrity sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg== -abbrev@1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" - integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== - acorn-globals@^4.3.2: version "4.3.4" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" @@ -1394,7 +1389,7 @@ anymatch@^3.0.3: normalize-path "^3.0.0" picomatch "^2.0.4" -aproba@^1.0.3, aproba@^1.1.1: +aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== @@ -1404,14 +1399,6 @@ arch@2.1.1: resolved "https://registry.yarnpkg.com/arch/-/arch-2.1.1.tgz#8f5c2731aa35a30929221bb0640eed65175ec84e" integrity sha512-BLM56aPo9vLLFVa8+/+pJLnrZ7QGGTVHWsCwieAWT9o9K8UeGaQbzZbGoabWLOo2ksBCztoXdqBZBplqLDDCSg== -are-we-there-yet@~1.1.2: - version "1.1.5" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" - integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== - dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" - argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -2159,11 +2146,6 @@ console-browserify@^1.1.0: resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" integrity sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA== -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= - constants-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" @@ -2405,7 +2387,7 @@ debug@3.1.0: dependencies: ms "2.0.0" -debug@3.2.6, debug@^3.1.0, debug@^3.2.6: +debug@3.2.6, debug@^3.1.0: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -2429,11 +2411,6 @@ decode-uri-component@^0.2.0: resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -2473,11 +2450,6 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= - des.js@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843" @@ -2491,11 +2463,6 @@ detect-file@^1.0.0: resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= -detect-libc@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= - detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" @@ -2629,7 +2596,7 @@ enhanced-resolve@^4.0.0, enhanced-resolve@^4.1.0: memory-fs "^0.5.0" tapable "^1.0.0" -eosjs-ecc@4.0.7: +eosjs-ecc@^4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/eosjs-ecc/-/eosjs-ecc-4.0.7.tgz#f5246da3b84839fcc237204768ef6e5ea56cc814" integrity sha512-uuqhqnrDy9XTpKfkhiZqRDUTCCI9oWBalVK5IosL7kpYwA9I3lm68INYFLyWsHpF2xwHqPql8MrMYJ3zfOn5Qg== @@ -3071,13 +3038,6 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-minipass@^1.2.5: - version "1.2.7" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" - integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== - dependencies: - minipass "^2.6.0" - fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" @@ -3116,20 +3076,6 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -gauge@~2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" - gensync@^1.0.0-beta.1: version "1.0.0-beta.1" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" @@ -3308,11 +3254,6 @@ has-symbols@^1.0.0, has-symbols@^1.0.1: resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== -has-unicode@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= - has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" @@ -3359,7 +3300,7 @@ hash-base@^3.0.0: inherits "^2.0.1" safe-buffer "^5.0.1" -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: +hash.js@^1.0.0, hash.js@^1.0.3: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== @@ -3424,7 +3365,7 @@ human-signals@^1.1.1: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== -iconv-lite@0.4.24, iconv-lite@^0.4.4: +iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -3441,13 +3382,6 @@ iferr@^0.1.5: resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= -ignore-walk@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" - integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== - dependencies: - minimatch "^3.0.4" - import-local@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" @@ -3509,7 +3443,7 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -ini@^1.3.4, ini@~1.3.0: +ini@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== @@ -4747,21 +4681,6 @@ minimist@~0.0.1: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= -minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" - integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - -minizlib@^1.2.1: - version "1.3.3" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" - integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== - dependencies: - minipass "^2.9.0" - mississippi@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" @@ -4786,7 +4705,7 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.5.1, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1: +mkdirp@0.5.1, mkdirp@0.x, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= @@ -4899,15 +4818,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -needle@^2.2.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.3.2.tgz#3342dea100b7160960a450dc8c22160ac712a528" - integrity sha512-DUzITvPVDUy6vczKKYTnWc/pBZ0EnjMJnQ3y+Jo5zfKFimJs7S3HFCxCRZYB9FUZcrzUQr3WsmvZgddMEIZv6w== - dependencies: - debug "^3.2.6" - iconv-lite "^0.4.4" - sax "^1.2.4" - neo-async@^2.5.0, neo-async@^2.6.0, neo-async@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" @@ -4973,22 +4883,6 @@ node-notifier@^6.0.0: shellwords "^0.1.1" which "^1.3.1" -node-pre-gyp@*: - version "0.14.0" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.14.0.tgz#9a0596533b877289bcad4e143982ca3d904ddc83" - integrity sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA== - dependencies: - detect-libc "^1.0.2" - mkdirp "^0.5.1" - needle "^2.2.1" - nopt "^4.0.1" - npm-packlist "^1.1.6" - npmlog "^4.0.2" - rc "^1.2.7" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^4.4.2" - node-releases@^1.1.47: version "1.1.48" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.48.tgz#7f647f0c453a0495bcd64cbd4778c26035c2f03a" @@ -4996,14 +4890,6 @@ node-releases@^1.1.47: dependencies: semver "^6.3.0" -nopt@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" - integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= - dependencies: - abbrev "1" - osenv "^0.1.4" - normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" @@ -5016,27 +4902,6 @@ normalize-path@^3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -npm-bundled@^1.0.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" - integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== - dependencies: - npm-normalize-package-bin "^1.0.1" - -npm-normalize-package-bin@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" - integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== - -npm-packlist@^1.1.6: - version "1.4.8" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.8.tgz#56ee6cc135b9f98ad3d51c1c95da22bbb9b2ef3e" - integrity sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A== - dependencies: - ignore-walk "^3.0.1" - npm-bundled "^1.0.1" - npm-normalize-package-bin "^1.0.1" - npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -5051,16 +4916,6 @@ npm-run-path@^4.0.0: dependencies: path-key "^3.0.0" -npmlog@^4.0.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" - integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== - dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" - number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" @@ -5191,7 +5046,7 @@ os-browserify@^0.3.0: resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= -os-homedir@^1.0.0, os-homedir@^1.0.1: +os-homedir@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= @@ -5205,19 +5060,6 @@ os-locale@^3.0.0: lcid "^2.0.0" mem "^4.0.0" -os-tmpdir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= - -osenv@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" - integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" - p-defer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" @@ -5603,16 +5445,6 @@ randomfill@^1.0.3: randombytes "^2.0.5" safe-buffer "^5.1.0" -rc@^1.2.7: - version "1.2.8" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - react-dom@^16.8.5: version "16.12.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.12.0.tgz#0da4b714b8d13c2038c9396b54a92baea633fe11" @@ -5637,7 +5469,7 @@ react@^16.8.5: object-assign "^4.1.1" prop-types "^15.6.2" -"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6: +"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6: version "2.3.7" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== @@ -5877,7 +5709,7 @@ ret@~0.1.10: resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3: +rimraf@^2.5.4, rimraf@^2.6.3: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== @@ -5955,11 +5787,6 @@ sane@^4.0.3: minimist "^1.1.1" walker "~1.0.5" -sax@^1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" - integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== - saxes@^3.1.9: version "3.1.11" resolved "https://registry.yarnpkg.com/saxes/-/saxes-3.1.11.tgz#d59d1fd332ec92ad98a2e0b2ee644702384b1c5b" @@ -6009,7 +5836,7 @@ serialize-javascript@^2.1.2: resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.2.tgz#ecec53b0e0317bdc95ef76ab7074b7384785fa61" integrity sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ== -set-blocking@^2.0.0, set-blocking@~2.0.0: +set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= @@ -6275,7 +6102,7 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.1: +string-width@^2.0.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -6374,11 +6201,6 @@ strip-final-newline@^2.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= - supports-color@5.4.0: version "5.4.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" @@ -6428,19 +6250,6 @@ tapable@^1.0.0, tapable@^1.1.3: resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== -tar@^4.4.2: - version "4.4.13" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" - integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== - dependencies: - chownr "^1.1.1" - fs-minipass "^1.2.5" - minipass "^2.8.6" - minizlib "^1.2.1" - mkdirp "^0.5.0" - safe-buffer "^5.1.2" - yallist "^3.0.3" - tcomb-validation@^3.3.0: version "3.4.1" resolved "https://registry.yarnpkg.com/tcomb-validation/-/tcomb-validation-3.4.1.tgz#a7696ec176ce56a081d9e019f8b732a5a8894b65" @@ -7104,13 +6913,6 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -wide-align@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" - integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== - dependencies: - string-width "^1.0.2 || 2" - word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" @@ -7194,7 +6996,7 @@ xtend@^4.0.0, xtend@~4.0.1: resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== -yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: +yallist@^3.0.2: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==