mirror of https://github.com/waku-org/js-waku.git
Remove dupe function
This commit is contained in:
parent
6ace11f18f
commit
2ed3580584
|
@ -2,8 +2,9 @@ import * as secp from "@noble/secp256k1";
|
|||
import * as base32 from "hi-base32";
|
||||
import { fromString } from "uint8arrays/from-string";
|
||||
|
||||
import { keccak256 } from "../crypto";
|
||||
import { ENR } from "../enr";
|
||||
import { keccak256Buf, utf8ToBytes } from "../utils";
|
||||
import { utf8ToBytes } from "../utils";
|
||||
|
||||
export type ENRRootValues = {
|
||||
eRoot: string;
|
||||
|
@ -51,7 +52,7 @@ export class ENRTree {
|
|||
const _sig = secp.Signature.fromCompact(signatureBuffer.slice(0, 64));
|
||||
isVerified = secp.verify(
|
||||
_sig,
|
||||
keccak256Buf(signedComponentBuffer),
|
||||
keccak256(signedComponentBuffer),
|
||||
new Uint8Array(decodedPublicKey)
|
||||
);
|
||||
} catch {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { keccak256, Message } from "js-sha3";
|
||||
import { fromString } from "uint8arrays/from-string";
|
||||
import { toString } from "uint8arrays/to-string";
|
||||
|
||||
|
@ -21,13 +20,6 @@ export function hexToBytes(hex: string | Uint8Array): Uint8Array {
|
|||
export const bytesToHex = (bytes: Uint8Array): string =>
|
||||
toString(bytes, "base16");
|
||||
|
||||
/**
|
||||
* Return Keccak-256 of the input.
|
||||
*/
|
||||
export function keccak256Buf(message: Message): Uint8Array {
|
||||
return new Uint8Array(keccak256.arrayBuffer(message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode byte array to utf-8 string.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue