Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hello ¶
type Hello struct {
// contains filtered or unexported fields
}
Hello provides methods for generating and verifying hello authentication messages.
func New ¶
New creates a new Hello instance with the given key provider. The key provider is a function that returns a hex-encoded Ethereum private key.
func (*Hello) GenerateHelloMessage ¶
GenerateHelloMessage generates a signed hello message with the default 5-second expiration.
func (*Hello) GenerateHelloMessageWithExpiry ¶
GenerateHelloMessageWithExpiry generates a signed hello message with a custom expiration in seconds.
func (*Hello) GetAddress ¶
GetAddress returns the Ethereum address corresponding to the private key.
type HelloMessage ¶
type HelloMessage struct {
Message string `json:"message"`
Signature string `json:"signature"`
Address string `json:"address"`
}
HelloMessage is the structure of a hello authentication message.
type VerifyResult ¶
type VerifyResult struct {
Valid bool `json:"valid"`
Address string `json:"address"`
Nonce string `json:"nonce"`
Expires string `json:"expires"`
Error string `json:"error,omitempty"`
}
VerifyResult contains the result of verifying a hello message.
func VerifySignature ¶
func VerifySignature(helloMessage string) VerifyResult
VerifySignature verifies a base64-encoded hello message and returns the result.