parent
72d1e679fc
commit
cac8fe58be
|
@ -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}`
|
||||
|
|
Loading…
Reference in New Issue