worksign

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package worksign is the platform adapter that signs and verifies fleet work order payloads with an HMAC-SHA256 keyed MAC. It holds the key so the key material never reaches the domain or the use case, which depend only on the ports.WorkOrderSigner interface.

Index

Constants

View Source
const MinKeyLen = 32

MinKeyLen is the minimum HMAC key length. A short or empty key would make the MAC forgeable, so the constructor fails closed below it.

Variables

View Source
var ErrWeakKey = errors.New("worksign: signing key too short")

ErrWeakKey is returned when the signing key is shorter than MinKeyLen.

Functions

This section is empty.

Types

type Signer

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

Signer is an HMAC-SHA256 work order signer.

func New

func New(key []byte) (*Signer, error)

New returns a Signer keyed with key. It fails closed on a key shorter than MinKeyLen so a missing or misconfigured key cannot boot a forgeable signer. The caller supplies the key from the credential vault or configuration; it is never logged.

func (*Signer) Sign

func (s *Signer) Sign(payload string) string

Sign returns the base64 HMAC-SHA256 of payload.

func (*Signer) Verify

func (s *Signer) Verify(payload, signature string) bool

Verify reports whether signature is a valid MAC for payload, in constant time.

Jump to

Keyboard shortcuts

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