verifyAuthorization
Verifies that an Authorization object was signed by the provided address.
Import
import { verifyAuthorization } from 'viem/experimental'Usage
example.ts
import { verifyAuthorization } from 'viem/experimental'
import { walletClient } from './client'
 
const authorization = await walletClient.signAuthorization({
  authorization: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2'
})
 
const valid = await verifyAuthorization({ 
  address: walletClient.account.address, 
  authorization, 
}) Returns
boolean
Whether the signature is valid for the provided Authorization object.
Parameters
address
- Type: Address
The address that signed the Authorization object.
const valid = await verifyAuthorization({
  address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', 
  authorization,
}) authorization
- Type: Authorization | SignedAuthorization
The Authorization object to be verified.
const authorization = await walletClient.signAuthorization({
  authorization: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2'
})
 
const valid = await verifyAuthorization({
  address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
  authorization, 
}) signature
- Type: Hex | ByteArray | Signature | SignedAuthorization
The signature that was generated by signing the Authorization object with the address's private key.
const signature = await walletClient.signAuthorization({
  authorization: {
    address: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
    chainId: 1,
    nonce: 0,
  }
})
 
const valid = await verifyAuthorization({
  address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
  authorization: {
    address: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
    chainId: 1,
    nonce: 0,
  },
  signature, 
}) 
