Content pfp
Content
@
0 reply
0 recast
0 reaction

Vladyslav Dalechyn pfp
Vladyslav Dalechyn
@dalechyn.eth
How to verify a message from Hub on client side? I see the `dataBytes` generated from the protobufs [pic1] but it always returns nothing [pic2]. Should I JSON stringify the message data? It can contain bigints so that wouldn't be serializable. What then?
4 replies
0 recast
2 reactions

Samuel pfp
Samuel
@samuellhuber.eth
How to validate messages https://github.com/farcasterxyz/hub-monorepo/blob/main/apps/hubble/src/storage/jobs/validateOrRevokeMessagesJob.ts Message utilities https://github.com/farcasterxyz/hub-monorepo/blob/main/apps/hubble/src/storage/db/message.ts
1 reply
0 recast
2 reactions

Vladyslav Dalechyn pfp
Vladyslav Dalechyn
@dalechyn.eth
Tbh didn’t figure it out. Too much code, can you pinpoint to exactly where verification happens? It all would make sense if dataBytes weren’t null - I wonder how I need to transform the data to correctly verify it. @horsefacts.eth maybe you can help with this?
2 replies
0 recast
0 reaction

Sanjay pfp
Sanjay
@sanjay
What exactly do you mean by "client side"? The best way to validate a message is to call the validateMessage endpoint on the Hub. databytes is optional, you need to protobuf encode the message to verify the signature, see https://github.com/farcasterxyz/hub-monorepo/blob/aa9cde7543886e7d109ab81877a23646d1cbbfe8/packages/core/src/validations.ts#L312-L322. But note that this is only a small part of what the hub does to consider a message "valid". A few other important steps are to ensure that the signer is still active and that it's associated with the same fid as the message. You might also need to do other validations depending on what you're looking for. Take a look at validateMessage function in engine/index.ts for a more complete view.
1 reply
0 recast
1 reaction

Vladyslav Dalechyn pfp
Vladyslav Dalechyn
@dalechyn.eth
Thanks sanjay. I am working on a @farcasterxyz/hub-nodejs replacement for fun – https://github.com/dalechyn/fhub and wondered how can I validate messages that I pull from the hub. I only validate the signature and not the hash rn, yet if it’s protobuf encoded data is used to compute the hash I think I will be able to validate the data too.
1 reply
0 recast
0 reaction

Vladyslav Dalechyn pfp
Vladyslav Dalechyn
@dalechyn.eth
On the other side, is EIP712 actually used for signing messages? I checked core package and it would simply throw an error if the signature scheme isn’t Ed25519. Forced to throw an error to rn over here https://github.com/dalechyn/fhub/blob/main/src/Internal/Meta/fromMessage.ts#L38-L44
1 reply
0 recast
0 reaction