Skip to content

Commit

Permalink
fix: verify url
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Feb 19, 2024
1 parent 7e210ea commit 32bcff8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/verifyFrame.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { hexToBytes } from '@noble/curves/abstract/utils'
import { type TrustedData } from '../types.js'
import { parsePath } from './parsePath.js'

export type VerifyFrameParameters = {
fetchOptions?: RequestInit
Expand Down Expand Up @@ -29,6 +30,6 @@ export async function verifyFrame({
if (!response.valid)
throw new Error(`message is invalid. ${response.details}`)

if (!frameUrl?.startsWith(url))
if (!parsePath(frameUrl)?.startsWith(parsePath(url)))
throw new Error(`Invalid frame url: ${frameUrl}. Expected: ${url}.`)
}

0 comments on commit 32bcff8

Please sign in to comment.