mirror of https://github.com/waku-org/js-waku.git
Remove file
This commit is contained in:
parent
c6189170e0
commit
17c8335d6f
|
@ -1,10 +0,0 @@
|
||||||
import { bytesToHex } from "../utils";
|
|
||||||
|
|
||||||
import { NodeId } from "./types";
|
|
||||||
|
|
||||||
export function createNodeId(bytes: Uint8Array): NodeId {
|
|
||||||
if (bytes.length !== 32) {
|
|
||||||
throw new Error("NodeId must be 32 bytes in length");
|
|
||||||
}
|
|
||||||
return bytesToHex(bytes);
|
|
||||||
}
|
|
|
@ -3,6 +3,5 @@ export const v4 = v4Crypto;
|
||||||
export * from "./constants";
|
export * from "./constants";
|
||||||
export * from "./enr";
|
export * from "./enr";
|
||||||
export * from "./types";
|
export * from "./types";
|
||||||
export * from "./create";
|
|
||||||
export * from "./keypair";
|
export * from "./keypair";
|
||||||
export * from "./waku2_codec";
|
export * from "./waku2_codec";
|
||||||
|
|
|
@ -3,7 +3,6 @@ import * as secp from "@noble/secp256k1";
|
||||||
import { keccak256 } from "../crypto";
|
import { keccak256 } from "../crypto";
|
||||||
import { bytesToHex } from "../utils";
|
import { bytesToHex } from "../utils";
|
||||||
|
|
||||||
import { createNodeId } from "./create";
|
|
||||||
import { NodeId } from "./types";
|
import { NodeId } from "./types";
|
||||||
|
|
||||||
export function compressPublicKey(publicKey: Uint8Array): Uint8Array {
|
export function compressPublicKey(publicKey: Uint8Array): Uint8Array {
|
||||||
|
@ -33,6 +32,13 @@ export function verify(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createNodeId(bytes: Uint8Array): NodeId {
|
||||||
|
if (bytes.length !== 32) {
|
||||||
|
throw new Error("NodeId must be 32 bytes in length");
|
||||||
|
}
|
||||||
|
return bytesToHex(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
export function nodeId(pubKey: Uint8Array): NodeId {
|
export function nodeId(pubKey: Uint8Array): NodeId {
|
||||||
const publicKey = secp.Point.fromHex(pubKey);
|
const publicKey = secp.Point.fromHex(pubKey);
|
||||||
const uncompressedPubkey = publicKey.toRawBytes(false);
|
const uncompressedPubkey = publicKey.toRawBytes(false);
|
||||||
|
|
Loading…
Reference in New Issue