* Revert "Remove ed2curve dependency (#1265)"
This reverts commit 7e9b2770b6.
* Adjust
This commit is contained in:
@@ -36,14 +36,15 @@
|
||||
"@polkadot/wasm-crypto": "^4.4.1",
|
||||
"@polkadot/x-noble-hashes": "8.0.6-3",
|
||||
"@polkadot/x-randomvalues": "8.0.6-3",
|
||||
"@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,12 +1,14 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { convertPublicKeyToX25519, convertSecretKeyToX25519 } from '@stablelib/ed25519';
|
||||
import ed2curve from 'ed2curve';
|
||||
|
||||
export function convertPublicKeyToCurve25519 (publicKey: Uint8Array): Uint8Array {
|
||||
return convertPublicKeyToX25519(publicKey);
|
||||
}
|
||||
import { assertReturn } from '@polkadot/util';
|
||||
|
||||
export function convertSecretKeyToCurve25519 (secretKey: Uint8Array): Uint8Array {
|
||||
return convertSecretKeyToX25519(secretKey);
|
||||
return ed2curve.convertSecretKey(secretKey);
|
||||
}
|
||||
|
||||
export function convertPublicKeyToCurve25519 (publicKey: Uint8Array): Uint8Array {
|
||||
return assertReturn(ed2curve.convertPublicKey(publicKey), 'Unable to convert publicKey to ed25519');
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
import type { Keypair } from '../../types';
|
||||
|
||||
import { stringToU8a } from '@polkadot/util';
|
||||
|
||||
import { blake2AsU8a } from '../../blake2/asU8a';
|
||||
import { ed25519PairFromSeed } from './fromSeed';
|
||||
|
||||
@@ -22,6 +24,8 @@ import { ed25519PairFromSeed } from './fromSeed';
|
||||
*/
|
||||
export function ed25519PairFromString (value: string): Keypair {
|
||||
return ed25519PairFromSeed(
|
||||
blake2AsU8a(value)
|
||||
blake2AsU8a(
|
||||
stringToU8a(value)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user