auth

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SignatureVerifier

type SignatureVerifier struct{}

SignatureVerifier handles Ed25519 signature verification for HTTP requests.

func NewSignatureVerifier

func NewSignatureVerifier() *SignatureVerifier

NewSignatureVerifier creates a new signature verifier instance.

func (*SignatureVerifier) ExtractHeaders

func (sv *SignatureVerifier) ExtractHeaders(r *http.Request) (VerificationHeaders, error)

ExtractHeaders extracts signature verification headers from an HTTP request.

func (*SignatureVerifier) VerifyAdminRequest

func (sv *SignatureVerifier) VerifyAdminRequest(r *http.Request, expectedSigner string, expectedMessage string) error

VerifyAdminRequest verifies a request is signed by an authorized admin wallet. expectedSigner is the configured admin wallet address (e.g., payment address). expectedMessage is the message format the client should have signed.

func (*SignatureVerifier) VerifySignature

func (sv *SignatureVerifier) VerifySignature(headers VerificationHeaders) error

VerifySignature verifies that the signature is valid for the given message and signer.

func (*SignatureVerifier) VerifyUserRequest

func (sv *SignatureVerifier) VerifyUserRequest(r *http.Request, allowedSigners []string, expectedMessage string) error

VerifyUserRequest verifies a request is signed by one of the allowed wallets. allowedSigners contains wallet addresses that are permitted to sign this request. expectedMessage is the message format the client should have signed.

type VerificationHeaders

type VerificationHeaders struct {
	Signature string // X-Signature header (base64-encoded signature)
	Message   string // X-Message header (plain text message that was signed)
	Signer    string // X-Signer header (base58-encoded public key)
}

VerificationHeaders contains the signature verification headers from a request.

Jump to

Keyboard shortcuts

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