Skip to content

Commit 1943d7b

Browse files
committed
Rewrite the package. Use 3 deps instead of 39
1 parent 451dc49 commit 1943d7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+24266
-19616
lines changed

.gitmodules

Lines changed: 0 additions & 6 deletions
This file was deleted.

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
language: node_js
22

33
node_js:
4-
- 10
54
- 12
6-
- 13
75
- 14
6+
- 16
87

98
install:
109
- npm i

LICENSE

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
1-
bip39-without-wordlist.js is based on bip39, which is released under the
2-
ISC license by the Wei Lu and Daniel Cousens. Its license complete license can be found here: https://github.com/bitcoinjs/bip39/blob/0a0e74eac9f4b753939dd6368984900fdba1975b/LICENSE
1+
The MIT License (MIT)
32

4-
hdkey-without-crypto.js is based on hdkey, which is released under the
5-
MIT license by the cryptocoinjs. Its license complete license can be found here: https://github.com/cryptocoinjs/hdkey/blob/87d5495ac8e4dfe9917ddcebf6788ce69c0695ff/LICENSE
3+
Copyright (c) 2021 Patricio Palladino, Paul Miller, ethereum-cryptography contributors
64

7-
The rest of the project is released under this license:
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the “Software”), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
811

9-
Copyright 2019 The ethereum-cryptography contributors
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
1014

11-
Permission is hereby granted, free of charge, to any person obtaining a copy of
12-
this software and associated documentation files (the "Software"), to deal in
13-
the Software without restriction, including without limitation the rights to
14-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
15-
the Software, and to permit persons to whom the Software is furnished to do so,
16-
subject to the following conditions:
17-
18-
The above copyright notice and this permission notice shall be included in all
19-
copies or substantial portions of the Software.
20-
21-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
23-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
24-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
25-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

bip39-lib

Lines changed: 0 additions & 1 deletion
This file was deleted.

bip39-without-wordlists-config/README.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

bip39-without-wordlists-config/empty-module.js

Whitespace-only changes.

bip39-without-wordlists-config/rollup.config.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

hdkey

Lines changed: 0 additions & 1 deletion
This file was deleted.

hdkey-without-crypto-config/README.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

hdkey-without-crypto-config/crypto-shim.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

hdkey-without-crypto-config/rollup.config.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

hdkey-without-crypto-config/secp256k1-shim.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 25 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"name": "ethereum-cryptography",
3-
"version": "0.1.3",
3+
"version": "1.0.0",
44
"description": "All the cryptographic primitives used in Ethereum",
55
"contributors": [
66
{
77
"name": "Patricio Palladino",
88
"email": "[email protected]"
9+
},
10+
{
11+
"name": "Paul Miller",
12+
"url": "https://paulmillr.com"
913
}
1014
],
1115
"repository": "github:ethereum/js-ethereum-cryptography",
@@ -33,34 +37,22 @@
3337
"hdkeys"
3438
],
3539
"main": "./index.js",
36-
"types": "./index.d.ts",
3740
"files": [
3841
"src",
39-
"vendor",
40-
"shims",
4142
"bip39",
4243
"*.js",
4344
"*.js.map",
4445
"*.d.ts",
45-
"*.d.ts.map",
46-
"pure/**/*.js",
47-
"pure/**/*.js.map",
48-
"pure/**/*.d.ts",
49-
"pure/**/*.d.ts.map"
46+
"*.d.ts.map"
5047
],
51-
"browser": {
52-
"./hdkey.js": "./pure/hdkey.js",
53-
"./ripemd160.js": "./pure/ripemd160.js",
54-
"./sha256.js": "./pure/sha256.js"
55-
},
5648
"sideEffects": false,
5749
"scripts": {
5850
"prepare": "npm run build",
59-
"build": "npm-run-all build:tsc hdkey-without-crypto:build hdkey-without-crypto:copy bip39-without-wordlists:build bip39-without-wordlists:copy",
51+
"build": "npm-run-all build:tsc",
6052
"build:tsc": "tsc --project tsconfig.prod.json",
61-
"test": "npm-run-all hdkey-without-crypto:build bip39-without-wordlists:build test:node",
53+
"test": "npm-run-all test:node",
6254
"test:node": "mocha",
63-
"clean": "rimraf vendor test-builds pure shims hdkey-without-crypto-build bip39-without-wordlists-build bip39 '*.js' '*.js.map' '*.d.ts' '*.d.ts.map' 'src/**/*.js'",
55+
"clean": "rimraf test-builds bip39 '*.js' '*.js.map' '*.d.ts' '*.d.ts.map' 'src/**/*.js'",
6456
"lint": "tslint --project tsconfig.json",
6557
"lint:fix": "tslint --fix --project tsconfig.json",
6658
"browser-tests": "npm-run-all browser-tests:build browser-tests:test",
@@ -69,59 +61,42 @@
6961
"browser-tests:test-parcel": "karma start --single-run --browsers ChromeHeadless test/karma.parcel.conf.js",
7062
"browser-tests:test-browserify": "karma start --single-run --browsers ChromeHeadless test/karma.browserify.conf.js",
7163
"browser-tests:test-webpack": "karma start --single-run --browsers ChromeHeadless test/karma.webpack.conf.js",
72-
"browser-tests:test-rollup": "karma start --single-run --browsers ChromeHeadless test/karma.rollup.conf.js",
73-
"hdkey-without-crypto:build": "bash -x scripts/build-hdkey-without-crypto.sh",
74-
"hdkey-without-crypto:copy": "mkdir -p vendor pure/vendor && cp src/vendor/hdkey-without-crypto.js ./vendor && cp src/pure/vendor/hdkey-without-crypto.js ./pure/vendor",
75-
"bip39-without-wordlists:build": "bash -x scripts/build-bip39-without-wordlists.sh",
76-
"bip39-without-wordlists:copy": "mkdir -p vendor && cp src/vendor/bip39-without-wordlists.js ./vendor"
64+
"browser-tests:test-rollup": "karma start --single-run --browsers ChromeHeadless test/karma.rollup.conf.js"
7765
},
7866
"devDependencies": {
79-
"@types/chai": "^4.2.1",
67+
"@rollup/plugin-commonjs": "^20.0.0",
68+
"@rollup/plugin-node-resolve": "^13.0.4",
8069
"@types/mocha": "^5.2.7",
81-
"@types/node": "^8.10.52",
70+
"@types/node": "^16.9.2",
8271
"browserify": "^16.5.0",
83-
"chai": "^4.2.0",
8472
"karma": "^4.3.0",
85-
"karma-chai": "^0.1.0",
8673
"karma-chrome-launcher": "^3.1.0",
8774
"karma-mocha": "^1.3.0",
8875
"karma-mocha-reporter": "^2.2.5",
8976
"mocha": "^6.2.0",
9077
"npm-run-all": "^4.1.5",
91-
"parcel-bundler": "^1.12.3",
78+
"parcel": "^2.0.0-rc.0",
9279
"prettier": "1.18.2",
9380
"rimraf": "^3.0.0",
94-
"rollup": "^1.20.3",
95-
"rollup-plugin-alias": "^2.0.0",
81+
"rollup": "^2.53.0",
9682
"rollup-plugin-commonjs": "^10.1.0",
97-
"rollup-plugin-json": "^4.0.0",
98-
"rollup-plugin-node-builtins": "^2.1.2",
99-
"rollup-plugin-node-globals": "^1.4.0",
10083
"rollup-plugin-node-resolve": "^5.2.0",
101-
"rollup-plugin-replace": "^2.2.0",
10284
"ts-node": "^8.3.0",
10385
"tslint": "^5.19.0",
10486
"tslint-config-prettier": "^1.18.0",
10587
"tslint-plugin-prettier": "^2.0.1",
106-
"typescript": "~3.6.2",
88+
"typescript": "^4.3.5",
10789
"webpack": "^4.39.3",
10890
"webpack-cli": "^3.3.8"
10991
},
11092
"dependencies": {
111-
"@types/pbkdf2": "^3.0.0",
112-
"@types/secp256k1": "^4.0.1",
113-
"blakejs": "^1.1.0",
114-
"browserify-aes": "^1.2.0",
115-
"bs58check": "^2.1.2",
116-
"create-hash": "^1.2.0",
117-
"create-hmac": "^1.1.7",
118-
"hash.js": "^1.1.7",
119-
"keccak": "^3.0.0",
120-
"pbkdf2": "^3.0.17",
121-
"randombytes": "^2.1.0",
122-
"safe-buffer": "^5.1.2",
123-
"scrypt-js": "^3.0.0",
124-
"secp256k1": "^4.0.1",
125-
"setimmediate": "^1.0.5"
93+
"noble-hashes": "^0.1.1",
94+
"micro-base": "^0.1.1",
95+
"noble-secp256k1": "^1.2.10"
96+
},
97+
"targets": {
98+
"parcel_tests": {
99+
"context": "browser"
100+
}
126101
}
127-
}
102+
}

scripts/build-bip39-without-wordlists.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

scripts/build-browser-tests.sh

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,14 @@ set -e
33
echo "Building tests with TypeScript"
44
npx tsc --project tsconfig.json
55

6-
echo "Building hdkey-without-crypto"
7-
npm run hdkey-without-crypto:build
8-
mkdir -p test-builds/tsc/src/vendor test-builds/tsc/src/pure/vendor
9-
cp src/vendor/hdkey-without-crypto.js test-builds/tsc/src/vendor
10-
cp src/pure/vendor/hdkey-without-crypto.js test-builds/tsc/src/pure/vendor
11-
12-
echo "Building bip39-without-wordlists"
13-
npm run bip39-without-wordlists:build
14-
mkdir -p test-builds/tsc/src/vendor
15-
cp src/vendor/bip39-without-wordlists.js test-builds/tsc/src/vendor
16-
176
echo "Building tests with Parcel"
18-
npx parcel build --no-cache --no-minify test-builds/tsc/src/pure/*.js test-builds/tsc/test/pure/*.js -d test-builds/parcel
7+
npx parcel build --no-cache --no-optimize test-builds/tsc/test/test-vectors/*.js --dist-dir test-builds/parcel --target parcel_tests
198

209
echo "Building tests with Browserify"
21-
npx browserify test-builds/tsc/src/pure/*.js test-builds/tsc/test/pure/*.js > test-builds/browserify-build.js
10+
npx browserify test-builds/tsc/test/test-vectors/*.js > test-builds/browserify-build.js
2211

2312
echo "Building tests with webpack"
24-
npx webpack --mode development test-builds/tsc/src/pure/*.js test-builds/tsc/test/pure/*.js --output test-builds/webpack-build.js
13+
npx webpack --mode development test-builds/tsc/test/test-vectors/*.js --output test-builds/webpack-build.js
2514

2615
echo "Building tests with Rollup"
2716
rollup -c test/rollup.config.js

scripts/build-hdkey-without-crypto.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

scripts/check-browser-field.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ const fs = require("fs");
33
const pkg = JSON.parse(fs.readFileSync(__dirname + "/../package.json", "utf8"));
44

55
const files = fs
6-
.readdirSync(__dirname + "/../pure")
6+
.readdirSync(__dirname + "/../test-vectors")
77
.filter(f => f.endsWith(".js"));
88

99
for (const file of files) {
1010
const mapping = pkg.browser["./" + file];
11-
const expected = "./pure/" + file;
11+
const expected = "./test-vectors/" + file;
1212

1313
if (mapping !== expected) {
1414
console.error(

0 commit comments

Comments
 (0)