signedtoken

package
v1.338.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package signedtoken signs and verifies Credimi's own tokens: base64url(json).base64url(hmac), with a key derived from the users collection's auth token secret and a label naming the token kind, so rotating that secret revokes every token and a token of one kind is never accepted as another.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsigned = errors.New("token not signed by Credimi")

ErrUnsigned rejects a token Credimi did not sign with the expected key.

Functions

func Sign

func Sign(app core.App, label string, v any) (string, error)

Sign returns the token base64url(json).base64url(hmac) of v, signed with the key of label.

func Verify

func Verify(app core.App, label, token string, v any) error

Verify decodes into v a token signed with the key of label. It returns ErrUnsigned for a token that is malformed or signed otherwise, and other errors when the key cannot be derived.

Types

This section is empty.

Jump to

Keyboard shortcuts

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