Documentation ¶
Index ¶
- func DecodeAuthHeader(header string) (id []byte, nonce uuid.UUID, mac []byte, err error)
- func EncodeAuthHeader(id []byte, nonce uuid.UUID, mac []byte) (string, error)
- func New512(id []byte, payload []byte, key ed25519.PrivateKey) (uuid.UUID, []byte, error)
- func NewEncodedHeader(id []byte, payload []byte, key ed25519.PrivateKey) (string, error)
- func Verify(mac []byte, id []byte, nonce uuid.UUID, payload []byte, key ed25519.PrivateKey) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeAuthHeader ¶
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 ¶
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 ¶
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 ¶
Types ¶
This section is empty.