isValidSignature
Checks if a signature is valid by calling the isValidSignature
(opens in a new tab) method in the CompatibilityFallbackHandler
contract.
Usage
_14import { hashSafeMessage } from '@safe-global/protocol-kit'_14import { EIP712TypedData } from '@safe-global/types-kit'_14import { protocolKit } from './setup.ts'_14_14const rawMessage: string | EIP712TypedData = 'Example message'_14const messageHash = hashSafeMessage(rawMessage)_14const safeMessageHash = await protocolKit.getSafeMessageHash(messageHash)_14_14const signature = '0x...'_14_14const isValidSignature = await protocolKit.isValidSignature(_14 safeMessageHash,_14 signature_14)
Parameters
safeMessageHash
- Type:
string
The Safe message hash.
_10const isValidSignature = await protocolKit.isValidSignature(_10 '0x...', _10 '0x...'_10)
signature
- Type:
SafeSignature[]
(opens in a new tab) |string
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).
_10const isValidSignature = await protocolKit.isValidSignature(_10 '0x...', _10 '0x...'_10)
Returns
Promise<boolean>
The boolean value that indicates if the signature is valid.