postgres

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 12 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 postgres persists agentidentity service grants in a host-owned SQL schema. It never provisions a database, schema, issuer key or human identity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store uses one shared schema for ALL tenant grants and replay identities. The caller owns connection security/pool lifecycle, migration and current human/tenant authorization. Schema is copied/validated; no search_path is used.

func New

func New(db *sql.DB, schema string) (*Store, error)

New validates configuration only. It performs no I/O, Ping or DDL.

func (*Store) ConsumeAssertion

func (s *Store) ConsumeAssertion(ctx context.Context, use agentidentity.AssertionUse) (bool, error)

ConsumeAssertion serializes with grant revoke and atomically rechecks the current row. The DB clock also refuses expired state if a caller clock lags. One bound JTIHash is consumed globally, never by grant/version partition.

func (*Store) CreateGrant

func (s *Store) CreateGrant(ctx context.Context, g agentidentity.Grant) error

func (*Store) GetGrant

func (s *Store) GetGrant(ctx context.Context, id string) (agentidentity.Grant, error)

func (*Store) IsTokenRevoked

func (s *Store) IsTokenRevoked(ctx context.Context, jtiHash string) (bool, error)

func (*Store) ListGrants

func (s *Store) ListGrants(ctx context.Context, owner agentidentity.Owner) ([]agentidentity.Grant, error)

ListGrants is internal persistence, not an owner-authorized endpoint. The reusable management handler filters each row using CURRENT OwnerPolicy. Original ApprovedBy must not be used to infer today's tenant authority.

func (*Store) Record

func (s *Store) Record(ctx context.Context, e agentidentity.Audit) error

Record retains fixed-code service/management metadata. Create/Revoke also append their distinct committed event in the SAME mutation transaction.

func (*Store) RevokeGrant

func (s *Store) RevokeGrant(ctx context.Context, id string, expectedVersion int64, actor string, at time.Time) error

func (*Store) RevokeToken

func (s *Store) RevokeToken(ctx context.Context, jtiHash, actor string, at, expiresAt time.Time) error

RevokeToken records only an already-approved token identity hash. A caller must authorize the actor/target separately; this typed adapter grants no role.

Jump to

Keyboard shortcuts

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