chore: remove functions not used in prod

This commit is contained in:
fryorcraken.eth 2023-03-03 13:18:16 +11:00
parent 93ba160791
commit a513087637
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
3 changed files with 3 additions and 12 deletions

View File

@ -2,14 +2,6 @@ import * as secp from "@noble/secp256k1";
import { concat } from "@waku/utils"; import { concat } from "@waku/utils";
import sha3 from "js-sha3"; import sha3 from "js-sha3";
export const randomBytes = secp.utils.randomBytes;
/**
* Return the public key for the given private key, to be used for asymmetric
* encryption.
*/
export const getPublicKey = secp.getPublicKey;
/** /**
* ECDSA Sign a message with the given private key. * ECDSA Sign a message with the given private key.
* *

View File

@ -1,12 +1,12 @@
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory"; import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
import { multiaddr } from "@multiformats/multiaddr"; import { multiaddr } from "@multiformats/multiaddr";
import * as secp from "@noble/secp256k1";
import type { Waku2 } from "@waku/interfaces"; import type { Waku2 } from "@waku/interfaces";
import { bytesToHex, hexToBytes, utf8ToBytes } from "@waku/utils"; import { bytesToHex, hexToBytes, utf8ToBytes } from "@waku/utils";
import { assert, expect } from "chai"; import { assert, expect } from "chai";
import { equals } from "uint8arrays/equals"; import { equals } from "uint8arrays/equals";
import { ERR_INVALID_ID } from "./constants.js"; import { ERR_INVALID_ID } from "./constants.js";
import { getPublicKey } from "./crypto.js";
import { ENR } from "./enr.js"; import { ENR } from "./enr.js";
import { getPrivateKeyFromPeerId } from "./peer_id.js"; import { getPrivateKeyFromPeerId } from "./peer_id.js";
@ -194,7 +194,7 @@ describe("ENR", function () {
privateKey = hexToBytes( privateKey = hexToBytes(
"b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291" "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291"
); );
record = await ENR.createV4(getPublicKey(privateKey)); record = await ENR.createV4(secp.getPublicKey(privateKey));
record.setLocationMultiaddr(multiaddr("/ip4/127.0.0.1/udp/30303")); record.setLocationMultiaddr(multiaddr("/ip4/127.0.0.1/udp/30303"));
record.seq = seq; record.seq = seq;
await record.encodeTxt(privateKey); await record.encodeTxt(privateKey);
@ -239,7 +239,7 @@ describe("ENR", function () {
privateKey = hexToBytes( privateKey = hexToBytes(
"b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291" "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291"
); );
record = await ENR.createV4(getPublicKey(privateKey)); record = await ENR.createV4(secp.getPublicKey(privateKey));
}); });
it("should get / set UDP multiaddr", () => { it("should get / set UDP multiaddr", () => {

View File

@ -3,7 +3,6 @@ import type { NodeId } from "@waku/interfaces";
import { bytesToHex } from "@waku/utils"; import { bytesToHex } from "@waku/utils";
import { keccak256 } from "./crypto.js"; import { keccak256 } from "./crypto.js";
export async function sign( export async function sign(
privKey: Uint8Array, privKey: Uint8Array,
msg: Uint8Array msg: Uint8Array