identifier

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package identifier creates and validates DANS resource and credential IDs.

Index

Constants

View Source
const (
	// TokenPrefix identifies the only token format supported by this release.
	TokenPrefix = "dans_v1_"
)

Variables

View Source
var (
	// ErrInvalidUUID reports a resource ID that is not a canonical lowercase UUIDv4.
	ErrInvalidUUID = errors.New("identifier: invalid UUIDv4")
	// ErrInvalidToken reports a credential that is not in the supported token format.
	ErrInvalidToken = errors.New("identifier: invalid API token")
)

Functions

func DigestToken

func DigestToken(value string) [sha256.Size]byte

DigestToken returns the indexed lookup digest for the complete token value.

func NewToken

func NewToken() (string, [sha256.Size]byte, error)

NewToken returns a one-time plaintext token and the digest suitable for storage.

func NewUUID

func NewUUID() (string, error)

NewUUID returns a lowercase UUIDv4 generated with cryptographic randomness.

func ValidateToken

func ValidateToken(value string) error

ValidateToken verifies exact syntax and canonical unpadded base64url encoding.

func ValidateUUID

func ValidateUUID(value string) error

ValidateUUID verifies the canonical lowercase UUIDv4 resource-ID format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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