auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package auth evaluates current authority facts without owning transactions.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnauthenticated = errors.New("unauthenticated")

Functions

func Authenticate

func Authenticate(c config.Config, token string, now time.Time) (string, string, error)

func Binding

func Binding(c config.Config, principalID, agentID string, now time.Time) *config.Binding

func BindingByID

func BindingByID(c config.Config, id string, now time.Time) *config.Binding

func Can

func Can(c config.Config, principalID, agentID string, task domain.Task, grants []domain.Grant, action string, now time.Time) (bool, []string)

Can checks one action, independently of lifecycle/CAS guards. It returns the explicit authorization IDs used for audit. A supplied Agent context must be currently bound even when the Principal also has independent Owner rights.

func CanCreate

func CanCreate(c config.Config, principalID string, contract domain.Contract, now time.Time) bool

func CanIssue

func CanIssue(c config.Config, principalID string, task domain.Task, grant domain.Grant, now time.Time) bool

func CreateAuthorization

func CreateAuthorization(c config.Config, principalID string, contract domain.Contract, now time.Time) (bool, []string)

CreateAuthorization returns the authority actually used to create a Task.

func Horizon

func Horizon(c config.Config, allGrants []domain.Grant, now time.Time) *string

Horizon conservatively invalidates cursors at the next configured temporal boundary, including grants that will become effective in the future.

func IssueAuthorization

func IssueAuthorization(c config.Config, principalID string, task domain.Task, grant domain.Grant, now time.Time) (bool, []string)

IssueAuthorization validates the requested grant and the issuer envelope. The caller separately checks current task.read (or atomic creation rights for a new Task).

func PrepareImport

func PrepareImport(old *config.Config, desired config.Config, now time.Time) (config.Config, error)

PrepareImport validates a full declarative configuration update. The returned value is safe to persist: bearer values are replaced by hashes, omitted identities remain disabled, and revoked authorization instances retain their tombstones. The caller must commit this result and auth_epoch atomically.

func TokenHash

func TokenHash(token string) string

TokenHash returns the stored digest, never the original bearer credential.

Types

This section is empty.

Jump to

Keyboard shortcuts

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