File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
packages/thirdweb/src/auth Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " thirdweb " : patch
3+ ---
4+
5+ Handle 7702 accounts in verifyTypedData
Original file line number Diff line number Diff line change 1- import type * as ox__Signature from "ox/Signature" ;
1+ import * as ox__Secp256k1 from "ox/Secp256k1" ;
2+ import * as ox__Signature from "ox/Signature" ;
23import * as ox__TypedData from "ox/TypedData" ;
34import type { Chain } from "../chains/types.js" ;
45import type { ThirdwebClient } from "../client/client.js" ;
5- import type { Hex } from "../utils/encoding/hex.js" ;
6+ import { type Hex , isHex } from "../utils/encoding/hex.js" ;
67import type { HashTypedDataParams } from "../utils/hashing/hashTypedData.js" ;
78import { type VerifyHashParams , verifyHash } from "./verify-hash.js" ;
89
@@ -101,6 +102,23 @@ export async function verifyTypedData<
101102 primaryType,
102103 types,
103104 } as HashTypedDataParams ) ;
105+
106+ if ( ! isHex ( signature ) ) {
107+ return false ;
108+ }
109+
110+ try {
111+ const recoveredAddress = ox__Secp256k1 . recoverAddress ( {
112+ payload : messageHash ,
113+ signature : ox__Signature . fromHex ( signature ) ,
114+ } ) ;
115+
116+ if ( recoveredAddress . toLowerCase ( ) === address . toLowerCase ( ) ) {
117+ return true ;
118+ }
119+ } catch {
120+ // no-op, we skip to contract signature check
121+ }
104122 return verifyHash ( {
105123 accountFactory,
106124 address,
You can’t perform that action at this time.
0 commit comments