From 58ec7a9f4daf181273565afe71cc4c68cc273462 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Fri, 20 Oct 2017 22:07:09 -0400 Subject: [PATCH 01/11] Progress commit -- ethereumjs-wallet typings --- common/typescript/ethereumjs-wallet.d.ts | 176 +++ package-lock.json | 1469 +++++----------------- package.json | 1 + 3 files changed, 507 insertions(+), 1139 deletions(-) create mode 100644 common/typescript/ethereumjs-wallet.d.ts diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts new file mode 100644 index 00000000000..d48940a0e41 --- /dev/null +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -0,0 +1,176 @@ +declare module 'ethereumjs-wallet' { + import { Buffer } from 'buffer'; + + interface IPresaleWallet { + encseed: string; + ethaddr: string; + btcaddr: string; + email: string; + } + + interface IKdfParams { + dklen: number; + salt: string; // Random salt for the kdf. Size must match the requirements of the KDF (key derivation function). Random number generated via crypto.getRandomBytes if nothing is supplied. + } + + interface IScryptKdfParams extends IKdfParams { + n: number; // Iteration count. Defaults to 262144. + r: number; // Block size for the underlying hash. Defaults to 8. + p: number; // Parallelization factor. Defaults to 1. + } + + interface IPbkdf2KdfParams extends IKdfParams { + prf: 'hmac-sha256'; + c: number; + } + + interface IV3Wallet { + version: 3; + crypto: { + kdf: 'scrypt' | 'pbkdf2'; + kfdparams: IScryptKdfParams | IPbkdf2KdfParams; + ciphertext: string; + mac: string; + cipher: string; + cipherParams: { + iv: string; + }; + }; + } + + interface IV3Options { + salt?: Buffer; // Random salt for the kdf. Size must match the requirements of the KDF (key derivation function). Random number generated via crypto.getRandomBytes if nothing is supplied. + iv?: Buffer; // Initialization vector for the cipher. Size must match the requirements of the cipher. Random number generated via crypto.getRandomBytes if nothing is supplied. + kdf?: string; // The key derivation function, see below. + dklen?: number; // Derived key length. For certain cipher settings, this must match the block sizes of those. + uuid?: Buffer; // UUID. One is randomly generated. + cipher?: string | 'aes-128-ctr' | 'aes-128-cbc'; // The cipher to use. Names must match those of supported by OpenSSL, e.g. aes-128-ctr or aes-128-cbc. + + /* pbkdf2 */ + + c?: number; // Number of iterations. Defaults to 262144. + + /* scrypt */ + + n?: number; // Iteration count. Defaults to 262144. + r?: number; // Block size for the underlying hash. Defaults to 8. + p?: number; // Parallelization factor. Defaults to 1. + } + + class PublicKeyOnlyWallet { + getPublicKey(): Buffer; //only returns uncompressed Ethereum-style public keys. + getPublicKeyString(): string; + getAddress(): Buffer; + getAddressString(): string; + getChecksumAddressString(): string; + getV3Filename(timestamp?: number); + } + class FullWallet extends PublicKeyOnlyWallet { + getPrivateKey(): Buffer; + getPrivateKeyString(): string; + toV3(password: string, options?: IV3Options); + } + + /** + * + * @param icap + * @description create an instance based on a new random key (setting icap to true will generate an address suitable for the ICAP Direct mode + */ + function generate(icap?: boolean): FullWallet; + + /** + * + * @param pattern + * @description create an instance where the address is valid against the supplied pattern (this will be very slow) + */ + function generateVanityAddress(pattern: string | RegExp): FullWallet; + + /** + * @description create an instance based on a raw private key + * @param input + * + */ + function fromPrivateKey(input: Buffer): FullWallet; + + /** + * @description create an instance based on a BIP32 extended private key (xprv) + * @param input + */ + function fromExtendedPrivateKey(input: Buffer): FullWallet; + + /** + * @description create an instance based on a public key (certain methods will not be available) + * @param input + * @param nonStrict + */ + function fromPublicKey( + input: Buffer, + nonStrict?: boolean + ): PublicKeyOnlyWallet; + + /** + * @description create an instance based on a BIP32 extended public key (xpub) + * @param input + */ + function fromExtendedPublicKey(input: string): PublicKeyOnlyWallet; + + /** + * @description import a wallet (Version 1 of the Ethereum wallet format) + * @param input + * @param password + */ + function fromV1(input: object | string, password: string): FullWallet; + + /** + * @description import a wallet (Version 3 of the Ethereum wallet format). Set nonStrict true to accept files with mixed-caps. + * @param input + * @param password + * @param nonStrict + */ + function fromV3( + input: IV3Wallet | string, + password: string, + nonStrict: boolean + ): FullWallet; + + /** + * @description import an Ethereum Pre Sale wallet + * @param input + * @param password + */ + function fromEthSale( + input: IPresaleWallet | string, + password: string + ): FullWallet; + + /** + * @description import a brain wallet used by Ether.Camp + * @param input + * @param password + */ + function fromEtherCamp(passphrase: string): FullWallet; + + /** + * @description import a wallet generated by EtherWallet + * @param input + * @param password + */ + function fromEtherWallet( + input: object | string, + password: string + ): FullWallet; + + /** + * @description import a wallet from a KryptoKit seed + * @param entropy + * @param seed + */ + function fromKryptoKit(entropy: string, seed: string): FullWallet; + + /** + * @description import a brain wallet used by Quorum Wallet + * @param passphrase + * @param userid + */ + function fromQuorumWallet(passphrase: string, userid: string): FullWallet; +} diff --git a/package-lock.json b/package-lock.json index 453382a0d03..82244f8ed9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -298,6 +298,11 @@ } } }, + "aes-js": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-0.2.4.tgz", + "integrity": "sha1-lLiBq3FyhtAV+iGeCPtmcJ3aWj0=" + }, "ajv": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", @@ -2070,6 +2075,30 @@ "base-x": "3.0.2" } }, + "bs58check": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-1.3.4.tgz", + "integrity": "sha1-xSVABzdJEXcU+gQsMEfrj5FRy/g=", + "requires": { + "bs58": "3.1.0", + "create-hash": "1.1.3" + }, + "dependencies": { + "base-x": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-1.1.0.tgz", + "integrity": "sha1-QtPXF0dPnqAiB/bRqh9CaRPut6w=" + }, + "bs58": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-3.1.0.tgz", + "integrity": "sha1-1MJjiL9IBMrHFBQbGUWqR+XrJI4=", + "requires": { + "base-x": "1.1.0" + } + } + } + }, "bser": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz", @@ -2331,7 +2360,6 @@ "requires": { "anymatch": "1.3.2", "async-each": "1.0.1", - "fsevents": "1.1.2", "glob-parent": "2.0.0", "inherits": "2.0.3", "is-binary-path": "1.0.1", @@ -4006,9 +4034,6 @@ "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", "dev": true }, - "ethereum-blockies": { - "version": "git+https://github.com/MyEtherWallet/blockies.git#8c40d1a9f24282a51c0727dba39460f0642dcac4" - }, "ethereum-common": { "version": "0.0.18", "resolved": "https://registry.npmjs.org/ethereum-common/-/ethereum-common-0.0.18.tgz", @@ -4061,6 +4086,39 @@ "secp256k1": "3.3.0" } }, + "ethereumjs-wallet": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz", + "integrity": "sha1-gnY7Fpfuenlr5xVdqd+0my+Yz9s=", + "requires": { + "aes-js": "0.2.4", + "bs58check": "1.3.4", + "ethereumjs-util": "4.5.0", + "hdkey": "0.7.1", + "scrypt.js": "0.2.0", + "utf8": "2.1.2", + "uuid": "2.0.3" + }, + "dependencies": { + "ethereumjs-util": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz", + "integrity": "sha1-PpQosxfuvaPXJg2FT93alUsfG8Y=", + "requires": { + "bn.js": "4.11.8", + "create-hash": "1.1.3", + "keccakjs": "0.2.1", + "rlp": "2.0.0", + "secp256k1": "3.3.0" + } + }, + "uuid": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", + "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=" + } + } + }, "ethjs-util": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.4.tgz", @@ -4442,1147 +4500,248 @@ "version": "1.2.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" - } - } - }, - "fd-slicer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", - "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", - "dev": true, - "requires": { - "pend": "1.2.0" - } - }, - "figures": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", - "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", - "dev": true, - "requires": { - "escape-string-regexp": "1.0.5", - "object-assign": "4.1.1" - } - }, - "file-loader": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-0.11.2.tgz", - "integrity": "sha512-N+uhF3mswIFeziHQjGScJ/yHXYt3DiLBeC+9vWW+WjUBiClMSOlV1YrXQi+7KM2aA3Rn4Bybgv+uXFQbfkzpvg==", - "dev": true, - "requires": { - "loader-utils": "1.1.0" - } - }, - "file-type": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz", - "integrity": "sha1-G2AOX8ofvcboDApwxxyNul95BsU=", - "dev": true - }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true - }, - "filename-reserved-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz", - "integrity": "sha1-5hz4BfDeHJhFZ9A4bcXfUO5a9+Q=", - "dev": true - }, - "filenamify": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-1.2.1.tgz", - "integrity": "sha1-qfL/0RxQO+0wABUCknI3jx8TZaU=", - "dev": true, - "requires": { - "filename-reserved-regex": "1.0.0", - "strip-outer": "1.0.0", - "trim-repeated": "1.0.0" - } - }, - "fileset": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", - "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", - "dev": true, - "requires": { - "glob": "7.1.2", - "minimatch": "3.0.4" - } - }, - "fill-range": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", - "dev": true, - "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "1.1.7", - "repeat-element": "1.1.2", - "repeat-string": "1.6.1" - } - }, - "finalhandler": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.6.tgz", - "integrity": "sha1-AHrqM9Gk0+QgF/YkhIrVjSEvgU8=", - "dev": true, - "requires": { - "debug": "2.6.9", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "statuses": "1.3.1", - "unpipe": "1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "2.0.0" - } - }, - "find-versions": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-1.2.1.tgz", - "integrity": "sha1-y96fEuOFdaCvG+G5osXV/Y8Ya2I=", - "dev": true, - "requires": { - "array-uniq": "1.0.3", - "get-stdin": "4.0.1", - "meow": "3.7.0", - "semver-regex": "1.0.0" - } - }, - "first-chunk-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", - "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", - "dev": true - }, - "flatten": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", - "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=", - "dev": true - }, - "font-awesome": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/font-awesome/-/font-awesome-4.7.0.tgz", - "integrity": "sha1-j6jPBBGhoxr9B7BtKQK7n8gVoTM=" - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", - "dev": true, - "requires": { - "for-in": "1.0.2" - } - }, - "foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", - "dev": true - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", - "dev": true, - "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.15" - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", - "dev": true - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "requires": { - "map-cache": "0.2.2" - } - }, - "fresh": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz", - "integrity": "sha1-9HTKXmqSRtb9jglTz6m5yAWvp44=", - "dev": true - }, - "friendly-errors-webpack-plugin": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.6.1.tgz", - "integrity": "sha1-4yeBxHIvVGoGqbXXp8+ihSA3XXA=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "error-stack-parser": "2.0.1", - "string-length": "1.0.1" - } - }, - "from": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", - "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", - "dev": true - }, - "fs-extra": { - "version": "0.26.7", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.26.7.tgz", - "integrity": "sha1-muH92UiXeY7at20JGM9C0MMYT6k=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "jsonfile": "2.4.0", - "klaw": "1.3.1", - "path-is-absolute": "1.0.1", - "rimraf": "2.6.2" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.2.tgz", - "integrity": "sha512-Sn44E5wQW4bTHXvQmvSHwqbuiXtduD6Rrjm2ZtUEGbyrig+nUH3t/QD4M4/ZXViY556TBpRgZkHLDx3JxPwxiw==", - "dev": true, - "optional": true, - "requires": { - "nan": "2.6.2", - "node-pre-gyp": "0.6.36" - }, - "dependencies": { - "abbrev": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true - }, - "ajv": { - "version": "4.11.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" - } - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "aproba": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "delegates": "1.0.0", - "readable-stream": "2.2.9" - } - }, - "asn1": { - "version": "0.2.3", - "bundled": true, - "dev": true, - "optional": true - }, - "assert-plus": { - "version": "0.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "asynckit": { - "version": "0.4.0", - "bundled": true, - "dev": true, - "optional": true - }, - "aws-sign2": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "aws4": { - "version": "1.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "balanced-match": { - "version": "0.4.2", - "bundled": true, - "dev": true - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "tweetnacl": "0.14.5" - } - }, - "block-stream": { - "version": "0.0.9", - "bundled": true, - "dev": true, - "requires": { - "inherits": "2.0.3" - } - }, - "boom": { - "version": "2.10.1", - "bundled": true, - "dev": true, - "requires": { - "hoek": "2.16.3" - } - }, - "brace-expansion": { - "version": "1.1.7", - "bundled": true, - "dev": true, - "requires": { - "balanced-match": "0.4.2", - "concat-map": "0.0.1" - } - }, - "buffer-shims": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "caseless": { - "version": "0.12.0", - "bundled": true, - "dev": true, - "optional": true - }, - "co": { - "version": "4.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "combined-stream": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "requires": { - "delayed-stream": "1.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "cryptiles": { - "version": "2.0.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "boom": "2.10.1" - } - }, - "dashdash": { - "version": "1.14.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "debug": { - "version": "2.6.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ms": "2.0.0" - } - }, - "deep-extend": { - "version": "0.4.2", - "bundled": true, - "dev": true, - "optional": true - }, - "delayed-stream": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "ecc-jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsbn": "0.1.1" - } - }, - "extend": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "extsprintf": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "forever-agent": { - "version": "0.6.1", - "bundled": true, - "dev": true, - "optional": true - }, - "form-data": { - "version": "2.1.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.15" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "fstream": { - "version": "1.0.11", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.6.1" - } - }, - "fstream-ignore": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "fstream": "1.0.11", - "inherits": "2.0.3", - "minimatch": "3.0.4" - } - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aproba": "1.1.1", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" - } - }, - "getpass": { - "version": "0.1.7", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "glob": { - "version": "7.1.2", - "bundled": true, - "dev": true, - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "graceful-fs": { - "version": "4.1.11", - "bundled": true, - "dev": true - }, - "har-schema": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "optional": true - }, - "har-validator": { - "version": "4.2.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ajv": "4.11.8", - "har-schema": "1.0.5" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "hawk": { - "version": "3.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" - } - }, - "hoek": { - "version": "2.16.3", - "bundled": true, - "dev": true - }, - "http-signature": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.0", - "sshpk": "1.13.0" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true, - "dev": true - }, - "ini": { - "version": "1.3.4", - "bundled": true, - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "is-typedarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "isstream": { - "version": "0.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "jodid25519": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsbn": "0.1.1" - } - }, - "jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "bundled": true, - "dev": true, - "optional": true - }, - "json-stable-stringify": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsonify": "0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "jsonify": { - "version": "0.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "jsprim": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.0.2", - "json-schema": "0.2.3", - "verror": "1.3.6" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "mime-db": { - "version": "1.27.0", - "bundled": true, - "dev": true - }, - "mime-types": { - "version": "2.1.15", - "bundled": true, - "dev": true, - "requires": { - "mime-db": "1.27.0" - } - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "node-pre-gyp": { - "version": "0.6.36", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "mkdirp": "0.5.1", - "nopt": "4.0.1", - "npmlog": "4.1.0", - "rc": "1.2.1", - "request": "2.81.0", - "rimraf": "2.6.1", - "semver": "5.3.0", - "tar": "2.2.1", - "tar-pack": "3.4.0" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "abbrev": "1.1.0", - "osenv": "0.1.4" - } - }, - "npmlog": { - "version": "4.1.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "oauth-sign": { - "version": "0.8.2", - "bundled": true, - "dev": true, - "optional": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "wrappy": "1.0.2" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "performance-now": { - "version": "0.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "1.0.7", - "bundled": true, - "dev": true - }, - "punycode": { - "version": "1.4.1", - "bundled": true, - "dev": true, - "optional": true - }, - "qs": { - "version": "6.4.0", - "bundled": true, - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "deep-extend": "0.4.2", - "ini": "1.3.4", - "minimist": "1.2.0", - "strip-json-comments": "2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.2.9", - "bundled": true, - "dev": true, - "requires": { - "buffer-shims": "1.0.0", - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "1.0.1", - "util-deprecate": "1.0.2" - } - }, - "request": { - "version": "2.81.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "4.2.1", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.15", - "oauth-sign": "0.8.2", - "performance-now": "0.2.0", - "qs": "6.4.0", - "safe-buffer": "5.0.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.2", - "tunnel-agent": "0.6.0", - "uuid": "3.0.1" - } - }, - "rimraf": { - "version": "2.6.1", - "bundled": true, - "dev": true, - "requires": { - "glob": "7.1.2" - } - }, - "safe-buffer": { - "version": "5.0.1", - "bundled": true, - "dev": true - }, - "semver": { - "version": "5.3.0", - "bundled": true, - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "sntp": { - "version": "1.0.9", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "hoek": "2.16.3" - } - }, - "sshpk": { - "version": "1.13.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jodid25519": "1.0.2", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - }, - "string_decoder": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "5.0.1" - } - }, - "stringstream": { - "version": "0.0.5", - "bundled": true, - "dev": true, - "optional": true - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "tar": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" - } - }, - "tar-pack": { - "version": "3.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "2.6.8", - "fstream": "1.0.11", - "fstream-ignore": "1.0.5", - "once": "1.4.0", - "readable-stream": "2.2.9", - "rimraf": "2.6.1", - "tar": "2.2.1", - "uid-number": "0.0.6" - } - }, - "tough-cookie": { - "version": "2.3.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "punycode": "1.4.1" - } - }, - "tunnel-agent": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "bundled": true, - "dev": true, - "optional": true - }, - "uid-number": { - "version": "0.0.6", - "bundled": true, - "dev": true, - "optional": true - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "uuid": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "verror": { - "version": "1.3.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "extsprintf": "1.0.2" - } - }, - "wide-align": { - "version": "1.1.2", - "bundled": true, + } + } + }, + "fd-slicer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", + "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "dev": true, + "requires": { + "pend": "1.2.0" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5", + "object-assign": "4.1.1" + } + }, + "file-loader": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-0.11.2.tgz", + "integrity": "sha512-N+uhF3mswIFeziHQjGScJ/yHXYt3DiLBeC+9vWW+WjUBiClMSOlV1YrXQi+7KM2aA3Rn4Bybgv+uXFQbfkzpvg==", + "dev": true, + "requires": { + "loader-utils": "1.1.0" + } + }, + "file-type": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz", + "integrity": "sha1-G2AOX8ofvcboDApwxxyNul95BsU=", + "dev": true + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "filename-reserved-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz", + "integrity": "sha1-5hz4BfDeHJhFZ9A4bcXfUO5a9+Q=", + "dev": true + }, + "filenamify": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-1.2.1.tgz", + "integrity": "sha1-qfL/0RxQO+0wABUCknI3jx8TZaU=", + "dev": true, + "requires": { + "filename-reserved-regex": "1.0.0", + "strip-outer": "1.0.0", + "trim-repeated": "1.0.0" + } + }, + "fileset": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", + "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", + "dev": true, + "requires": { + "glob": "7.1.2", + "minimatch": "3.0.4" + } + }, + "fill-range": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "dev": true, + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "1.1.7", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" + } + }, + "finalhandler": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.6.tgz", + "integrity": "sha1-AHrqM9Gk0+QgF/YkhIrVjSEvgU8=", + "dev": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "1.0.1", + "escape-html": "1.0.3", + "on-finished": "2.3.0", + "parseurl": "1.3.2", + "statuses": "1.3.1", + "unpipe": "1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, - "optional": true, "requires": { - "string-width": "1.0.2" + "ms": "2.0.0" } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true } } }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + }, + "find-versions": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-1.2.1.tgz", + "integrity": "sha1-y96fEuOFdaCvG+G5osXV/Y8Ya2I=", + "dev": true, + "requires": { + "array-uniq": "1.0.3", + "get-stdin": "4.0.1", + "meow": "3.7.0", + "semver-regex": "1.0.0" + } + }, + "first-chunk-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", + "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", + "dev": true + }, + "flatten": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", + "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=", + "dev": true + }, + "font-awesome": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/font-awesome/-/font-awesome-4.7.0.tgz", + "integrity": "sha1-j6jPBBGhoxr9B7BtKQK7n8gVoTM=" + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "1.0.2" + } + }, + "foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.15" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", + "dev": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "0.2.2" + } + }, + "fresh": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz", + "integrity": "sha1-9HTKXmqSRtb9jglTz6m5yAWvp44=", + "dev": true + }, + "friendly-errors-webpack-plugin": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.6.1.tgz", + "integrity": "sha1-4yeBxHIvVGoGqbXXp8+ihSA3XXA=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "error-stack-parser": "2.0.1", + "string-length": "1.0.1" + } + }, + "from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", + "dev": true + }, + "fs-extra": { + "version": "0.26.7", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.26.7.tgz", + "integrity": "sha1-muH92UiXeY7at20JGM9C0MMYT6k=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "jsonfile": "2.4.0", + "klaw": "1.3.1", + "path-is-absolute": "1.0.1", + "rimraf": "2.6.2" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, "fstream": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", @@ -11784,6 +10943,33 @@ } } }, + "scrypt": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/scrypt/-/scrypt-6.0.3.tgz", + "integrity": "sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0=", + "requires": { + "nan": "2.6.2" + } + }, + "scrypt.js": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/scrypt.js/-/scrypt.js-0.2.0.tgz", + "integrity": "sha1-r40UZbcemZARC+38WTuUeeA6ito=", + "requires": { + "scrypt": "6.0.3", + "scryptsy": "1.2.1" + }, + "dependencies": { + "scryptsy": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-1.2.1.tgz", + "integrity": "sha1-oyJfpLJST4AnAHYeKFW987LZIWM=", + "requires": { + "pbkdf2": "3.0.12" + } + } + } + }, "scryptsy": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-2.0.0.tgz", @@ -13784,6 +12970,11 @@ } } }, + "utf8": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", + "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=" + }, "util": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", diff --git a/package.json b/package.json index 6e57dac5dc4..ea41cc9da45 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "ethereumjs-abi": "^0.6.4", "ethereumjs-tx": "^1.3.3", "ethereumjs-util": "^5.1.2", + "ethereumjs-wallet": "^0.6.0", "font-awesome": "^4.7.0", "hdkey": "^0.7.1", "idna-uts46": "^1.1.0", From 3924dad915fef9a704c81b707285858397928e0b Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Sat, 21 Oct 2017 13:01:45 -0400 Subject: [PATCH 02/11] Add hdkey module + better wallet typing --- common/typescript/ethereumjs-wallet.d.ts | 137 ++++++++++++++++++++++- 1 file changed, 133 insertions(+), 4 deletions(-) diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts index d48940a0e41..e789f364233 100644 --- a/common/typescript/ethereumjs-wallet.d.ts +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -1,3 +1,66 @@ +declare module 'ethereumjs-wallet/hdkey' { + import { Buffer } from 'buffer'; + import { PublicKeyOnlyWallet, FullWallet } from 'ethereumjs-wallet'; + + interface IHDNodePublic { + /** + * @description return a BIP32 extended public key (xpub) + */ + publicExtendedKey(): string; + + /** + * @description derive a node based on a path (e.g. m/44'/0'/0/1) + */ + derivePath(path: string): IHDNodePublic; + + /** + * @description derive a node based on a child index + */ + deriveChild(index): IHDNodePublic; + + /** + * @description return a Wallet instance + */ + getWallet(): PublicKeyOnlyWallet; + } + + /** + * + * + * @interface IHDNodePrivate + */ + interface IHDNodePrivate { + /** + * @description return a BIP32 extended private key (xprv) + */ + privateExtendedKey(): string; + + /** + * @description return a BIP32 extended public key (xpub) + */ + publicExtendedKey(): string; + + /** + * @description derive a node based on a path (e.g. m/44'/0'/0/1) + */ + derivePath(path: string): IHDNodePrivate | IHDNodePublic; + + /** + * @description derive a node based on a child index + */ + deriveChild(index): IHDNodePrivate | IHDNodePublic; + + /** + * @description return a Wallet instance + */ + getWallet(): FullWallet; + } + + function fromMasterSeed(seed: Buffer): IHDNodePrivate; + + function fromExtendedKey(key: string): IHDNodePrivate | IHDNodePublic; +} + declare module 'ethereumjs-wallet' { import { Buffer } from 'buffer'; @@ -24,6 +87,25 @@ declare module 'ethereumjs-wallet' { c: number; } + interface IV1Wallet { + Version: 1; + Crypto: { + KeyHeader: { + Kdf: 'scrypt'; + KdfParams: { + N: number; + R: number; + P: number; + DkLen: number; + }; + }; + MAC: string; + CipherText: string; + Salt: string; + IV: string; + }; + } + interface IV3Wallet { version: 3; crypto: { @@ -38,6 +120,20 @@ declare module 'ethereumjs-wallet' { }; } + interface IEtherWalletLocked { + private: string; + encrypted: true; + address: string; + locked: true; + } + + interface IEtherWalletUnlocked { + private: string; + locked: false; + encrypted: false; + address: string; + } + interface IV3Options { salt?: Buffer; // Random salt for the kdf. Size must match the requirements of the KDF (key derivation function). Random number generated via crypto.getRandomBytes if nothing is supplied. iv?: Buffer; // Initialization vector for the cipher. Size must match the requirements of the cipher. Random number generated via crypto.getRandomBytes if nothing is supplied. @@ -47,27 +143,60 @@ declare module 'ethereumjs-wallet' { cipher?: string | 'aes-128-ctr' | 'aes-128-cbc'; // The cipher to use. Names must match those of supported by OpenSSL, e.g. aes-128-ctr or aes-128-cbc. /* pbkdf2 */ - c?: number; // Number of iterations. Defaults to 262144. /* scrypt */ - n?: number; // Iteration count. Defaults to 262144. r?: number; // Block size for the underlying hash. Defaults to 8. p?: number; // Parallelization factor. Defaults to 1. } class PublicKeyOnlyWallet { + /** + * @description return the public key + */ getPublicKey(): Buffer; //only returns uncompressed Ethereum-style public keys. + + /** + * @description return the public key + */ getPublicKeyString(): string; + + /** + * @description return the address + */ getAddress(): Buffer; + + /** + * + * @description return the address + */ getAddressString(): string; + + /** + * @description return the address with checksum + */ getChecksumAddressString(): string; + + /** + * @description return the suggested filename for V3 keystores + */ getV3Filename(timestamp?: number); } class FullWallet extends PublicKeyOnlyWallet { + /** + * @description return the private key + */ getPrivateKey(): Buffer; + + /** + * @description return the private key + */ getPrivateKeyString(): string; + + /** + * @description return the wallet as a JSON string (Version 3 of the Ethereum wallet format) + */ toV3(password: string, options?: IV3Options); } @@ -119,7 +248,7 @@ declare module 'ethereumjs-wallet' { * @param input * @param password */ - function fromV1(input: object | string, password: string): FullWallet; + function fromV1(input: IV1Wallet | string, password: string): FullWallet; /** * @description import a wallet (Version 3 of the Ethereum wallet format). Set nonStrict true to accept files with mixed-caps. @@ -156,7 +285,7 @@ declare module 'ethereumjs-wallet' { * @param password */ function fromEtherWallet( - input: object | string, + input: IEtherWalletLocked | IEtherWalletUnlocked | string, password: string ): FullWallet; From de8e6075a98cfb526c96efe1750f4c94bb43bc61 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Sat, 21 Oct 2017 13:12:20 -0400 Subject: [PATCH 03/11] Add provider-engine typings --- common/typescript/ethereumjs-wallet.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts index e789f364233..3441aa19528 100644 --- a/common/typescript/ethereumjs-wallet.d.ts +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -1,3 +1,13 @@ +/** + * Incomplete -- Provider-engine needs its own typings + */ +declare module 'ethereumjs-wallet/provider-engine' { + import { PublicKeyOnlyWallet, FullWallet } from 'ethereumjs-wallet'; + class WalletSubprovider { + constructor(wallet: PublicKeyOnlyWallet | FullWallet, opts: object); + } +} + declare module 'ethereumjs-wallet/hdkey' { import { Buffer } from 'buffer'; import { PublicKeyOnlyWallet, FullWallet } from 'ethereumjs-wallet'; From 143c7ebed5f992014743f6eb77ad9458e2fa1d1e Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Sat, 21 Oct 2017 13:20:13 -0400 Subject: [PATCH 04/11] Add jsdoc descriptions for hdkey constructor methods --- common/typescript/ethereumjs-wallet.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts index 3441aa19528..0983b6a017d 100644 --- a/common/typescript/ethereumjs-wallet.d.ts +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -66,8 +66,14 @@ declare module 'ethereumjs-wallet/hdkey' { getWallet(): FullWallet; } + /** + * @description create an instance based on a seed + */ function fromMasterSeed(seed: Buffer): IHDNodePrivate; + /** + * @description create an instance based on a BIP32 extended private or public key + */ function fromExtendedKey(key: string): IHDNodePrivate | IHDNodePublic; } From 28a8047b3d0dc68ee6f8a70a91a09da3e19a1834 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Sat, 21 Oct 2017 15:11:41 -0400 Subject: [PATCH 05/11] Fix missing return type --- common/typescript/ethereumjs-wallet.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts index 0983b6a017d..c06f1cbe2db 100644 --- a/common/typescript/ethereumjs-wallet.d.ts +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -213,7 +213,7 @@ declare module 'ethereumjs-wallet' { /** * @description return the wallet as a JSON string (Version 3 of the Ethereum wallet format) */ - toV3(password: string, options?: IV3Options); + toV3(password: string, options?: IV3Options): string; } /** From 9aab2faea60a52c5a3d3424e5a0115e19f2a6f46 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Sat, 21 Oct 2017 15:13:52 -0400 Subject: [PATCH 06/11] Fix another missing return --- common/typescript/ethereumjs-wallet.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts index c06f1cbe2db..a4d1e1a4f74 100644 --- a/common/typescript/ethereumjs-wallet.d.ts +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -197,7 +197,7 @@ declare module 'ethereumjs-wallet' { /** * @description return the suggested filename for V3 keystores */ - getV3Filename(timestamp?: number); + getV3Filename(timestamp?: number): string; } class FullWallet extends PublicKeyOnlyWallet { /** From 77cb185720f3b3a397479be024e785c0279452ff Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Sat, 21 Oct 2017 15:15:41 -0400 Subject: [PATCH 07/11] Make provider engine options optional --- common/typescript/ethereumjs-wallet.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts index a4d1e1a4f74..614dfed93b1 100644 --- a/common/typescript/ethereumjs-wallet.d.ts +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -4,7 +4,7 @@ declare module 'ethereumjs-wallet/provider-engine' { import { PublicKeyOnlyWallet, FullWallet } from 'ethereumjs-wallet'; class WalletSubprovider { - constructor(wallet: PublicKeyOnlyWallet | FullWallet, opts: object); + constructor(wallet: PublicKeyOnlyWallet | FullWallet, opts?: object); } } From 2d5f3908cbe2851c9f322cd38e7b3cfdbd9f1aa5 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Sat, 21 Oct 2017 15:22:11 -0400 Subject: [PATCH 08/11] Add priv/pubkey members to wallet instance --- common/typescript/ethereumjs-wallet.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts index 614dfed93b1..d8b2a78198b 100644 --- a/common/typescript/ethereumjs-wallet.d.ts +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -168,6 +168,8 @@ declare module 'ethereumjs-wallet' { } class PublicKeyOnlyWallet { + _pubKey: string; + /** * @description return the public key */ @@ -200,6 +202,8 @@ declare module 'ethereumjs-wallet' { getV3Filename(timestamp?: number): string; } class FullWallet extends PublicKeyOnlyWallet { + _privKey: string; + /** * @description return the private key */ From dfdd3a98354d4066aaa950a78f4ec39714665988 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Sat, 21 Oct 2017 16:52:17 -0400 Subject: [PATCH 09/11] Use proper interface naming for V3Wallet --- common/typescript/ethereumjs-wallet.d.ts | 46 ++++++++++++------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts index d8b2a78198b..1b5bea22f69 100644 --- a/common/typescript/ethereumjs-wallet.d.ts +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -2,15 +2,15 @@ * Incomplete -- Provider-engine needs its own typings */ declare module 'ethereumjs-wallet/provider-engine' { - import { PublicKeyOnlyWallet, FullWallet } from 'ethereumjs-wallet'; + import { PublicKeyOnlyWallet, IFullWallet } from 'ethereumjs-wallet'; class WalletSubprovider { - constructor(wallet: PublicKeyOnlyWallet | FullWallet, opts?: object); + constructor(wallet: PublicKeyOnlyWallet | IFullWallet, opts?: object); } } declare module 'ethereumjs-wallet/hdkey' { import { Buffer } from 'buffer'; - import { PublicKeyOnlyWallet, FullWallet } from 'ethereumjs-wallet'; + import { PublicKeyOnlyWallet, IFullWallet } from 'ethereumjs-wallet'; interface IHDNodePublic { /** @@ -63,7 +63,7 @@ declare module 'ethereumjs-wallet/hdkey' { /** * @description return a Wallet instance */ - getWallet(): FullWallet; + getWallet(): IFullWallet; } /** @@ -124,15 +124,17 @@ declare module 'ethereumjs-wallet' { interface IV3Wallet { version: 3; - crypto: { - kdf: 'scrypt' | 'pbkdf2'; - kfdparams: IScryptKdfParams | IPbkdf2KdfParams; + id: string; + address: string; + Crypto: { ciphertext: string; - mac: string; - cipher: string; cipherParams: { iv: string; }; + cipher: string | 'aes-128-ctr'; + kdf: 'scrypt' | 'pbkdf2'; + kfdparams: IScryptKdfParams | IPbkdf2KdfParams; + mac: string; }; } @@ -201,7 +203,7 @@ declare module 'ethereumjs-wallet' { */ getV3Filename(timestamp?: number): string; } - class FullWallet extends PublicKeyOnlyWallet { + class IFullWallet extends PublicKeyOnlyWallet { _privKey: string; /** @@ -217,7 +219,7 @@ declare module 'ethereumjs-wallet' { /** * @description return the wallet as a JSON string (Version 3 of the Ethereum wallet format) */ - toV3(password: string, options?: IV3Options): string; + toV3(password: string, options?: IV3Options): IV3Wallet; } /** @@ -225,27 +227,27 @@ declare module 'ethereumjs-wallet' { * @param icap * @description create an instance based on a new random key (setting icap to true will generate an address suitable for the ICAP Direct mode */ - function generate(icap?: boolean): FullWallet; + function generate(icap?: boolean): IFullWallet; /** * * @param pattern * @description create an instance where the address is valid against the supplied pattern (this will be very slow) */ - function generateVanityAddress(pattern: string | RegExp): FullWallet; + function generateVanityAddress(pattern: string | RegExp): IFullWallet; /** * @description create an instance based on a raw private key * @param input * */ - function fromPrivateKey(input: Buffer): FullWallet; + function fromPrivateKey(input: Buffer): IFullWallet; /** * @description create an instance based on a BIP32 extended private key (xprv) * @param input */ - function fromExtendedPrivateKey(input: Buffer): FullWallet; + function fromExtendedPrivateKey(input: Buffer): IFullWallet; /** * @description create an instance based on a public key (certain methods will not be available) @@ -268,7 +270,7 @@ declare module 'ethereumjs-wallet' { * @param input * @param password */ - function fromV1(input: IV1Wallet | string, password: string): FullWallet; + function fromV1(input: IV1Wallet | string, password: string): IFullWallet; /** * @description import a wallet (Version 3 of the Ethereum wallet format). Set nonStrict true to accept files with mixed-caps. @@ -280,7 +282,7 @@ declare module 'ethereumjs-wallet' { input: IV3Wallet | string, password: string, nonStrict: boolean - ): FullWallet; + ): IFullWallet; /** * @description import an Ethereum Pre Sale wallet @@ -290,14 +292,14 @@ declare module 'ethereumjs-wallet' { function fromEthSale( input: IPresaleWallet | string, password: string - ): FullWallet; + ): IFullWallet; /** * @description import a brain wallet used by Ether.Camp * @param input * @param password */ - function fromEtherCamp(passphrase: string): FullWallet; + function fromEtherCamp(passphrase: string): IFullWallet; /** * @description import a wallet generated by EtherWallet @@ -307,19 +309,19 @@ declare module 'ethereumjs-wallet' { function fromEtherWallet( input: IEtherWalletLocked | IEtherWalletUnlocked | string, password: string - ): FullWallet; + ): IFullWallet; /** * @description import a wallet from a KryptoKit seed * @param entropy * @param seed */ - function fromKryptoKit(entropy: string, seed: string): FullWallet; + function fromKryptoKit(entropy: string, seed: string): IFullWallet; /** * @description import a brain wallet used by Quorum Wallet * @param passphrase * @param userid */ - function fromQuorumWallet(passphrase: string, userid: string): FullWallet; + function fromQuorumWallet(passphrase: string, userid: string): IFullWallet; } From 926a3c090ea9574718eb2e1246180436cda24b11 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Sat, 21 Oct 2017 16:56:47 -0400 Subject: [PATCH 10/11] Use proper interface naming for PublicKeyOnlyWallet --- common/typescript/ethereumjs-wallet.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts index 1b5bea22f69..0a56d5873de 100644 --- a/common/typescript/ethereumjs-wallet.d.ts +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -2,15 +2,15 @@ * Incomplete -- Provider-engine needs its own typings */ declare module 'ethereumjs-wallet/provider-engine' { - import { PublicKeyOnlyWallet, IFullWallet } from 'ethereumjs-wallet'; + import { IPublicKeyOnlyWallet, IFullWallet } from 'ethereumjs-wallet'; class WalletSubprovider { - constructor(wallet: PublicKeyOnlyWallet | IFullWallet, opts?: object); + constructor(wallet: IPublicKeyOnlyWallet | IFullWallet, opts?: object); } } declare module 'ethereumjs-wallet/hdkey' { import { Buffer } from 'buffer'; - import { PublicKeyOnlyWallet, IFullWallet } from 'ethereumjs-wallet'; + import { IPublicKeyOnlyWallet, IFullWallet } from 'ethereumjs-wallet'; interface IHDNodePublic { /** @@ -31,7 +31,7 @@ declare module 'ethereumjs-wallet/hdkey' { /** * @description return a Wallet instance */ - getWallet(): PublicKeyOnlyWallet; + getWallet(): IPublicKeyOnlyWallet; } /** @@ -169,7 +169,7 @@ declare module 'ethereumjs-wallet' { p?: number; // Parallelization factor. Defaults to 1. } - class PublicKeyOnlyWallet { + class IPublicKeyOnlyWallet { _pubKey: string; /** @@ -203,7 +203,7 @@ declare module 'ethereumjs-wallet' { */ getV3Filename(timestamp?: number): string; } - class IFullWallet extends PublicKeyOnlyWallet { + class IFullWallet extends IPublicKeyOnlyWallet { _privKey: string; /** @@ -257,13 +257,13 @@ declare module 'ethereumjs-wallet' { function fromPublicKey( input: Buffer, nonStrict?: boolean - ): PublicKeyOnlyWallet; + ): IPublicKeyOnlyWallet; /** * @description create an instance based on a BIP32 extended public key (xpub) * @param input */ - function fromExtendedPublicKey(input: string): PublicKeyOnlyWallet; + function fromExtendedPublicKey(input: string): IPublicKeyOnlyWallet; /** * @description import a wallet (Version 1 of the Ethereum wallet format) From 5cc7582b1a8352d46b7274c8acae1817f1ae9d8b Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Fri, 27 Oct 2017 15:41:00 -0400 Subject: [PATCH 11/11] Fix definition module for thirdparty wallets --- common/typescript/ethereumjs-wallet.d.ts | 70 +++++++++++++----------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts index 0a56d5873de..af40601b6ef 100644 --- a/common/typescript/ethereumjs-wallet.d.ts +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -8,6 +8,45 @@ declare module 'ethereumjs-wallet/provider-engine' { } } +declare module 'ethereumjs-wallet/thirdparty' { + import { + IPublicKeyOnlyWallet, + IFullWallet, + IEtherWalletLocked, + IEtherWalletUnlocked + } from 'ethereumjs-wallet'; + /** + * @description import a brain wallet used by Ether.Camp + * @param input + * @param password + */ + function fromEtherCamp(passphrase: string): IFullWallet; + + /** + * @description import a wallet generated by EtherWallet + * @param input + * @param password + */ + function fromEtherWallet( + input: IEtherWalletLocked | IEtherWalletUnlocked | string, + password: string + ): IFullWallet; + + /** + * @description import a wallet from a KryptoKit seed + * @param entropy + * @param seed + */ + function fromKryptoKit(entropy: string, seed: string): IFullWallet; + + /** + * @description import a brain wallet used by Quorum Wallet + * @param passphrase + * @param userid + */ + function fromQuorumWallet(passphrase: string, userid: string): IFullWallet; +} + declare module 'ethereumjs-wallet/hdkey' { import { Buffer } from 'buffer'; import { IPublicKeyOnlyWallet, IFullWallet } from 'ethereumjs-wallet'; @@ -293,35 +332,4 @@ declare module 'ethereumjs-wallet' { input: IPresaleWallet | string, password: string ): IFullWallet; - - /** - * @description import a brain wallet used by Ether.Camp - * @param input - * @param password - */ - function fromEtherCamp(passphrase: string): IFullWallet; - - /** - * @description import a wallet generated by EtherWallet - * @param input - * @param password - */ - function fromEtherWallet( - input: IEtherWalletLocked | IEtherWalletUnlocked | string, - password: string - ): IFullWallet; - - /** - * @description import a wallet from a KryptoKit seed - * @param entropy - * @param seed - */ - function fromKryptoKit(entropy: string, seed: string): IFullWallet; - - /** - * @description import a brain wallet used by Quorum Wallet - * @param passphrase - * @param userid - */ - function fromQuorumWallet(passphrase: string, userid: string): IFullWallet; }