security

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package security provides authenticated subject isolation helpers.

Index

Constants

View Source
const LocalSubject = "local-stdio"

LocalSubject is the shared subject for unauthenticated local transports.

Variables

This section is empty.

Functions

func RequireSubject

func RequireSubject(ctx context.Context, owner string) error

RequireSubject verifies ownership without revealing cross-subject objects.

func SubjectFromContext

func SubjectFromContext(ctx context.Context) string

SubjectFromContext returns the authenticated subject or the local transport subject.

Types

type OwnedRecord

type OwnedRecord[T any] struct {
	ID        string
	Owner     string
	CreatedAt time.Time
	Value     T
}

OwnedRecord is a value associated with the subject that created it.

type Store

type Store[T any] struct {
	// contains filtered or unexported fields
}

Store is an in-memory subject-isolated record store.

func (*Store[T]) Get

func (s *Store[T]) Get(ctx context.Context, id string) (T, bool, error)

Get returns a value only when it belongs to the current subject.

func (*Store[T]) Put

func (s *Store[T]) Put(ctx context.Context, id string, value T)

Put stores value under id for the current subject.

Jump to

Keyboard shortcuts

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