identity

package
v0.0.0-...-804b954 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package identity defines runtime-owned opaque identifiers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

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

Generator creates typed runtime IDs from an injected source.

func NewGenerator

func NewGenerator(source Source) (Generator, error)

NewGenerator creates a Generator that uses source for opaque ID payloads.

func (Generator) NewSessionID

func (g Generator) NewSessionID() (SessionID, error)

NewSessionID creates a SessionID from the generator's injected source.

type SessionID

type SessionID string

SessionID identifies a Session without disclosing routing or authorization data.

func ParseSessionID

func ParseSessionID(value string) (SessionID, error)

ParseSessionID validates an externally supplied SessionID.

func (SessionID) LogValue

func (id SessionID) LogValue() slog.Value

LogValue implements slog.LogValuer with a redacted value.

func (SessionID) MarshalJSON

func (id SessionID) MarshalJSON() ([]byte, error)

MarshalJSON serializes a validated SessionID as a JSON string.

func (SessionID) Redacted

func (id SessionID) Redacted() string

Redacted returns a safe diagnostic representation of the ID.

func (SessionID) String

func (id SessionID) String() string

String returns the canonical identifier value for protocol use.

func (*SessionID) UnmarshalJSON

func (id *SessionID) UnmarshalJSON(data []byte) error

UnmarshalJSON validates a JSON SessionID string before accepting it.

type Source

type Source interface {
	// Next returns one canonical ASCII payload without a type prefix.
	Next() (string, error)
}

Source supplies opaque identifier payloads at the composition root.

Jump to

Keyboard shortcuts

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