arx-research / libhalo

LibHaLo - Programmatically interact with HaLo tags from the web browser, mobile application or the desktop.
https://arx.org/?source=gh
MIT License
35 stars 5 forks source link

HaLo: Fix EIP-191 signing for format=hex. #298

Closed icedevml closed 8 months ago

icedevml commented 8 months ago

Description

Fix a bug that caused EIP-191 hex-formatted messages to be signed incorrectly (as UTF-8 strings). Add a possibility to pass the message in hex format with 0x prefix.

Checklist

Changes to the drivers

Changes to CLI

Changes to web library

Changes to nfc-manager driver

bweick commented 8 months ago

ok this looks right to me. Think we're gonna try to do an E2E test at some point simulating the factory as well to make sure it's good but I'm getting: ethers.utils.hashMessage(ethers.utils.arrayify("0x010203"))

Which is equivalent of on-chain hashing with EIP-191 to equal out target: bcf83051a4d206c6e43d7eaa4c75429737ac0d5ee08ee68430443bd815e6ac05