use concatBytes in payloadToId

https://jsben.ch/jze3P
This commit is contained in:
Pavel Prichodko 2022-06-15 13:38:44 +02:00
parent 72d1e679fc
commit cac8fe58be
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
1 changed files with 2 additions and 2 deletions

View File

@ -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}`