security

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DigestCodec

type DigestCodec interface {
	// Encode encodes a byte slice digest into a string representation.
	Encode(bytes []byte) string

	// Decode decodes a string representation back into a byte slice.
	Decode(encoded string) ([]byte, error)
}

DigestCodec is an interface for encoding and decoding digest values.

func NewBase64DigestCodec

func NewBase64DigestCodec() DigestCodec

NewBase64DigestCodec returns a DigestCodec for Base64 encoding/decoding.

func NewBase64URLDigestCodec

func NewBase64URLDigestCodec() DigestCodec

NewBase64URLDigestCodec returns a DigestCodec for Base64 URL-safe encoding/decoding.

func NewHexDigestCodec

func NewHexDigestCodec() DigestCodec

NewHexDigestCodec returns a DigestCodec for Hex encoding/decoding.

type HmacSignatureVerifier

type HmacSignatureVerifier struct {
	// contains filtered or unexported fields
}

HmacSignatureVerifier verifies HMAC-based HTTP request signatures.

func NewHmacSignatureVerifier

func NewHmacSignatureVerifier(
	secretKey string,
	signatureHeaderName string,
	digestCodec DigestCodec,
	requestBytesResolver func(*http.Request) ([]byte, error),
	algorithm string,
	signatureValueTemplate string,
) (*HmacSignatureVerifier, error)

NewHmacSignatureVerifier initializes a new HmacSignatureVerifier instance.

func (*HmacSignatureVerifier) Verify

Verify verifies the HMAC signature for the given request.

type SignatureVerifier

type SignatureVerifier interface {
	// Verify checks the signature of the given HTTP request and returns
	// a VerificationResult indicating the outcome.
	Verify(req *http.Request) VerificationResult
}

SignatureVerifier represents an interface for verifying the signature of an HTTP request.

type VerificationResult

type VerificationResult struct {
	// contains filtered or unexported fields
}

VerificationResult represents the outcome of a signature verification process.

func NewFailure

func NewFailure(errors ...string) VerificationResult

NewFailure returns a VerificationResult representing a failed verification.

func NewSuccess

func NewSuccess() VerificationResult

NewSuccess returns a VerificationResult representing a successful verification.

func (*VerificationResult) Errors

func (v *VerificationResult) Errors() []string

Errors returns the list of errors (if any) encountered during verification.

func (*VerificationResult) Success

func (v *VerificationResult) Success() bool

Success returns true if the verification was successful.

Jump to

Keyboard shortcuts

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