Add in ability to encrypt/decrypt msg with keyring (#1070)
* feat: able to encrypt & decrypt message in keyring - ed25519 & sr25519 types * chore: make eslint happy * test: add in one more test on cross-usage of ed25519 & sr25519 * make lint happy without eslint-disable * assert away secp256k1 for encrypt/decrypt * Update packages/keyring/src/pair/index.ts * Update packages/keyring/src/pair/index.ts Co-authored-by: Jaco <jacogr@gmail.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import ed2curve from 'ed2curve';
|
||||
|
||||
export function convertSecretKeyToCurve25519 (secretKey: Uint8Array): Uint8Array {
|
||||
return ed2curve.convertSecretKey(secretKey);
|
||||
}
|
||||
|
||||
export function convertPublicKeyToCurve25519 (publicKey: Uint8Array): Uint8Array {
|
||||
return ed2curve.convertPublicKey(publicKey) as Uint8Array;
|
||||
}
|
||||
@@ -15,3 +15,4 @@ export { naclVerify } from './verify';
|
||||
export { naclBoxKeypairFromSecret } from './box/fromSecret';
|
||||
export { naclOpen } from './open';
|
||||
export { naclSeal } from './seal';
|
||||
export { convertSecretKeyToCurve25519, convertPublicKeyToCurve25519 } from './convertKey';
|
||||
|
||||
Reference in New Issue
Block a user