mirror of https://github.com/waku-org/js-waku.git
chore: remove functions not used in prod
This commit is contained in:
parent
93ba160791
commit
a513087637
|
@ -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.
|
||||||
*
|
*
|
||||||
|
|
|
@ -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", () => {
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue