Sign/Verify a message
You can sign and verify messages in just 1 line of code.
Last updated
You can sign and verify messages in just 1 line of code.
Last updated
With Cometh Connect, we deploy a smart account for our users.
When you use a smart account, you need to follow the EIP1271 standard for signature verification. You have to call the isValidSignature function available on the smart contract (here is a more detailed explanation). We created a library that facilitates smart account signature verification using viem.
With Connect, we deploy the smart account at the first transaction of the user, allowing to reduce gas cost for our clients (it's a feature called lazy deployment). You might want to verify the signature of a wallet that is not yet deployed.
To facilitate that, we created an endpoint that allows you to verify an account signature, whether the account is deployed or not:
In practice, this is what it looks like:
Verify the signature for a given message following EIP1271. This will work even if the safe wallet is not deployed yet as it will use the predicted wallet address for the EOA that signed the message.
/wallets/:walletAddress/is-valid-signature
A wallet address
0x7Fc751C1725F3B955Aa8781640E1BAf5B75684c2
^0x[a-fA-F0-9]{40}$
A string representation of a customer ApiKey.
4fd84958-1bab-4e1c-9778-46d2639d3196
The signature associated to the message.
0x4D33B9C8A02EC9a892C98aA9561A3e743dF1FEA3
^0x[a-fA-F0-9]{40}$
Message signed by the user.
hello world