signer

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKey = errors.New("signer: key must be 32-bytes")

ErrInvalidKey is returned when the key is missing or is less than 32-bytes.

Functions

func Sign

func Sign(data []byte, key Key) (string, error)

Sign calculates and returns the hmac signature of the parsed yaml file.

func SignUpdate

func SignUpdate(data []byte, key Key) ([]byte, error)

SignUpdate calculates the hmac signature of the parsed yaml file and adds a signature resource. If a signature resource already exists, it is replaced.

func Verify

func Verify(data []byte, key Key) (bool, error)

Verify returns true if the signature of the parsed yaml file can be verified.

func WriteTo

func WriteTo(data []byte, hmac string) ([]byte, error)

WriteTo writes the signature to the yaml file. If the signature already exists it is removed, and the new signature is appended to the end of the document.

Types

type Key

type Key []byte

Key represents 32-byte signature.

func KeyString

func KeyString(s string) Key

KeyString is a helper function that returns a Key from a string.

Jump to

Keyboard shortcuts

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