signing

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package signing signs and verifies deliveries. The scheme matches the SDKs' verify() helpers, so changes here are breaking changes:

Workly-Timestamp: <unix seconds>
Workly-Signature: v1=<hex HMAC-SHA256 of "<timestamp>.<body>">

The version prefix allows adding schemes (or several signatures during key rotation, comma-separated) without breaking verifiers.

Index

Constants

View Source
const (
	HeaderSignature = "Workly-Signature"
	HeaderTimestamp = "Workly-Timestamp"
)

Variables

View Source
var (
	ErrInvalidSignature = errors.New("signature does not match")
	ErrExpired          = errors.New("timestamp outside tolerance")
	ErrMalformed        = errors.New("missing or malformed signature headers")
)

Functions

func Sign

func Sign(secret []byte, timestamp int64, body []byte) string

Sign returns the Workly-Signature header value.

func SignAll

func SignAll(secrets [][]byte, timestamp int64, body []byte) string

SignAll returns a Workly-Signature header value with one signature per secret, for rotating the signing secret: endpoints verifying with any of them accept the delivery.

func Verify

func Verify(secret []byte, signature, timestamp string, body []byte, tolerance time.Duration, now time.Time) error

Verify checks the signature and timestamp headers against body. A tolerance of zero skips the timestamp age check.

Types

This section is empty.

Jump to

Keyboard shortcuts

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