Skip to content
LogoLogo

validateSiweMessage

Validates EIP-4361 message.

Import

import {  } from 'viem/siwe'

Usage

import {  } from 'viem/siwe'
 
const  = ({
  : '0xd2135CfB216b74109775236E36d4b433F1DF507B',
  : {
    : '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
    : 1,
    : 'example.com',
    : 'foobarbaz',
    : 'https://example.com/path',
    : '1',
  },
})

Returns

boolean

Whether the message fields are valid.

Parameters

message

  • Type: Partial<SiweMessage>

EIP-4361 message fields.

address (optional)

  • Type: string

Ethereum address to check against.

domain (optional)

  • Type: string

RFC 3986 authority to check against.

nonce (optional)

  • Type: string

Random string to check against.

scheme (optional)

  • Type: string

RFC 3986 URI scheme to check against.

time (optional)

  • Type: Date
  • Default: new Date()

Current time to check optional expirationTime and notBefore message fields.