From cac8fe58be613bfd4cc0cb8819c3440cad6737f9 Mon Sep 17 00:00:00 2001 From: Pavel Prichodko <14926950+prichodko@users.noreply.github.com> Date: Wed, 15 Jun 2022 13:38:44 +0200 Subject: [PATCH] use concatBytes in payloadToId https://jsben.ch/jze3P --- packages/status-js/src/utils/payload-to-id.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/status-js/src/utils/payload-to-id.ts b/packages/status-js/src/utils/payload-to-id.ts index bf721398..2b2181f1 100644 --- a/packages/status-js/src/utils/payload-to-id.ts +++ b/packages/status-js/src/utils/payload-to-id.ts @@ -1,11 +1,11 @@ import { keccak256 } from 'ethereum-cryptography/keccak' -import { bytesToHex } from 'ethereum-cryptography/utils' +import { bytesToHex, concatBytes } from 'ethereum-cryptography/utils' export function payloadToId( payload: Uint8Array, publicKey: Uint8Array ): string { - const hash = keccak256(new Uint8Array([...publicKey, ...payload])) + const hash = keccak256(concatBytes(payload, publicKey)) const hex = bytesToHex(hash) return `0x${hex}`