Skip to content
LogoLogo

accessKey.verifyHash

Verifies that a keychain signature was produced by an active access key for the expected account.

By default (admin: true), returns true only if the signature was produced by the account's root key or an active admin access key. Set admin: false to accept any active access key.

Returns false for account mismatches, unknown, revoked, or expired access keys.

TIP-1049

Usage

import { client } from './viem.config'
 
const valid = await client.accessKey.verifyHash({
  account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
  hash: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
  signature: '0x...',
})
 
console.log('Valid:', valid)
Valid: true

Return Type

type ReturnType = boolean

Parameters

account

  • Type: Address

Account address the signature is expected to belong to.

admin

  • Type: boolean
  • Default: true

Whether to require the signer to be the account's root key or an active admin access key. Set to false to accept any active access key.

hash

  • Type: Hex

Original message hash that was signed.

signature

  • Type: Hex

Keychain signature envelope (V2). Legacy keychain signatures are rejected.

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.