hmactoken

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package hmactoken implements generation and validation HMAC-tagged Swarming tokens.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Secret

type Secret struct {
	// contains filtered or unexported fields
}

Secret can be used to generate and validate HMAC-tagged tokens.

func NewRotatingSecret

func NewRotatingSecret(ctx context.Context, keyName string) (*Secret, error)

NewRotatingSecret creates a new secret given a key name and subscribes to its rotations.

func NewStaticSecret

func NewStaticSecret(secret secrets.Secret) *Secret

NewStaticSecret creates a new secret from a given static secret value.

Mostly for tests.

func (*Secret) Tag

func (s *Secret) Tag(pfx, body []byte) []byte

Tag generates a HMAC-SHA256 tag of `pfx+body`.

func (*Secret) Verify

func (s *Secret) Verify(pfx, body, tag []byte) bool

Verify checks the given tag matches the expected one for given `pfx+body`.

Jump to

Keyboard shortcuts

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