mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-06-18 01:41:22 +00:00
Create interface according to spec
This commit is contained in:
21
src/utils.ts
Normal file
21
src/utils.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { x25519 } from 'bcrypto';
|
||||
import * as crypto from 'libp2p-crypto';
|
||||
|
||||
import { KeyPair } from "./xx";
|
||||
import { bytes } from "./types/basic";
|
||||
|
||||
export async function generateKeypair() : Promise<KeyPair> {
|
||||
const privateKey = x25519.privateKeyGenerate();
|
||||
const publicKey = x25519.publicKeyCreate(privateKey);
|
||||
|
||||
return {
|
||||
publicKey,
|
||||
privateKey,
|
||||
}
|
||||
}
|
||||
|
||||
export async function signPayload(privateKey: bytes, payload: bytes) {
|
||||
const Ed25519PrivateKey = crypto.keys.supportedKeys.ed25519.Ed25519PrivateKey;
|
||||
// const ed25519 = Ed25519PrivateKey(privateKey, "need-to-get-public-key");
|
||||
// return ed25519.sign(privateKey, payload);
|
||||
}
|
Reference in New Issue
Block a user