auth

package
v0.0.0-...-43207eb Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStellarSignatureNotVerified = errors.New("neither Signature nor X-Stellar-Signature header could be verified")
)

Functions

func ExtractTimestampedSignature

func ExtractTimestampedSignature(signatureHeaderContent string) (t string, s string, err error)

func VerifyGracePeriodSeconds

func VerifyGracePeriodSeconds(timestampString string, gracePeriod time.Duration) error

Types

type ErrExpiredSignatureTimestamp

type ErrExpiredSignatureTimestamp struct {
	ExpiredSignatureTimestamp time.Time
	CheckTime                 time.Time
}

func (ErrExpiredSignatureTimestamp) Error

type ErrInvalidTimestampFormat

type ErrInvalidTimestampFormat struct {
	TimestampString string
	// contains filtered or unexported fields
}

func (ErrInvalidTimestampFormat) Error

type MockSignatureVerifier

type MockSignatureVerifier struct {
	mock.Mock
}

func (*MockSignatureVerifier) VerifySignature

func (sv *MockSignatureVerifier) VerifySignature(ctx context.Context, signatureHeaderContent string, reqBody []byte) error

type SignatureVerifier

type SignatureVerifier interface {
	VerifySignature(ctx context.Context, signatureHeaderContent string, rawReqBody []byte) error
}

type StellarSignatureVerifier

type StellarSignatureVerifier struct {
	ServerHostname   string
	WalletSigningKey string
}

func NewStellarSignatureVerifier

func NewStellarSignatureVerifier(serverHostName, walletSigningKey string) (*StellarSignatureVerifier, error)

func (*StellarSignatureVerifier) VerifySignature

func (sv *StellarSignatureVerifier) VerifySignature(ctx context.Context, signatureHeaderContent string, rawReqBody []byte) error

VerifySignature verifies the Signature or X-Stellar-Signature content and checks if the signature is signed for a known caller.

Jump to

Keyboard shortcuts

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