identity

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 3 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 identity bridges kernel.Principal to the v0 int-ID, single-role model during the Phase 2 transition. Services resolving acting identity parse through here so the "invalid user ID" failure stays in one place. Phase 3 modules own their ID shapes; new code must prefer Principal fields over these helpers.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidUserID = kernel.ErrInvalidPrincipalID

ErrInvalidUserID is returned when a principal carries a non-decimal ID. Handlers map it to the same 400 invalid_user_id response the pre-Phase-2 handler-side parse produced. It aliases the kernel sentinel so module services (which cannot import this package) map through the same value.

Functions

func IntID

func IntID(principal kernel.Principal) (int, error)

IntID parses the principal's decimal ID for repository calls.

func New

func New(
	userID int,
	username string,
	role string,
) kernel.Principal

New builds a principal from v0 int-ID parts. Importers and tests use it to construct the acting identity they already hold as parts.

func PrimaryRole

func PrimaryRole(principal kernel.Principal) string

PrimaryRole returns the principal's first role, or "" when anonymous. v0 roles are single-valued; multi-role resolution belongs to the users module (Phase 3).

Types

This section is empty.

Jump to

Keyboard shortcuts

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