crypto

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SignatureHeaderKey defines header carrying the signature
	SignatureHeaderKey = "Signature"
)

Variables

View Source
var (
	// ErrorMissingHeader is returned when a header used in the canonical request representation is missing
	ErrorMissingHeader = errors.New("signable payload can not be generated since a relevant header is missing")
)

Definition of error cases

Functions

func Sign

func Sign(privateKey ed25519.PrivateKey, message []byte) []byte

Sign signs the message with privateKey and returns a signature. It will panic if len(privateKey) is not PrivateKeySize

func SignablePayload

func SignablePayload(method string, scheme string, host string, requestURI string, headers http.Header, body []byte) ([]byte, error)

SignablePayload builds the payload which can be signed Method\r\nHost\r\nRequestURI\r\nDate Header Value\r\nBody Example: (method):-method-\r\n(url):-scheme-://-host--requestURI-\r\n(Date):Wed, 07 Oct 2020 10:00:00 GMT\r\n(body):{\"hello\":\"world\"}

func Verify

func Verify(publicKey ed25519.PublicKey, message, signature []byte) bool

Verify reports whether signature is a valid signature of message by publicKey. It will panic if len(publicKey) is not PublicKeySize

Types

This section is empty.

Jump to

Keyboard shortcuts

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