Protocol Kit Reference
Messages
isValidSignature

isValidSignature

Checks if a signature is valid by calling the isValidSignature (opens in a new tab) method in the CompatibilityFallbackHandler contract.

Usage


_14
import { hashSafeMessage } from '@safe-global/protocol-kit'
_14
import { EIP712TypedData } from '@safe-global/types-kit'
_14
import { protocolKit } from './setup.ts'
_14
_14
const rawMessage: string | EIP712TypedData = 'Example message'
_14
const messageHash = hashSafeMessage(rawMessage)
_14
const safeMessageHash = await protocolKit.getSafeMessageHash(messageHash)
_14
_14
const signature = '0x...'
_14
_14
const isValidSignature = await protocolKit.isValidSignature(
_14
safeMessageHash,
_14
signature
_14
)

Parameters

safeMessageHash

  • Type: string

The Safe message hash.


_10
const isValidSignature = await protocolKit.isValidSignature(
_10
'0x...',
_10
'0x...'
_10
)

signature

The signature to be validated.

  • SafeSignature[] to validate multiple Safe signatures.
  • string to validate one or multiple signatures concatenated.
  • 0x to validate an on-chain message (approvedHashes (opens in a new tab) in the Safe contract).

_10
const isValidSignature = await protocolKit.isValidSignature(
_10
'0x...',
_10
'0x...'
_10
)

Returns

Promise<boolean>

The boolean value that indicates if the signature is valid.

Was this page helpful?