b2mac

package
v0.8.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeAuthHeader

func DecodeAuthHeader(header string) (id []byte, nonce uuid.UUID, mac []byte, err error)

Decodes the value of the "Authorization" header into its constituent parts. It returns an ID (the tenant ID), a nonce (a v4 UUID), and an unencoded MAC.

func EncodeAuthHeader

func EncodeAuthHeader(id []byte, nonce uuid.UUID, mac []byte) (string, error)

Generates the value of the "Authorization" header for a MAC with the given id, nonce, and mac. The id is an arbitrary string and should correspond to the tenant ID. The nonce should be a v4 UUID. The mac should not have any encoding.

func New512

func New512(id []byte, nonce uuid.UUID, payload []byte, key ed25519.PrivateKey) ([]byte, error)

Computes a blake2b-512 MAC for the given tenant ID and message payload using the provided private key and random nonce. This function will only return an error if there is a problem with the private key.

func NewEncodedHeader

func NewEncodedHeader(id []byte, nonce uuid.UUID, payload []byte, key ed25519.PrivateKey) (string, error)

func Verify

func Verify(mac []byte, id []byte, nonce uuid.UUID, payload []byte, key ed25519.PrivateKey) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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