Remove file

This commit is contained in:
Franck Royer 2022-05-20 11:27:15 +10:00
parent c6189170e0
commit 17c8335d6f
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
3 changed files with 7 additions and 12 deletions

View File

@ -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);
}

View File

@ -3,6 +3,5 @@ export const v4 = v4Crypto;
export * from "./constants";
export * from "./enr";
export * from "./types";
export * from "./create";
export * from "./keypair";
export * from "./waku2_codec";

View File

@ -3,7 +3,6 @@ import * as secp from "@noble/secp256k1";
import { keccak256 } from "../crypto";
import { bytesToHex } from "../utils";
import { createNodeId } from "./create";
import { NodeId } from "./types";
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 {
const publicKey = secp.Point.fromHex(pubKey);
const uncompressedPubkey = publicKey.toRawBytes(false);