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:
Song Zhou
2021-08-02 06:18:58 +02:00
committed by GitHub
co-authored by Jaco
parent c6ff77b56f
commit 7eddfc25c9
9 changed files with 179 additions and 9 deletions
@@ -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;
}
+1
View File
@@ -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';