Skip to content

recoverAuthorizationAddress

Recovers the original signing address from a signed Authorization object.

Import

import { recoverAuthorizationAddress } from 'viem/experimental'

Usage

example.ts
import { recoverAuthorizationAddress } from 'viem/experimental'
import { walletClient } from './client'
 
const authorization = await walletClient.signAuthorization({
  authorization: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2'
})
 
const address = await recoverAuthorizationAddress({ 
  authorization, 
}) 

Returns

Address

The address that signed the Authorization object.

Parameters

authorization

  • Type: Authorization | SignedAuthorization

The Authorization object that was signed.

const authorization = await walletClient.signAuthorization({
  authorization: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2'
})
const address = await recoverAuthorizationAddress({
  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({
  contractAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
  chainId: 1,
  nonce: 0,
})
 
const address = await recoverAuthorizationAddress({
  authorization: {
    contractAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
    chainId: 1,
    nonce: 0,
  },
  signature, 
})