b2mac

package
v0.4.2-rc3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 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, payload []byte, key ed25519.PrivateKey) (uuid.UUID, []byte, error)

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

func NewEncodedHeader

func NewEncodedHeader(id []byte, 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