pkg

package
v0.0.0-...-e1100e0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Signer

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

func CreateSignerFromPath

func CreateSignerFromPath(privKeyPath string) (Signer, error)

func (Signer) CreateTimeSignature

func (signer Signer) CreateTimeSignature(now time.Time) (string, string, error)

CreateTimeSignature creates a message and signature with a datetime and random string

func (Signer) Sign

func (signer Signer) Sign(message string) (string, error)

Sign signs a string and returns a base64 encoded signature

type Verifier

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

Verifier verifies ECDSA signatures with a public key

func CreateVerifierFromPath

func CreateVerifierFromPath(pubKeyPath string) (Verifier, error)

func (Verifier) Verify

func (verifier Verifier) Verify(req *http.Request) bool

Verify authenticates a request. The Authentication header is expected to contain the message and signature. The public key is shared beforehand. The message is the ISO8601 UTC datetime followed by 15 random characters.

Jump to

Keyboard shortcuts

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