siws

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMessageTooShort          = errors.New("siws: message needs at least 6 lines")
	ErrInvalidHeader            = errors.New("siws: message first line does not end in \" wants you to sign in with your Solana account:\"")
	ErrInvalidDomain            = errors.New("siws: domain in first line of message is not valid")
	ErrInvalidAddress           = errors.New("siws: wallet address is not in base58 format")
	ErrThirdLineNotEmpty        = errors.New("siws: third line must be empty")
	ErrInvalidURI               = errors.New("siws: URI is not valid")
	ErrInvalidIssuedAt          = errors.New("siws: Issued At is not a valid ISO8601 timestamp")
	ErrInvalidExpirationTime    = errors.New("siws: Expiration Time is not a valid ISO8601 timestamp")
	ErrInvalidNotBefore         = errors.New("siws: Not Before is not a valid ISO8601 timestamp")
	ErrMissingURI               = errors.New("siws: URI is not specified")
	ErrMissingIssuedAt          = errors.New("siws: Issued At is not specified")
	ErrIssuedAfterExpiration    = errors.New("siws: Issued At is after Expiration Time")
	ErrNotBeforeAfterExpiration = errors.New("siws: Not Before is after Expiration Time")
	ErrInvalidChainID           = errors.New("siws: Chain ID is not valid")
)

Static errors

Functions

func IsValidDomain

func IsValidDomain(domain string) bool

func IsValidSolanaNetwork

func IsValidSolanaNetwork(network string) bool

Types

type SIWSMessage

type SIWSMessage struct {
	Raw string

	Domain         string
	Address        string
	Statement      string
	URI            *url.URL
	Version        string
	Nonce          string
	IssuedAt       time.Time
	ChainID        string
	NotBefore      time.Time
	RequestID      string
	ExpirationTime time.Time
	Resources      []*url.URL
}

SIWSMessage is the final structured form of a parsed SIWS message.

func ParseMessage

func ParseMessage(raw string) (*SIWSMessage, error)

func (*SIWSMessage) VerifySignature

func (m *SIWSMessage) VerifySignature(signature []byte) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL