Remove dupe function

This commit is contained in:
Franck Royer 2022-05-20 11:49:00 +10:00
parent 6ace11f18f
commit 2ed3580584
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 3 additions and 10 deletions

View File

@ -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 {

View File

@ -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.
*/