Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 546 Bytes

File metadata and controls

20 lines (16 loc) · 546 Bytes

Frames Validator

A set of tools for validating POST payloads from XMTP Frames

Usage

import { validateFramesPost } from "@xmtp/frames-validator"

export function handler(requestBody: any) {
  // This is an XMTP payload
  if (requestBody.untrustedData?.clientType === "xmtp") {
    const { verifiedWalletAddress } = await validateFramesPost(requestBody)
    return doSomethingWithWalletAddress(verifiedWalletAddress)
  } else {
    // This is a Farcaster POST payload
    return doSomethingWithFarcasterPayload(requestBody)
  }
}