Verifying your frame actions
To verify the integrity of frame actions you have to include the additional middleware in your createFrames
call. For Farcaster frames this would be the farcasterHubContext
middleware.
const frames = createFrames({
// ...
middleware: [farcasterHubContext()],
});
The contents of this verification, including additional context can be accessed via the message
object.
If the message is not valid it means that it failed signature verification and should not be trusted.
const handleRequest = frames(async (ctx) => {
if (!ctx.message.isValid) {
throw new Error("Invalid Frame");
}
// ...
});