auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePublicKey

func ParsePublicKey(encodedKey string) (ed25519.PublicKey, error)

ParsePublicKey parses a ed25519 public key.

Types

type Signer

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

Signer signs HTTP requests.

func NewSigner

func NewSigner(signingKey ed25519.PrivateKey) *Signer

NewSigner creates a Signer that signs HTTP requests using the specified signing key, in the same way that Dispatch would sign requests.

func (*Signer) Client

func (s *Signer) Client(client connect.HTTPClient) *SigningClient

Client wraps an HTTP client to automatically sign requests.

func (*Signer) Sign

func (s *Signer) Sign(req *http.Request) error

Sign signs a request.

type SigningClient

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

SigningClient is an HTTP client that automatically signs requests.

func (*SigningClient) Do

func (c *SigningClient) Do(req *http.Request) (*http.Response, error)

Do signs and sends an HTTP request, and returns the HTTP response.

type Verifier

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

Verifier verifies that requests were signed by Dispatch.

func NewVerifier

func NewVerifier(verificationKey ed25519.PublicKey) *Verifier

NewVerifier creates a Verifier that verifies that requests were signed by Dispatch using the private key associated with this public verification key.

func (*Verifier) Middleware

func (v *Verifier) Middleware(next http.Handler) http.Handler

Middleware wraps an HTTP handler in order to validate request signatures.

func (*Verifier) Verify

func (v *Verifier) Verify(r *http.Request) error

Verify verifies that a request was signed by Dispatch.

Jump to

Keyboard shortcuts

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