Remove ed2curve dependency (#1265)
* Remove edcurve dependency * browser overrides * Remove bundledDependencies
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
{
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"browser": {
|
||||
"crypto": false,
|
||||
"stream": false
|
||||
},
|
||||
"bugs": "https://github.com/polkadot-js/common/issues",
|
||||
"bundledDependencies": [
|
||||
"@noble/hashes"
|
||||
],
|
||||
"contributors": [],
|
||||
"description": "A collection of useful crypto utilities for @polkadot",
|
||||
"engines": {
|
||||
@@ -34,15 +35,14 @@
|
||||
"@polkadot/util": "8.0.6-2",
|
||||
"@polkadot/wasm-crypto": "^4.4.1",
|
||||
"@polkadot/x-randomvalues": "8.0.6-2",
|
||||
"@stablelib/ed25519": "^1.0.2",
|
||||
"bn.js": "^4.12.0",
|
||||
"ed2curve": "^0.3.0",
|
||||
"elliptic": "^6.5.4",
|
||||
"micro-base": "^0.9.0",
|
||||
"tweetnacl": "^1.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"@types/ed2curve": "^0.2.2",
|
||||
"@types/elliptic": "^6.4.14"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import ed2curve from 'ed2curve';
|
||||
|
||||
import { assertReturn } from '@polkadot/util';
|
||||
|
||||
export function convertSecretKeyToCurve25519 (secretKey: Uint8Array): Uint8Array {
|
||||
return ed2curve.convertSecretKey(secretKey);
|
||||
}
|
||||
import { convertPublicKeyToX25519, convertSecretKeyToX25519 } from '@stablelib/ed25519';
|
||||
|
||||
export function convertPublicKeyToCurve25519 (publicKey: Uint8Array): Uint8Array {
|
||||
return assertReturn(ed2curve.convertPublicKey(publicKey), 'Unable to convert publicKey to ed25519');
|
||||
return convertPublicKeyToX25519(publicKey);
|
||||
}
|
||||
|
||||
export function convertSecretKeyToCurve25519 (secretKey: Uint8Array): Uint8Array {
|
||||
return convertSecretKeyToX25519(secretKey);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
import type { Keypair } from '../../types';
|
||||
|
||||
import nacl from 'tweetnacl';
|
||||
import { randomAsU8a } from '../../random';
|
||||
import { ed25519PairFromSeed } from './fromSeed';
|
||||
|
||||
/**
|
||||
* @name ed25519PairFromRandom
|
||||
@@ -20,5 +21,5 @@ import nacl from 'tweetnacl';
|
||||
* ```
|
||||
*/
|
||||
export function ed25519PairFromRandom (): Keypair {
|
||||
return nacl.sign.keyPair();
|
||||
return ed25519PairFromSeed(randomAsU8a());
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
import type { Keypair } from '../../types';
|
||||
|
||||
import { stringToU8a } from '@polkadot/util';
|
||||
|
||||
import { blake2AsU8a } from '../../blake2/asU8a';
|
||||
import { ed25519PairFromSeed } from './fromSeed';
|
||||
|
||||
@@ -24,9 +22,6 @@ import { ed25519PairFromSeed } from './fromSeed';
|
||||
*/
|
||||
export function ed25519PairFromString (value: string): Keypair {
|
||||
return ed25519PairFromSeed(
|
||||
blake2AsU8a(
|
||||
stringToU8a(value),
|
||||
256
|
||||
)
|
||||
blake2AsU8a(value)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2096,11 +2096,10 @@ __metadata:
|
||||
"@polkadot/util": 8.0.6-2
|
||||
"@polkadot/wasm-crypto": ^4.4.1
|
||||
"@polkadot/x-randomvalues": 8.0.6-2
|
||||
"@stablelib/ed25519": ^1.0.2
|
||||
"@types/bn.js": ^4.11.6
|
||||
"@types/ed2curve": ^0.2.2
|
||||
"@types/elliptic": ^6.4.14
|
||||
bn.js: ^4.12.0
|
||||
ed2curve: ^0.3.0
|
||||
elliptic: ^6.5.4
|
||||
micro-base: ^0.9.0
|
||||
tweetnacl: ^1.0.3
|
||||
@@ -2335,6 +2334,68 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@stablelib/binary@npm:^1.0.1":
|
||||
version: 1.0.1
|
||||
resolution: "@stablelib/binary@npm:1.0.1"
|
||||
dependencies:
|
||||
"@stablelib/int": ^1.0.1
|
||||
checksum: dca9b98eb1f56a4002b5b9e7351fbc49f3d8616af87007c01e833bd763ac89214eb5f3b7e18673c91ce59d4a0e4856a2eb661ace33d39f17fb1ad267271fccd8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@stablelib/ed25519@npm:^1.0.2":
|
||||
version: 1.0.2
|
||||
resolution: "@stablelib/ed25519@npm:1.0.2"
|
||||
dependencies:
|
||||
"@stablelib/random": ^1.0.1
|
||||
"@stablelib/sha512": ^1.0.1
|
||||
"@stablelib/wipe": ^1.0.1
|
||||
checksum: 07cacaf599a2f23a565f0d5720a23de913407c3003a12920cad11c8096074fca6e6a1a660ead88dfe9241f0d39ad50ada2d7ec0b85858089fbc2655a90482389
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@stablelib/hash@npm:^1.0.1":
|
||||
version: 1.0.1
|
||||
resolution: "@stablelib/hash@npm:1.0.1"
|
||||
checksum: 3ff1f12d1a4082aaf4b6cdf40c2010aabe5c4209d3b40b97b5bbb0d9abc0ee94abdc545e57de0614afaea807ca0212ac870e247ec8f66cdce91ec39ce82948cf
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@stablelib/int@npm:^1.0.1":
|
||||
version: 1.0.1
|
||||
resolution: "@stablelib/int@npm:1.0.1"
|
||||
checksum: 65bfbf50a382eea70c68e05366bf379cfceff8fbc076f1c267ef2f2411d7aed64fd140c415cb6c29f19a3910d3b8b7805d4b32ad5721a5007a8e744a808c7ae3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@stablelib/random@npm:^1.0.1":
|
||||
version: 1.0.1
|
||||
resolution: "@stablelib/random@npm:1.0.1"
|
||||
dependencies:
|
||||
"@stablelib/binary": ^1.0.1
|
||||
"@stablelib/wipe": ^1.0.1
|
||||
checksum: f63275079a588dab1594949996dbd564f3754d313368be8c70c06eea9c9a4fba9059962dcd114cafcca48b3b73707774ce8af2c94b7be79b662cde35d0049846
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@stablelib/sha512@npm:^1.0.1":
|
||||
version: 1.0.1
|
||||
resolution: "@stablelib/sha512@npm:1.0.1"
|
||||
dependencies:
|
||||
"@stablelib/binary": ^1.0.1
|
||||
"@stablelib/hash": ^1.0.1
|
||||
"@stablelib/wipe": ^1.0.1
|
||||
checksum: b7c82f7608a35948a2147a534c0c9afc80deab3fd5f72a2e27b2454e7c0c6944d39381be3abcb1b7fac5b824ba030ae3e98209d517a579c143d8ed63930b042f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@stablelib/wipe@npm:^1.0.1":
|
||||
version: 1.0.1
|
||||
resolution: "@stablelib/wipe@npm:1.0.1"
|
||||
checksum: 287802eb146810a46ba72af70b82022caf83a8aeebde23605f5ee0decf64fe2b97a60c856e43b6617b5801287c30cfa863cfb0469e7fcde6f02d143cf0c6cbf4
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@szmarczak/http-timer@npm:^1.1.2":
|
||||
version: 1.1.2
|
||||
resolution: "@szmarczak/http-timer@npm:1.1.2"
|
||||
@@ -2411,15 +2472,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/ed2curve@npm:^0.2.2":
|
||||
version: 0.2.2
|
||||
resolution: "@types/ed2curve@npm:0.2.2"
|
||||
dependencies:
|
||||
tweetnacl: ^1.0.0
|
||||
checksum: f1ab16d46c5eed50d51539effef76c87806bb53ab45ecff78c19a632e63825fd08d604984b08778f8201c79be0bd43120565dad38cc5d45ba65a6c7de5bf4ace
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/elliptic@npm:^6.4.14":
|
||||
version: 6.4.14
|
||||
resolution: "@types/elliptic@npm:6.4.14"
|
||||
@@ -4519,15 +4571,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ed2curve@npm:^0.3.0":
|
||||
version: 0.3.0
|
||||
resolution: "ed2curve@npm:0.3.0"
|
||||
dependencies:
|
||||
tweetnacl: 1.x.x
|
||||
checksum: 6dfbe2310aa5a47372c9dd2fd920be140c8d52aea5793d716a3e3865d2ceaeaf639a7653e5492dfe3b4910eaf65c09a1d5132580afe2fdca18a75ebb428a52f2
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"electron-to-chromium@npm:^1.3.896":
|
||||
version: 1.3.901
|
||||
resolution: "electron-to-chromium@npm:1.3.901"
|
||||
@@ -10014,13 +10057,6 @@ resolve@^2.0.0-next.3:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tweetnacl@npm:1.x.x, tweetnacl@npm:^1.0.0, tweetnacl@npm:^1.0.3":
|
||||
version: 1.0.3
|
||||
resolution: "tweetnacl@npm:1.0.3"
|
||||
checksum: e4a57cac188f0c53f24c7a33279e223618a2bfb5fea426231991652a13247bea06b081fd745d71291fcae0f4428d29beba1b984b1f1ce6f66b06a6d1ab90645c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tweetnacl@npm:^0.14.3, tweetnacl@npm:~0.14.0":
|
||||
version: 0.14.5
|
||||
resolution: "tweetnacl@npm:0.14.5"
|
||||
@@ -10028,6 +10064,13 @@ resolve@^2.0.0-next.3:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tweetnacl@npm:^1.0.3":
|
||||
version: 1.0.3
|
||||
resolution: "tweetnacl@npm:1.0.3"
|
||||
checksum: e4a57cac188f0c53f24c7a33279e223618a2bfb5fea426231991652a13247bea06b081fd745d71291fcae0f4428d29beba1b984b1f1ce6f66b06a6d1ab90645c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"type-check@npm:^0.4.0, type-check@npm:~0.4.0":
|
||||
version: 0.4.0
|
||||
resolution: "type-check@npm:0.4.0"
|
||||
|
||||
Reference in New Issue
Block a user