Revert "Replace bcrypto with standalone libraries"

This commit is contained in:
Belma Gutlic
2020-04-22 19:03:41 +02:00
committed by GitHub
parent 4506936456
commit 7b11f5a3ab
11 changed files with 124 additions and 738 deletions

View File

@ -3,8 +3,8 @@ import DuplexPair from 'it-pair/duplex';
import {Noise} from "../src";
import {createPeerIdsFromFixtures} from "./fixtures/peer";
import Wrap from "it-pb-rpc";
import {random} from "bcrypto";
import sinon from "sinon";
import {randomBytes} from 'libp2p-crypto';
import {XXHandshake} from "../src/handshake-xx";
import {createHandshakePayload, generateKeypair, getHandshakePayload, getPayload, signPayload} from "../src/utils";
import {decode0, decode2, encode1, uint16BEDecode, uint16BEEncode} from "../src/encoder";
@ -122,7 +122,7 @@ describe("Noise", () => {
const wrappedInbound = Wrap(inbound.conn);
const wrappedOutbound = Wrap(outbound.conn);
const largePlaintext = randomBytes(100000);
const largePlaintext = random.randomBytes(100000);
wrappedOutbound.writeLP(largePlaintext);
const response = await wrappedInbound.read(100000);

View File

@ -1,8 +1,8 @@
import {keys} from 'libp2p-crypto';
import * as crypto from 'libp2p-crypto';
import {KeyPair, PeerId} from "../src/@types/libp2p";
export async function generateEd25519Keys() {
return await keys.generateKeyPair('ed25519');
return await crypto.keys.generateKeyPair('ed25519');
}
export function getKeyPairFromPeerId(peerId: PeerId): KeyPair {