{"modulePath":"github.com/GoCodeAlone/workflow-plugin-auth","version":"v0.5.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package postgres\n\nPackage postgres persists agentidentity service grants in a host-owned SQL schema. It never provisions a database, schema, issuer key or human identity.\n\n## Types\n\n```go\ntype Store struct {\n\t// contains filtered or unexported fields\n}\n```\nStore 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.\n\n```go\nfunc New(db *sql.DB, schema string) (*Store, error)\n```\nNew validates configuration only. It performs no I/O, Ping or DDL.\n\n```go\nfunc (s *Store) ConsumeAssertion(ctx context.Context, use agentidentity.AssertionUse) (bool, error)\n```\nConsumeAssertion 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.\n\n```go\nfunc (s *Store) CreateGrant(ctx context.Context, g agentidentity.Grant) error\n```\n\n```go\nfunc (s *Store) GetGrant(ctx context.Context, id string) (agentidentity.Grant, error)\n```\n\n```go\nfunc (s *Store) IsTokenRevoked(ctx context.Context, jtiHash string) (bool, error)\n```\n\n```go\nfunc (s *Store) ListGrants(ctx context.Context, owner agentidentity.Owner) ([]agentidentity.Grant, error)\n```\nListGrants 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.\n\n```go\nfunc (s *Store) Record(ctx context.Context, e agentidentity.Audit) error\n```\nRecord retains fixed-code service/management metadata. Create/Revoke also append their distinct committed event in the SAME mutation transaction.\n\n```go\nfunc (s *Store) RevokeGrant(ctx context.Context, id string, expectedVersion int64, actor string, at time.Time) error\n```\n\n```go\nfunc (s *Store) RevokeToken(ctx context.Context, jtiHash, actor string, at, expiresAt time.Time) error\n```\nRevokeToken records only an already-approved token identity hash. A caller must authorize the actor/target separately; this typed adapter grants no role.\n\n","path":"github.com/GoCodeAlone/workflow-plugin-auth/agentidentity/postgres","name":"postgres","synopsis":"Package postgres persists agentidentity service grants in a host-owned SQL schema.","isRedistributable":true}
