Skip to content

Commit bff7429

Browse files
committed
docs: enhance JSDoc for validateFrameMessage with examples
1 parent c104a31 commit bff7429

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

packages/frames.js/src/validateFrameMessage.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,22 @@ function isValidateMessageJson(value: unknown): value is ValidateMessageJson {
2424
}
2525

2626
/**
27-
* @returns a Promise that resolves with whether the message signature is valid, by querying a Farcaster hub, as well as the message itself
27+
* Validates a frame action message by querying a Farcaster hub.
28+
* Verifies the message signature is valid and returns the decoded message.
29+
*
30+
* @param body - The frame action payload containing trusted and untrusted data
31+
* @param options - Optional hub configuration
32+
* @param options.hubHttpUrl - The Farcaster hub HTTP URL (default: neynar hub)
33+
* @param options.hubRequestOptions - Additional request options for the hub API
34+
* @returns A Promise resolving to an object with isValid boolean and the message if valid
35+
*
36+
* @example
37+
* ```typescript
38+
* const { isValid, message } = await validateFrameMessage(body);
39+
* if (isValid && message) {
40+
* console.log('Valid message from FID:', message.data.fid);
41+
* }
42+
* ```
2843
*/
2944
export async function validateFrameMessage(
3045
body: FrameActionPayload,

0 commit comments

Comments
 (0)