authz

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package authz is the authorization chokepoint (permission + tenant-isolation ADRs): authorize(principal, capability-formula, scope) evaluated in-transaction against current policy with no cache, returning a proof-carrying value the store accepts calls only with. This package, the resolution surface (internal/store/authn), the transaction package, and the store's query registry form the enumerated trusted set — changes here are the highest-scrutiny diffs in the repo.

Index

Constants

View Source
const (
	HandoffEstablishment = authn.HandoffEstablishment
	HandoffStepUp        = authn.HandoffStepUp
)
View Source
const ReplayKeyLimit = 256

ReplayKeyLimit bounds one enrolled key's share of the durable replay store. Keep the installation-wide ceiling as a separate fail-closed storage bound.

View Source
const WorkspaceArtifact = "workspace"

WorkspaceArtifact is the value a WORKSPACE session's `artifact` column stores. It is NOT crypto.ArtifactWorkspaceSession ("ws"), which is the bearer grammar's type: the two are different strings on purpose, and a rule keyed on the wrong one silently matches nothing. It lives here rather than in the service because the authentication leg is the first consumer.

Variables

MFAMandatory is the closed set of capabilities the human-auth ADR makes MFA-mandatory. A viewer on a development environment is deliberately not forced to enrol; these are the powers that are.

Functions

func AdequateAssurance

func AdequateAssurance(a Assurance) bool

AdequateAssurance reports whether a session's assurance record satisfies the MFA-mandatory rule: two distinct factor classes, or a WebAuthn assertion (user-verifying, inherently two-factor). OIDC sessions whose provider policy asserted multi-factor are handled where that policy is recorded (#54 OIDC slice); here a single-factor session — password only, or an unelevated OIDC login — is inadequate.

func AssuranceRank

func AssuranceRank(a Assurance) int

AssuranceRank orders assurance tiers so a step-up (e.g. an OIDC reauth) can refuse to re-establish a session with weaker evidence than it already holds:

2 — phishing-resistant (a WebAuthn assertion)
1 — multi-factor (two distinct factor classes)
0 — single-factor

A reauth may only proceed with evidence of rank >= the session's rank. OIDC evidence is capped at rank 1 by construction (oidcFactors never yields "webauthn"): hikyo cannot verify the phishing-resistance of a federated ceremony, so a federated token can never re-authorize a WebAuthn session.

func BoundKey

func BoundKey(p Proof) (domain.RuleKey, bool)

BoundKey reports the key a proof was minted for when member access rules decided it. A service holding such a proof must act on that key alone.

func ContractArtifactClass

func ContractArtifactClass(caller Identity) string

ContractArtifactClass maps a resolved identity to the vocabulary used by x-hikyo-artifacts. Identity class, not bearer spelling, is authoritative.

func FormulaDemandsMFA

func FormulaDemandsMFA(op Operation) bool

FormulaDemandsMFA reports whether an operation's formula touches an MFA-mandatory capability. Exported so the pending-enforcement guard can enumerate exactly which operations will need an adequate session once factors exist.

func IncludesSelfConfig

func IncludesSelfConfig(p Proof) bool

IncludesSelfConfig is the metadata enumeration projection of the caller's instance-config grant, resolved in the same transaction as the proof.

func IsSelfConfig

func IsSelfConfig(p Proof) bool

IsSelfConfig reports the database-resolved protected resource profile on a canonical proof. It is a value-handling hint, never a new authorization door.

func IsSystemProof

func IsSystemProof(p Proof) bool

IsSystemProof reports whether p was minted at a no-principal system site. The audit write path uses it to decide whether an emitter may ASSERT an actor class: a principal-backed operation's events are attributed from principals.kind, never from what the emitter claims, so only a system proof may say "system" or "break-glass".

func NavigationEnvironmentAllowed(p Proof, id domain.EnvID) bool

NavigationEnvironmentAllowed preserves the environment selector on a directory read authorized through See, including rule-local exceptions.

func NavigationProjectAllowed(p Proof, id domain.ProjectID) bool

NavigationProjectAllowed narrows a rule-based project directory proof to the projects named by the caller's own rules. Ordinary proofs are unchanged.

func PublishKeyAllowed

func PublishKeyAllowed(p Proof, id string) bool

PublishKeyAllowed checks the changed-key binding of a collection publish proof. Existing whole-environment proofs have no collection binding.

func TrackCallerActivity

func TrackCallerActivity(ctx context.Context) context.Context

TrackCallerActivity installs request-local storage for the authentication result. Authentication remains inside the operation transaction; only the non-authorizing slide hint survives until the response has been written.

func Verify

func Verify(p Proof, op StoreOp, tok *TxToken) (domain.Scope, error)

Verify is the store boundary check (tenant-isolation ADR: one check, in one package, not per endpoint). Every store method calls it first, passing its own registered StoreOp and the token of the transaction it is bound to, and binds its chain parameters exclusively from the returned scope — the proof's resolved chain, never caller arguments. Rejections are loud internal errors, not uniform responses: a proof failing here is a bug or an attack, and either way no query may run.

Fail-closed rejections, per invariant 5: nil proof (the only forgeable value), foreign-transaction proof, committed/rolled-back-transaction proof, operation-mismatched proof — and for system proofs, any operation outside the mint site's closed set.

func VerifyEvent

func VerifyEvent(p Proof, op StoreOp, tok *TxToken, et audit.EventType) (domain.Scope, error)

VerifyEvent is Verify for the audit-insert doors: on top of the ordinary checks it binds the EVENT TYPE to the operation that minted the proof. Without it a proof for any operation licensed to write the trail could insert any tenant-licensed event type — a project-create proof could persist an environment-note-changed event, forging the meaning of the record while every other guard succeeds. The registry already declares which types each operation emits; this makes that declaration binding at the write boundary.

func VerifySelfConfigSnapshot

func VerifySelfConfigSnapshot(p Proof, snapshotID string) error

VerifySelfConfigSnapshot confines a runtime proof's payload read to the one retained snapshot chosen at minting. Other proof classes keep their ordinary operation and tenant constraints.

func WithDeveloperDelivery

func WithDeveloperDelivery(ctx context.Context) context.Context

WithDeveloperDelivery marks the sole below-network credential delivery surface.

Types

type AccessGrant

type AccessGrant = authn.AccessGrant

AccessGrant is re-exported so the service layer never names authn.

type Account

type Account = authn.Account

Account is a resolved human account.

type AccountProfile

type AccountProfile = authn.AccountProfile

type AffectedCredential

type AffectedCredential = authn.AffectedCredential

Re-exported so the service layer never names the resolution-surface package.

type Assurance

type Assurance struct {
	Method          string
	Factors         []string
	AuthenticatedAt time.Time
	CeremonyID      string
}

Assurance is how THIS session authenticated — the method, the factor classes actually presented, when, and which ceremony. Authorization of an MFA-mandatory capability consults this record, never the account's credential inventory: an account that owns a passkey but logged in through a weak path has not presented it.

type Atom

type Atom struct {
	Cap domain.Capability
	At  domain.Level
}

Atom is one conjunct of an authorization formula: the principal must hold Cap at the resolved chain truncated to level At, or at any scope above it (grants inherit downward; permission-model ADR § scope lattice).

type AuditMapping

type AuditMapping struct {
	Class       Class
	Formula     Formula
	Events      []audit.EventType
	AuditedNone bool
	// ReadOnly reports whether every store op the operation can invoke is in
	// the pinned read-only set — the mutates-nothing half of the
	// `audited: none` permit rule.
	ReadOnly bool
}

AuditMapping is one operation's audit linkage, for the completeness invariant (audit-model ADR CI invariant 2).

type Binding

type Binding = authn.Binding

Re-exported so the service layer never names the resolution-surface package.

type BindingPredicate

type BindingPredicate func(iss FederationIssuer, b Binding) error

BindingPredicate is the binding-specific half of federated validation: audience, every pinned claim, the CI event rule and the post-restore `iat` predicate, evaluated against the rows that were actually resolved.

It arrives as a function rather than as data because its inputs are the presented token's claims, which the caller already holds, and its implementation is in internal/oidcfed — a package the chokepoint deliberately does not import. Passing the check in keeps the protocol library behind its own wall while still making the check unskippable: AuthenticateFederated REFUSES a nil predicate rather than treating it as "no further conditions".

It receives the ISSUER ROW READ IN THIS TRANSACTION, not the one the caller captured before validation, and that argument is the fix for a real time-of-check gap: the network half of federated authentication runs outside any transaction, so an administrator who adds a refused audience or switches the key source while a slow verification is in flight would otherwise have that request complete under the superseded policy. The predicate compares the two and refuses when they disagree.

type CLILogin

type CLILogin = authn.CLILogin

CLILogin is the server-owned first-party login transaction.

type CLIReauthHandoff

type CLIReauthHandoff = authn.CLIReauthHandoff

type Cache

type Cache struct {
	// KeyConstructor is the single function that builds its keys. The ADR's
	// keying rule: the full id chain to the owning scope, structured and
	// injectively encoded (length-prefixed — bare concatenation is how
	// (org "a", project "bc") and (org "ab", project "c") collide).
	KeyConstructor string
	// ProofGatedAt names the layer that supplies the proof for reads and
	// writes. For the DEK LRU this is deliberately NOT inside the cache:
	// internal/crypto is a locked leaf package (encryption-model ADR; enforced by
	// the boundary test) and may not import the authorization package, so
	// its accessors cannot take an authz.Proof. The access rule is therefore
	// discharged one layer up, at the service seam that resolves a scope
	// before asking crypto to seal for it.
	ProofGatedAt string
}

Cache is one registered cache holding derived tenant material (tenant-isolation ADR invariant 12). Registration is mandatory: the invariant test fails on any cache-shaped declaration in the module that is not listed here, so a new cache cannot appear without stating how it is keyed and who may reach it.

type CallerActivity

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

CallerActivity is the narrow, non-authorizing result the transport may retain until its handler returns. It contains no principal, proof, scope or transaction token: it can decide only whether the post-response idle-clock write is worth attempting. The write still re-authenticates inside its own transaction, so revocation remains authoritative.

func ResolvedCallerActivity

func ResolvedCallerActivity(ctx context.Context) (CallerActivity, bool)

ResolvedCallerActivity returns the most recent successful caller resolution observed in this request. Fabricated and otherwise refused bearers leave it empty, so post-response work can stop before opening any transaction.

func (CallerActivity) LastSeenAt

func (a CallerActivity) LastSeenAt() time.Time

LastSeenAt is the timestamp the request's own authentication read resolved.

func (CallerActivity) Slideable

func (a CallerActivity) Slideable() bool

Slideable reports whether the resolved identity owns a session idle clock or service-account credential last-used stamp. Provisioning and instance connections own separate touch paths and preserve the old generic no-op.

type Class

type Class int

Class is the probe classification (tenant-isolation ADR § enforcement machinery): every operation carries exactly one, and each class has its own probe contract. Classification is the completeness mechanism.

const (
	// ClassTenant: cross-tenant probes, uniform nonexistent response.
	ClassTenant Class = iota
	// ClassInstance: probed for grant refusal, not tenancy.
	ClassInstance
	// ClassUnauthenticated: pre-auth contracts (enumeration uniformity).
	ClassUnauthenticated
	// ClassSystem: no network route may exist; local-authority preconditions.
	ClassSystem
)
const ClassStub Class = -1

ClassStub marks a CLI verb that is not an operation yet: it refuses (exit 2), reaches no server and no store, and has no entry in the operation registry — the totality check enforces exactly that. It is deliberately not one of the ADR's four probe classes: classifying an unimplemented verb as tenant-scoped or unauthenticated now would let the eventual implementation ride in on a stale class without ever meeting its probe contract. When a verb's ticket lands, its class here changes and the matching probes must exist.

type CredentialAuthority

type CredentialAuthority = authn.CredentialAuthority

CredentialAuthority is a resolved credential-establishment authority.

type CredentialEstablishEvidence

type CredentialEstablishEvidence = authn.CredentialEstablishEvidence

type CredentialPolicy

type CredentialPolicy = authn.CredentialPolicy

Re-exported so the service layer never names the resolution-surface package.

type DeleteServiceAccountAggregateInput

type DeleteServiceAccountAggregateInput = authn.DeleteServiceAccountAggregateInput

Re-exported so the service layer never names the resolution-surface package.

type Denial

type Denial struct {
	Trail audit.Trail
	Scope domain.Scope
	Event audit.Event
}

Denial is one captured denial event awaiting its durable flush. The actor class is resolved (principals.kind) inside the flush transaction, so the probe-visible attempt keeps its fixed query count. Scope is the chain authorize() itself resolved (tenant trail) or empty (instance trail) — carried beside the event because the envelope deliberately has no chain field a caller could populate.

type DeveloperCredential

type DeveloperCredential = authn.DeveloperCredential

type EnvSetting

type EnvSetting = authn.EnvironmentSettings

GrantRow, Origin and GrantLine are re-exported so the service layer never names the resolution-surface package.

type EnvironmentChain

type EnvironmentChain = authn.EnvironmentChain

EnvironmentChain is a resolved (org, project, env) chain.

type ExpiredRegistrationSignup

type ExpiredRegistrationSignup = authn.ExpiredRegistrationSignup

type ExternalIdentity

type ExternalIdentity = authn.ExternalIdentity

ExternalIdentity is a resolved linked identity.

type FederationIssuer

type FederationIssuer = authn.FederationIssuer

Re-exported so the service layer never names the resolution-surface package.

type Formula

type Formula []Atom

Formula is a conjunction of atoms over dynamically resolved scopes.

type FormulaPin

type FormulaPin struct {
	Operation          string   `json:"operation"`
	Class              string   `json:"class"`
	Level              string   `json:"level"`
	Formula            []string `json:"formula"`
	PostGrantForbidden bool     `json:"post_grant_forbidden,omitempty"`
}

FormulaPin is one row of the pinned operation registry (invariant 6's anti-widening half): silently changing an operation's formula — say environment.update-note from edit(E) to read(E) — widens authority without failing any probe whose fixtures happen to hold both. The pin makes every such change a reviewed fixture diff.

type GrantLine

type GrantLine = authn.GrantLine

GrantRow, Origin and GrantLine are re-exported so the service layer never names the resolution-surface package.

type GrantOriginRow

type GrantOriginRow = authn.GrantOriginRow

GrantOriginRow and LockoutRetention arrive with the SCIM release algorithm (#73 §2.4): the first is one (grant row, origin) pair, the second is a row a retention origin is holding alive.

type GrantRow

type GrantRow = authn.GrantRow

GrantRow, Origin and GrantLine are re-exported so the service layer never names the resolution-surface package.

type HandoffPurpose

type HandoffPurpose = authn.HandoffPurpose

The workspace tier's carrier types, re-exported so the service layer never names internal/store/authn — the import-boundary test enforces that the resolution surface is reachable only through this package.

type Identity

type Identity struct {
	Principal          domain.PrincipalID
	AuthorityPrincipal domain.PrincipalID
	DeveloperScope     domain.Scope
	// Class is what this identity authenticated AS. It is set on every
	// resolution path, never inferred from an empty field: the ADR requires
	// machine principals to be visibly distinct from humans everywhere they
	// appear, and a distinction carried by absence is one a caller forgets.
	// A LocalPrincipal actor carries no class, because local host authority
	// is neither.
	Class domain.PrincipalClass
	// SessionID is empty for a machine identity. A machine has no session,
	// no cookie and no assurance record (#16's propagation), which is also
	// what exempts it from the MFA-mandatory check it could never satisfy.
	SessionID string
	// ProviderID is the OIDC provider provenance carried by a federated session.
	// It remains empty for local, SAML, machine, and workspace identities.
	ProviderID       string
	OAuth2ProviderID string
	SAMLProviderID   string
	// CredentialID names the machine credential presented, and is empty for
	// a human. It is the forensic answer to "which token", which is the
	// question after a leak — one service account holds several.
	CredentialID string
	Artifact     string
	// CredentialExpiresAt is the presenting MACHINE credential's expiry when it
	// is finite, and the zero time for an indefinite credential or a human
	// session (which has its own idle/absolute clocks instead). The delivery
	// surface returns it so a consumer can raise the ADR's ahead-of-time
	// expiry condition; it is read from the same credential row resolution
	// already loaded, never a second read.
	CredentialExpiresAt time.Time
	Assurance           Assurance
	CreatedAt           time.Time
	LastSeenAt          time.Time
	IdleExpiresAt       time.Time
	AbsoluteExpiresAt   time.Time
	// CSRFVerifier is the browser session's synchronizer-token verifier, nil
	// for a CLI session. Carrying the VERIFIER (a hash) rather than the token
	// out of the transaction is safe and lets the transport enforce the CSRF
	// contract it owns (#54 A10, #56).
	CSRFVerifier []byte
	// EnrolmentRequired confines a password-assured session minted for an
	// unenrolled account under a `required` second-factor policy (#760). The
	// authorization chokepoint refuses every operation for such a session except
	// the enrolment allowlist until a factor stands.
	EnrolmentRequired bool
}

Identity is a live, resolved caller — human or machine.

type InstanceConnection

type InstanceConnection = authn.InstanceConnection

The workspace tier's carrier types, re-exported so the service layer never names internal/store/authn — the import-boundary test enforces that the resolution surface is reachable only through this package.

type KDFParams

type KDFParams = authn.KDFParams

KDFParams are the Argon2id parameters recorded with a verifier.

type KeyTarget

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

KeyTarget names the key a key-aware authorization addresses. The folder a rule matches on is always read from the database, except for a key being created (it has no row yet: the folder IS what is being authorized) and the destination of a move (the id is resolved, the new folder is what is being authorized).

func KeyApprovalRequest

func KeyApprovalRequest(id string) KeyTarget

KeyApprovalRequest addresses the first pinned key of an approval request. Eligible approvers may act on another person's request; ownership is checked separately by the approval policy, never inferred from this metadata lookup.

func KeyByID

func KeyByID(id string) KeyTarget

KeyByID addresses an existing key by its stable id.

func KeyByName

func KeyByName(name string) KeyTarget

KeyByName addresses an existing key by its name within the project.

func KeyMovedTo

func KeyMovedTo(id, folder string) KeyTarget

KeyMovedTo addresses an existing key as it would be after moving to folder.

func KeyPendingVersion

func KeyPendingVersion(id string) KeyTarget

KeyPendingVersion addresses an owned live draft by key metadata only.

func KeyToCreate

func KeyToCreate(folder string) KeyTarget

KeyToCreate addresses a key that does not exist yet, by destination folder.

type LockoutRetention

type LockoutRetention = authn.LockoutRetention

GrantRow, Origin and GrantLine are re-exported so the service layer never names the resolution-surface package.

type LoginChallenge

type LoginChallenge = authn.LoginChallenge

LoginChallenge is a resolved login challenge (#760).

type MachineCredential

type MachineCredential = authn.MachineCredential

Re-exported so the service layer never names the resolution-surface package.

type NetworkOperationPolicy

type NetworkOperationPolicy struct {
	Formula     []string
	AuditedNone bool
	ReadOnly    bool
}

NetworkOperationPolicy is the narrow immutable projection used by network adapters to prove that their compiled contract matches the authorization registry. It contains no handler or datastore authority.

func LookupNetworkOperationPolicy

func LookupNetworkOperationPolicy(name string) (NetworkOperationPolicy, bool)

LookupNetworkOperationPolicy returns the registered formula and successful audit disposition for one authorization operation.

type NewCLIReauthHandoff

type NewCLIReauthHandoff = authn.NewCLIReauthHandoff

type NewCredential

type NewCredential = authn.NewMachineCredential

Re-exported so the service layer never names the resolution-surface package.

type NewCredentialAuthority

type NewCredentialAuthority = authn.NewCredentialAuthority

NewCredentialAuthority is the mint carrier.

type NewExternalIdentity

type NewExternalIdentity = authn.NewExternalIdentity

NewExternalIdentity is the link insert carrier.

type NewFederationIssuer

type NewFederationIssuer = authn.NewFederationIssuer

Re-exported so the service layer never names the resolution-surface package.

type NewInstanceConnection

type NewInstanceConnection = authn.NewInstanceConnection

The workspace tier's carrier types, re-exported so the service layer never names internal/store/authn — the import-boundary test enforces that the resolution surface is reachable only through this package.

type NewLoginChallenge

type NewLoginChallenge = authn.NewLoginChallenge

NewLoginChallenge is the login-challenge insert carrier.

type NewOAuth2Provider

type NewOAuth2Provider = authn.NewOAuth2Provider

type NewOAuth2Transaction

type NewOAuth2Transaction = authn.NewOAuth2Transaction

type NewOIDCTransaction

type NewOIDCTransaction = authn.NewOIDCTransaction

NewOIDCTransaction is the transaction insert carrier.

type NewProvider

type NewProvider = authn.NewProvider

NewProvider is the provider create carrier.

type NewReauthWindow

type NewReauthWindow = authn.NewReauthWindow

NewReauthWindow is the reauth-window insert carrier.

type NewRegistrationSignup

type NewRegistrationSignup = authn.NewRegistrationSignup

NewRegistrationSignup is the pending-row insert carrier.

type NewSAMLProvider

type NewSAMLProvider = authn.NewSAMLProvider

NewSAMLProvider is the provider insert carrier.

type NewSAMLReplay

type NewSAMLReplay = authn.NewSAMLReplay

NewSAMLReplay is the durable assertion replay insert carrier.

type NewSAMLSPKey

type NewSAMLSPKey = authn.NewSAMLSPKey

NewSAMLSPKey is the SP signing-key insert carrier.

type NewSAMLTransaction

type NewSAMLTransaction = authn.NewSAMLTransaction

NewSAMLTransaction is the transaction insert carrier.

type NewServiceAccount

type NewServiceAccount = authn.NewServiceAccount

Re-exported so the service layer never names the resolution-surface package.

type NewSession

type NewSession = authn.NewSession

NewSession is the session-mint carrier.

type NewTOTPCredential

type NewTOTPCredential = authn.NewTOTPCredential

NewTOTPCredential is the TOTP insert carrier.

type NewWebAuthnCeremony

type NewWebAuthnCeremony = authn.NewWebAuthnCeremony

NewWebAuthnCeremony is the ceremony insert carrier.

type NewWebAuthnCredential

type NewWebAuthnCredential = authn.NewWebAuthnCredential

NewWebAuthnCredential is the passkey insert carrier.

type NewWorkspaceHandoff

type NewWorkspaceHandoff = authn.NewWorkspaceHandoff

The workspace tier's carrier types, re-exported so the service layer never names internal/store/authn — the import-boundary test enforces that the resolution surface is reachable only through this package.

type OAuth2Provider

type OAuth2Provider = authn.OAuth2Provider

OAuth2 uses its own profile and nonce-free transaction carriers.

type OAuth2ProviderUpdate

type OAuth2ProviderUpdate = authn.OAuth2ProviderUpdate

type OAuth2Transaction

type OAuth2Transaction = authn.OAuth2Transaction

type OIDCProvider

type OIDCProvider = authn.OIDCProvider

OIDCProvider is a resolved provider row.

type OIDCTransaction

type OIDCTransaction = authn.OIDCTransaction

OIDCTransaction is a resolved transaction row.

type Operation

type Operation string

Operation names one entry in the operation registry — the single table mapping each operation to its authorization formula (permission-model ADR: per operation formulas, never "the capability for this endpoint"). authorize() evaluates the named formula and the proof records which operation it was minted for; the store boundary rejects a proof minted for a different operation.

const (
	OpRemotePairingPrepare       Operation = "remote-pairing.prepare"
	OpRemotePairingCreate        Operation = "remote-pairing.create"
	OpRemotePairingList          Operation = "remote-pairing.list"
	OpRemotePairingRevoke        Operation = "remote-pairing.revoke"
	OpRemotePairingComplete      Operation = "remote-pairing.complete"
	OpMailGet                    Operation = "mail.get"
	OpMailTest                   Operation = "mail.test"
	OpSelfConfigPreview          Operation = "self-config.preview"
	OpSelfConfigStatus           Operation = "self-config.status"
	OpSelfConfigAdopt            Operation = "self-config.adopt"
	OpSelfConfigApply            Operation = "self-config.apply"
	OpSelfConfigTest             Operation = "self-config.test"
	OpSelfConfigProvisionProject Operation = "self-config.provision-project"
	// The hierarchy surface (#48): Organization, Project, Environment, Folder.
	//
	// Org creation and enumeration are instance-scoped — a create has no
	// parent tenant and a list spans all of them — while every BY-ID org
	// operation is tenant-class at org depth, so an org the caller may not
	// reach answers exactly like one that is not there (mvp-boundary C1).
	OpOrgCreate Operation = "org.create"
	OpOrgGet    Operation = "org.get"
	OpOrgList   Operation = "org.list"
	OpOrgRename Operation = "org.rename"
	OpOrgDelete Operation = "org.delete"

	OpProjectCreate Operation = "project.create"
	OpProjectGet    Operation = "project.get"
	OpProjectList   Operation = "project.list"
	OpProjectRename Operation = "project.rename"
	OpProjectDelete Operation = "project.delete"

	OpEnvCreate       Operation = "environment.create"
	OpEnvRead         Operation = "environment.read"
	OpEnvList         Operation = "environment.list"
	OpEnvParameterSet Operation = "environment.parameter-set"
	OpEnvRename       Operation = "environment.rename"
	OpEnvReorder      Operation = "environment.reorder"
	OpEnvDelete       Operation = "environment.delete"
	OpEnvUpdateNote   Operation = "environment.update-note"

	// The key catalogue (#49, schema-model ADR). Every operation addresses
	// PROJECT depth: a key is declared once per project and the scope lattice
	// has no key level (permission-model ADR: no key-scoped grants in v1).
	//
	// The atom is `definitions-edit`, which the permission-model ADR fixes as the
	// definitions bundle — "keys, rules, folder paths, and environment
	// topology" — and which explicitly RETIRES the schema-model ADR's earlier
	// `schema-edit` name for the same grant.
	OpKeyCreate              Operation = "key.create"
	OpKeyGet                 Operation = "key.get"
	OpKeyList                Operation = "key.list"
	OpKeyRename              Operation = "key.rename"
	OpKeyUpdateDeclaration   Operation = "key.update-declaration"
	OpKeyUpdateMetadata      Operation = "key.update-metadata"
	OpKeySetGroup            Operation = "key.set-group"
	OpKeyDelete              Operation = "key.delete"
	OpKeyReclassify          Operation = "key.reclassify"
	OpKeySchemaPublishEmpty  Operation = "key.schema-publish-empty"
	OpKeySchemaPublishValues Operation = "key.schema-publish-values"

	// The two reveal gates. They are OPERATIONS rather than an inline
	// capability check because the chokepoint is the only place authorization
	// is evaluated: a second authorize() call against a registered formula
	// gets the denial writer, the assurance leg, the formula pin and the
	// probe contract for free, where a hand-rolled grant lookup would get none
	// of them and would be a parallel authorization path.
	//
	// Both are evaluated BEFORE any evaluation of the changed rule against a
	// value, per the schema-model ADR's load-bearing security rule: the operation is
	// rejected without evaluating, because timing and abort/success are
	// themselves the channel.
	OpKeySecretRuleChange Operation = "key.secret-rule-change"
	OpKeyDeclassify       Operation = "key.declassify"

	// Definitions Git flow (#70, source-of-truth ADR). export and check are pure
	// reads (`read@project`, audited-none); plan and apply carry
	// `definitions-edit@project`, with apply additionally fanning out
	// `publish@environment` immediately before commit. Settings read is
	// `read@project`; settings write rides `project-settings@project`,
	// deliberately off the definitions-edit path so a blocked editor cannot
	// disable its own git-mode guard (permission-model ADR §84).
	OpDefinitionsExport      Operation = "definitions.export"
	OpDefinitionsCheck       Operation = "definitions.check"
	OpDefinitionsPlanCreate  Operation = "definitions.plan"
	OpDefinitionsPlanGet     Operation = "definitions.plan.get"
	OpDefinitionsApply       Operation = "definitions.apply"
	OpDefinitionsSettingsGet Operation = "definitions.settings.get"
	OpDefinitionsSettingsSet Operation = "definitions.settings.set"
	// Project capacity is governed by project-settings authority.
	OpProjectCapacityRead Operation = "project.capacity.read"
	OpProjectCapacitySet  Operation = "project.capacity.set"
	// The per-project machine-reveal opt-in (source-of-truth ADR).
	OpProjectMachineRevealGet Operation = "project.machine-reveal.get"
	OpProjectMachineRevealSet Operation = "project.machine-reveal.set"

	// The flat value model (#50, flat-model ADR + permission-model ADR's
	// locked formula table). Every operation addresses ENVIRONMENT depth: a
	// value attaches to a (key, environment) and there are no other layers,
	// so there is no shallower thing to address.
	//
	// The formulas, and why each is what it is:
	//
	//   - read      → `read(E)`. The permission-model ADR's `read` carries "the
	//                 project key catalogue … validation status, diffs
	//                 (write-presence only for `secret` keys); **`config`
	//                 values**". Presence is write-presence; `config`
	//                 plaintext rides `read` because classification IS the
	//                 sensitivity boundary.
	//   - reveal    → `read(E) ∧ reveal(E)`, the locked disclosure row for
	//                 current `secret` material, with one audit event per
	//                 disclosed key.
	//   - write     → `edit(E) ∧ publish(E)`. `edit` alone is the ADR's
	//                 working-state atom and "creates no revision"; this slice
	//                 has no working state, so a write here IS delivered
	//                 material the moment it commits. Requiring `publish` as
	//                 well is the fail-closed reading of the same table that
	//                 puts `publish(destination)` on every operation that
	//                 makes an environment start delivering something. When
	//                 #51 lands drafts, the draft write is `edit` alone and
	//                 this pair moves to the publish step.
	//   - copy      → the locked row, split across the two scopes it names,
	//                 because a formula is evaluated against ONE addressed
	//                 scope and this one spans two: `reveal(source E)` on the
	//                 source and `reveal(destination E) ∧ publish(destination
	//                 E)` on each destination. Clone-at-creation and
	//                 bulk-apply are the same pair — the ADR's three
	//                 ergonomic operations differ in what they copy, never in
	//                 what authorizes it.
	//
	// `reveal-history(source E)` — the historical-material half of the locked
	// row — has no operation here because this slice stores no historical
	// material: revisions are #51's. It joins when its material does.
	OpValueRead   Operation = "value.read"
	OpValueList   Operation = "value.list"
	OpValueReveal Operation = "value.reveal"
	// The reveal guard's own read (#58). It answers "will disclosing here
	// prompt me, and with which factor" — the window state, the protected
	// flag, and whether TOTP may open a window at all. Its formula is `read`
	// ALONE and deliberately not `reveal`: the browser has to render the
	// ceremony modal's shape before it holds any disclosure, and the answer is
	// project settings plus the caller's own session state, never material.
	OpRevealWindowRead Operation = "reveal.window_read"
	OpValueSet         Operation = "value.set"
	OpValueClear       Operation = "value.clear"
	// The copy pair. Both are reached by copy-to, bulk-apply AND
	// clone-at-creation: one authorization story for every server-side
	// duplication of stored material, which is exactly what the flat model's
	// closed trigger list asks for.
	OpValueCopySource      Operation = "value.copy-source"
	OpValueCopyDestination Operation = "value.copy-destination"
	// The destination leg for `config` material, which is NOT reveal-gated on
	// either side. One surface, two registry rows, because one formula cannot
	// express two authorization stories — the same shape credential-reset's
	// org/instance pair takes.
	//
	// This is not a softening of the locked row; it is the only reading under
	// which the locked row's own consequences are reachable. Grants inherit
	// DOWNWARD only, so `reveal` on an environment that does not exist yet can
	// come only from a project-or-wider grant — which necessarily covers every
	// source environment in that project. Requiring destination `reveal` for
	// `config` material would therefore make source-`reveal` always hold at a
	// clone, and the flat-model ADR's "creation proceeds and the uncopied
	// secrets land absent, enumerated by name" — and mvp-boundary C2's "a clone
	// that would leave a `mode: all` required secret absent aborts naming the
	// keys" — would be unreachable text. The gate is classification-scoped in
	// its own wording ("begin delivering a **`secret`** value occurrence the
	// publisher did not supply"), and the permission-model ADR puts `config` values
	// under `read`.
	OpValueCopyDestinationConfig Operation = "value.copy-destination-config"

	// The import path (#68, import-paths ADR). Two operations, one per phase.
	//
	// `import.presence` is phase 1's ONLY server-side contact: it reads the
	// project's declared keys and, per key, the two-state presence in ONE
	// environment plus the server-minted occurrence token naming the exact
	// resolved state. The ADR's formula, exactly: structure reads carry the
	// project-scoped `read` the member already holds, and PRESENCE READS
	// REQUIRE `read(E)` for every environment whose presence is consulted —
	// which for an environment-depth operation is this environment. The
	// operation therefore carries both atoms: read@project for structure and
	// read@environment for presence. It never
	// requires `reveal`, never compares values and never writes; it is
	// audited-none like every other proof-scoped pure read.
	//
	// `value.import` is phase 2's batch write: one transaction, one
	// environment, the manifest precondition, and then ordinary value writes.
	// Its formula is `value.set`'s, unchanged — the writes it lands ARE
	// ordinary value writes, and an import that could write where `values set`
	// cannot would be a second write path with a weaker gate.
	OpImportPresence Operation = "import.presence"
	OpValueImport    Operation = "value.import"

	// Drafts, publishing and revisions (#51, revision-model ADR).
	OpValueStage       Operation = "value.stage"
	OpValuePendingList Operation = "value.pending-list"
	// `value.validate` evaluates a proposed change without staging it
	// (mcp-write ADR § 1). It carries `edit@env`, the authority to make the
	// change it validates, and it is audited: an authority-bearing action,
	// not a pure read whose result the trail would duplicate.
	OpValueValidate   Operation = "value.validate"
	OpValuePublish    Operation = "value.publish"
	OpValueInitialize Operation = "value.initialize"
	// The one bulk-disclosure verb and its two material halves. `values export`
	// carries `read ∧ reveal` for CURRENT material and `read ∧ reveal-history`
	// for historical material; a mixed export evaluates each formula over
	// exactly the material it governs, which one formula cannot express.
	OpValueExport              Operation = "value.export"
	OpValueExportReveal        Operation = "value.export-reveal"
	OpValueExportRevealHistory Operation = "value.export-reveal-history"

	OpRevisionList           Operation = "revision.list"
	OpRevisionShow           Operation = "revision.show"
	OpRevisionSignals        Operation = "revision.signals"
	OpRevisionRestore        Operation = "revision.restore"
	OpRevisionRestoreHistory Operation = "revision.restore-reveal-history"
	OpRevisionRestoreCurrent Operation = "revision.restore-reveal-current"

	OpPinSet        Operation = "pin.set"
	OpPinSetHistory Operation = "pin.set-reveal-history"
	OpPinList       Operation = "pin.list"
	OpPinRelease    Operation = "pin.release"

	// Secret-change approvals (#151). Policy administration is project-scoped
	// (project-settings). Reading and voting are environment-scoped (publish@env:
	// only a principal who could publish here may see or vote on the review
	// queue). OpApprovalVote and OpApprovalBypass are the operations the two new
	// reauthentication purposes bind to; the merge/bypass DECISION rides the
	// ordinary OpValuePublish chokepoint with an added live conjunct, never a
	// second publish path.
	OpApprovalPolicyWrite Operation = "approval.policy-write"
	OpApprovalPolicyRead  Operation = "approval.policy-read"
	OpApprovalRequestRead Operation = "approval.request-read"
	OpApprovalVote        Operation = "approval.vote"
	OpApprovalBypass      Operation = "approval.bypass"

	// Approval-mediated temporary access (#152). Policy administration is
	// member management (manage-members@project). Everything request-side is
	// environment-scoped under read@env: a requester can only ask to be lifted
	// inside an environment they can already see, so a request is never a
	// discovery oracle. The approver's and revoker's authority beyond read is a
	// post-grant check in the service (eligibility, grantability), refused with
	// a reachable 403.
	OpAccessPolicyWrite   Operation = "access.policy-write"
	OpAccessPolicyRead    Operation = "access.policy-read"
	OpAccessRequestCreate Operation = "access.request-create"
	OpAccessRequestRead   Operation = "access.request-read"
	OpAccessVote          Operation = "access.vote"
	OpAccessCancel        Operation = "access.cancel"
	OpAccessRevoke        Operation = "access.revoke"
	OpAccessBypass        Operation = "access.bypass"

	// The advisory channel's two checks: one at connect, over the project, and
	// one PER EVENT over the environment the event names.
	OpAdvisoryWatch Operation = "advisory.watch"
	OpAdvisoryEvent Operation = "advisory.event"

	// `rotate-token-key` rides `rotate-dek`: the permission-model ADR's capability
	// set is CLOSED and names four rotation atoms for five rotation verbs, and
	// the root token key is a tier-3 key alongside the DEKs -- same master,
	// same one-active-per-scope index, same retirement path.
	OpRotateTokenKey Operation = "crypto.rotate-token-key"

	// `rotate-scanning-key` is the rotation inventory's sixth member
	// (secret-scanning ADR section 4): outright replacement of the tier-3
	// scanning-fingerprint key with no version keyring and no reencrypt walk,
	// dropping every dismissal row in the same transaction. It rides the same
	// `rotate-dek` authority as the other tier-3 rotations for the same reason
	// `rotate-token-key` does.
	OpRotateScanningKey Operation = "crypto.rotate-scanning-key"
	// rotate-dek appends a DEK version for one project or the instance scope
	// (#75, encryption-model ADR § Rotation), its own instance-level capability.
	OpRotateDEK Operation = "crypto.rotate-dek"
	// rotate-master-key generates a new master and re-wraps every tier-3 key
	// under it, retiring the old master after a fenced zero-reference check.
	OpRotateMasterKey Operation = "crypto.rotate-master-key"
	// rotate-root-key replaces the operator-held root through the crash-safe
	// dual-wrapped protocol (--prepare / --verify / --finalize), one capability
	// across all three phases.
	OpRotateRootKey Operation = "crypto.rotate-root-key"
	// reencrypt walks a scope's ciphertext onto the active DEK version and
	// retires the old (#75 + #187). Split by scope class: the project walk is
	// tenant-class (it reads/writes a project's tenant-owned value rows), the
	// instance walk is instance-class. Both ride the instance-level reencrypt
	// capability — an operator authority over every scope.
	OpReencryptProject  Operation = "crypto.reencrypt-project"
	OpReencryptInstance Operation = "crypto.reencrypt-instance"

	OpKeyGroupCreate Operation = "key-group.create"
	OpKeyGroupGet    Operation = "key-group.get"
	OpKeyGroupList   Operation = "key-group.list"
	OpKeyGroupRename Operation = "key-group.rename"
	OpKeyGroupDelete Operation = "key-group.delete"

	OpFolderCreate Operation = "folder.create"
	OpFolderGet    Operation = "folder.get"
	OpFolderList   Operation = "folder.list"
	OpFolderRename Operation = "folder.rename"
	OpFolderDelete Operation = "folder.delete"

	// OIDC provider administration (#54, human-auth ADR - Login methods).
	// Instance-config operations, MFA-mandatory like every instance capability.
	OpOAuth2ProviderPut    Operation = "oauth2-provider.put"
	OpOAuth2ProviderGet    Operation = "oauth2-provider.get"
	OpOAuth2ProviderList   Operation = "oauth2-provider.list"
	OpOAuth2ProviderDelete Operation = "oauth2-provider.delete"
	OpProviderPut          Operation = "oidc-provider.put"
	OpProviderGet          Operation = "oidc-provider.get"
	OpProviderList         Operation = "oidc-provider.list"
	OpProviderDelete       Operation = "oidc-provider.delete"

	// SAML provider administration (#72, saml-sp ADR). These join the same
	// instance-config capability surface as OIDC. Metadata refresh is an action
	// on the provider resource, not a new authority or noun family.
	OpSAMLProviderPut             Operation = "saml-provider.put"
	OpSAMLProviderPatch           Operation = "saml-provider.patch"
	OpSAMLProviderGet             Operation = "saml-provider.get"
	OpSAMLProviderList            Operation = "saml-provider.list"
	OpSAMLProviderDelete          Operation = "saml-provider.delete"
	OpSAMLProviderRefreshMetadata Operation = "saml-provider.refresh-metadata"
	OpSAMLSPKeyList               Operation = "saml-sp-key.list"
	OpSAMLSPKeyRotate             Operation = "saml-sp-key.rotate"
	OpSAMLSPKeyRetire             Operation = "saml-sp-key.retire"
	OpSAMLSPKeyCompromiseRetire   Operation = "saml-sp-key.compromise-retire"

	// Administrator-issued credential reset (#54, human-auth ADR - Recovery).
	// The capability is credential-reset, valid at org and instance scope only.
	// One route dispatches between these two by the target's grant
	// classification: an org-bounded target (grants within one org, no instance
	// capability) is reached through the org-scoped operation — an org-scope OR
	// instance-scope credential-reset grant covers it by downward inheritance; a
	// multi-org (no instance capability) target has no single org to address and
	// is reached only at instance scope. Instance-capability targets have no
	// network path at all (break-glass only). Both are MFA-mandatory (the atom
	// is in MFAMandatory) and audit through the resolution surface.
	OpCredentialReset         Operation = "credential-reset.org"
	OpCredentialResetInstance Operation = "credential-reset.instance"

	// Audit trail reads (#45, audit-model ADR). One operation per addressed
	// depth — the registry pins one depth per tenant operation, so the three
	// depths are three rows sharing one service implementation; the formula
	// atom is audit-read at the addressed depth (grants inherit downward, so
	// an org-level audit-read covers all three). The instance trail is read
	// under an instance-scope audit-read grant — grant-evaluated like every
	// instance operation, never route-implied.
	OpAuditQueryOrg       Operation = "audit.query-org"
	OpAuditQueryProject   Operation = "audit.query-project"
	OpAuditQueryEnv       Operation = "audit.query-env"
	OpAuditExportOrg      Operation = "audit.export-org"
	OpAuditExportProject  Operation = "audit.export-project"
	OpAuditExportEnv      Operation = "audit.export-env"
	OpAuditInstanceQuery  Operation = "audit.instance-query"
	OpAuditInstanceExport Operation = "audit.instance-export"

	// The grant surface (#55, permission-model ADR). One operation per
	// ADDRESSED depth, as with audit reads and credential-reset: the registry
	// pins one depth per tenant operation, so the four depths are four rows
	// sharing one service implementation.
	//
	// The formula atom sits at the depth `manage-members` is grantable at,
	// which is NOT always the addressed depth. Granting `read` on one
	// environment is authorized by `manage-members(project)` — the atom's
	// level truncates the resolved chain, so an env-addressed grant asks the
	// project question. That is the ADR's own rule ("manage-members at org /
	// project: create, modify and revoke grants at or below that scope")
	// expressed in the formula rather than in service code.
	OpGrantCreateOrg      Operation = "grant.create-org"
	OpGrantCreateProject  Operation = "grant.create-project"
	OpGrantCreateEnv      Operation = "grant.create-env"
	OpGrantCreateInstance Operation = "grant.create-instance"
	// Member invitation (#568): account creation under manage-members, the
	// human-auth ADR's named path. Two operations because the formula differs
	// per depth exactly as grant.create does; each route names one.
	OpMemberInviteOrg      Operation = "member.invite-org"
	OpMemberInviteInstance Operation = "member.invite-instance"

	OpRegistrationPolicyGetOrg         Operation = "registration-policy.get-org"
	OpRegistrationPolicyPutOrg         Operation = "registration-policy.put-org"
	OpRegistrationPolicyDeleteOrg      Operation = "registration-policy.delete-org"
	OpRegistrationPolicyGetInstance    Operation = "registration-policy.get-instance"
	OpRegistrationPolicyPutInstance    Operation = "registration-policy.put-instance"
	OpRegistrationPolicyDeleteInstance Operation = "registration-policy.delete-instance"

	OpGrantRevokeOrg     Operation = "grant.revoke-org"
	OpGrantRevokeProject Operation = "grant.revoke-project"
	// Member access rules (member-access-rules ADR). A rule may span several
	// projects of one org; the service authorizes each project it names, so
	// these address PROJECT depth. The atom is legacy `manage-members`: rules
	// themselves never satisfy it (it is inert on rules until delegation
	// containment exists), so only a grant-holding member manager edits rules.
	OpRuleCreate Operation = "rule.create"
	OpRuleRevoke Operation = "rule.revoke"
	// The rule listing mirrors the grant listing: one operation per addressed
	// depth, legacy `manage-members` at that depth.
	OpRuleListOrg         Operation = "rule.list-org"
	OpRuleListProject     Operation = "rule.list-project"
	OpGrantRevokeEnv      Operation = "grant.revoke-env"
	OpGrantRevokeInstance Operation = "grant.revoke-instance"

	// Listing the membership surface is `manage-members` too, not `read`:
	// who holds which capability is administrative information, and the ADR
	// puts every grant read and write under the same atom ("create, modify
	// and revoke grants at or below that scope" is the administration of the
	// list the surface shows).
	OpGrantListOrg      Operation = "grant.list-org"
	OpGrantListProject  Operation = "grant.list-project"
	OpGrantListInstance Operation = "grant.list-instance"

	// Template application is grant creation with a name attached: the
	// expansion happens AT GRANT TIME and produces ordinary grants, so it
	// carries the same formula as a create at the same depth.
	OpTemplateApplyOrg      Operation = "grant.template-org"
	OpTemplateApplyProject  Operation = "grant.template-project"
	OpTemplateApplyEnv      Operation = "grant.template-env"
	OpTemplateApplyInstance Operation = "grant.template-instance"

	// The protected-environment flag and the per-environment reauthentication
	// window (#55). `project-settings` is deliberately split out of
	// `definitions-edit` — these exist to restrain the definitions editor, and
	// a guard whose off-switch sits in the hand it restrains is not a guard.
	// The read is bare `read(E)`: an environment's protection state is part of
	// its public shape, and hiding it from a reader would make the reveal
	// ceremony inexplicable.
	OpEnvSettingsRead        Operation = "environment.settings-read"
	OpEnvSettingsUpdate      Operation = "environment.settings-update"
	OpOrgRetentionRead       Operation = "retention.org-read"
	OpOrgRetentionUpdate     Operation = "retention.org-update"
	OpProjectRetentionRead   Operation = "retention.project-read"
	OpProjectRetentionUpdate Operation = "retention.project-update"
	OpRetentionHealthRead    Operation = "retention.health-read"
	OpUpdateStatusRead       Operation = "update.status-read"
	OpUpdateRequest          Operation = "update.request"
	OpUpdateJobRead          Operation = "update.job-read"

	// Machine identities (#61). Every one of these asks
	// `manage-identities(project)` and nothing more, because that is the
	// whole of what the CHOKEPOINT decides here.
	//
	// The mint and widen formulas' reveal conjuncts are deliberately NOT in
	// this table, and that is the load-bearing part: they range over a set
	// computed from the RESULTING STATE — every environment reachable in the
	// post-state for a mint, only the newly reachable set for a grant
	// mutation — which no static (capability, level) atom can express. They
	// are evaluated in service.Identities, in the same transaction, against
	// the same grant rows, and refuse before any row is written. A formula
	// atom here would have been a claim the registry could not keep.
	OpServiceAccountCreate             Operation = "identity.service-account-create"
	OpServiceAccountList               Operation = "identity.service-account-list"
	OpServiceAccountDelete             Operation = "identity.service-account-delete"
	OpCredentialMint                   Operation = "identity.credential-mint"
	OpCredentialList                   Operation = "identity.credential-list"
	OpCredentialRevoke                 Operation = "identity.credential-revoke"
	OpCredentialPolicyRead             Operation = "identity.credential-policy-read"
	OpCredentialPolicyUpdate           Operation = "identity.credential-policy-update"
	OpDeveloperCredentialMint          Operation = "developer-credential.mint"
	OpDeveloperCredentialListProject   Operation = "developer-credential.list-project"
	OpDeveloperCredentialRevokeProject Operation = "developer-credential.revoke-project"
	OpDeveloperCredentialPolicyRead    Operation = "developer-credential.policy-read"
	OpDeveloperCredentialPolicyUpdate  Operation = "developer-credential.policy-update"

	// OIDC federation (#62). Issuer configuration is INSTANCE-scoped under
	// `instance-config`, never org- or project-scoped: #16 fixed this exact
	// argument for human providers, because an org-scoped issuer would let an
	// org admin add a provider and mint identities authenticating into the
	// instance.
	OpFederationIssuerCreate Operation = "federation.issuer-create"
	OpFederationIssuerList   Operation = "federation.issuer-list"
	OpFederationIssuerUpdate Operation = "federation.issuer-update"
	OpFederationIssuerDelete Operation = "federation.issuer-delete"

	// Creating a federated binding is a MINT, so it sits beside
	// identity.credential-mint and carries the same capability half here and the
	// same post-state disclosure conjunct in the service. There is no
	// binding-UPDATE operation, and that absence is the immutability rule
	// expressed in the registry: a change is a replacement mint through this
	// same row, carrying the full formula, and an operation for editing in place
	// would be the authority-laundering path #15 closed for adapters.
	//
	// Binding DELETE and LIST reuse identity.credential-revoke and
	// identity.credential-list: a binding IS a credential row, so a second pair
	// of operations over the same rows would be two places for one formula to
	// drift. Reactivation (§ Restore) rides credential-revoke too, because it
	// only ever NARROWS what the binding accepts.
	OpBindingCreate Operation = "identity.binding-create"

	// The machine delivery surface (#62; ADR § Authentication, authorization
	// and the fetch path). Tenant-class at ENVIRONMENT depth under bare `read`,
	// which is what makes a caller who lost `read` receive the
	// uniform-nonexistent answer rather than "current" — the conditional path
	// authorizes exactly like the delivering path.
	//
	// It is NOT `audited: none` despite being a bare-`read` tenant operation:
	// the ADR requires one immutable access record per fetch, including the
	// conditional fetch that delivers nothing.
	OpDeliveryFetch Operation = "delivery.fetch"
	// Offline disclosure records are accepted only through a live machine
	// presentation holding the same environment read authority as delivery.
	OpDeliveryReconcileOffline Operation = "delivery.reconcile-offline"
	// Delivery-target condition reporting (#788, k8s-condition-reporting ADR).
	// Report and tombstone are the machine half: `report-delivery-status` at
	// environment depth, the workload's one value-free write (D1). List is the
	// human half: bare `read` on the environment (D7), so rows of an
	// environment the viewer cannot read are absent, never redacted.
	OpDeliveryTargetReport    Operation = "delivery-target.report"
	OpDeliveryTargetTombstone Operation = "delivery-target.tombstone"
	OpDeliveryTargetList      Operation = "delivery-target.list"
	// Generic file destinations (#164). Create, update and delete bind a
	// workload service account's delivery to one environment and key
	// selection, so they need both the adapter and the identity authority of
	// the project. Inspect is adapter metadata. Report is the bound workload's
	// value-free write, under the integration-neutral `report-delivery-status`
	// atom the condition-reporting ADR introduced for exactly this shape.
	OpFileTargetCreate  Operation = "file-target.create"
	OpFileTargetUpdate  Operation = "file-target.update"
	OpFileTargetDelete  Operation = "file-target.delete"
	OpFileTargetInspect Operation = "file-target.inspect"
	OpFileTargetReport  Operation = "file-target.report"
	// SCIM provisioning (#73, scim-provisioning ADR). Two families, two
	// formulas, one depth.
	//
	// The ADMINISTRATION family is `manage-members(org)` AT ORG SCOPE EXACTLY
	// (§1): a mapping row causes grants the author need not hold, and
	// unheld-capability granting is an org/instance power under the locked
	// escalation asymmetry — a project-scope member manager must not reach it
	// through SCIM. The atom sits at LevelOrg rather than the capability's own
	// deepest level for exactly that reason.
	//
	// The WIRE family is `scim-provision(org)`, the machine-only atom the
	// provisioning connection holds structurally. There is no ambient routing
	// by credential: the presented credential must match the binding in the
	// path, and the org in the path is what the formula resolves against.
	OpSCIMBindingCreate Operation = "scim-binding.create"
	OpSCIMBindingGet    Operation = "scim-binding.get"
	OpSCIMBindingList   Operation = "scim-binding.list"
	OpSCIMBindingDelete Operation = "scim-binding.delete"

	OpSCIMMappingCreate Operation = "scim-mapping.create"
	OpSCIMMappingUpdate Operation = "scim-mapping.update"
	OpSCIMMappingDelete Operation = "scim-mapping.delete"
	OpSCIMMappingList   Operation = "scim-mapping.list"

	OpSCIMCredentialMint   Operation = "scim-credential.mint"
	OpSCIMCredentialGet    Operation = "scim-credential.get"
	OpSCIMCredentialList   Operation = "scim-credential.list"
	OpSCIMCredentialRevoke Operation = "scim-credential.revoke"

	OpSCIMDirectoryUsers  Operation = "scim-directory.users"
	OpSCIMDirectoryGroups Operation = "scim-directory.groups"

	OpSCIMUserCreate  Operation = "scim-user.create"
	OpSCIMUserGet     Operation = "scim-user.get"
	OpSCIMUserList    Operation = "scim-user.list"
	OpSCIMUserReplace Operation = "scim-user.replace"
	OpSCIMUserPatch   Operation = "scim-user.patch"
	OpSCIMUserDelete  Operation = "scim-user.delete"

	OpSCIMGroupCreate  Operation = "scim-group.create"
	OpSCIMGroupGet     Operation = "scim-group.get"
	OpSCIMGroupList    Operation = "scim-group.list"
	OpSCIMGroupReplace Operation = "scim-group.replace"
	OpSCIMGroupPatch   Operation = "scim-group.patch"
	OpSCIMGroupDelete  Operation = "scim-group.delete"

	// Discovery (ServiceProviderConfig / ResourceTypes / Schemas) is static
	// protocol documentation carrying no tenant data, but it still runs under
	// the binding's authentication and admission — so it is an operation like
	// any other rather than an unauthenticated hole in the mount.
	OpSCIMDiscovery Operation = "scim-discovery.read"

	// OpSCIMUnsupported is the authenticated refusal of Bulk, /Me and the
	// `.search` POST query. They are routes rather than 404s because the ADR
	// requires each to be refused with the RFC 7644 error shape, and they
	// authenticate like every other wire operation so an unauthenticated caller
	// gets the uniform refusal rather than a 501 confirming the binding exists.
	OpSCIMUnsupported Operation = "scim-unsupported.refuse"
	// Multi-instance, the serving side (#71). The directory-serve operation is
	// what an instance-connection credential presents against, and — per the
	// ADR's amendment to the artifact-eligibility matrix — the ONLY operation
	// it may reach. The embedded OpenAPI operation's `instance-credential`
	// declaration is the other half of the confinement; the formula alone
	// would not carry it, because a later
	// operation adopting the same formula would widen every existing token.
	//
	// It is an instance-scope read that crosses org boundaries BY DESIGN: the
	// listing is instance identity, version, health, and the names and counts
	// of orgs and projects. That is why it is registered as its own operation
	// and probe-classified instance-scope rather than riding any tenant read —
	// there is no single tenant it addresses, and pretending otherwise would
	// put a cross-org read behind a per-org probe contract.
	OpRemoteDirectoryServe Operation = "remote.directory-serve"

	// Multi-instance, the VIEWING side (#71). The split follows the ADR's own
	// reasoning: CUSTODY of connections — add, remove, credential storage — is
	// instance configuration and rides `instance-config`; VIEWING the directory
	// is `instance-directory`, its own grantable atom, because reading is power
	// and is never bundled. The org/project NAMES in the listing are the reason
	// that gate exists: they are foreign structure, and the remote cannot scope
	// them per-viewer without the proxy machinery the ADR rejects.
	OpRemoteAdd    Operation = "remote.add"
	OpRemoteList   Operation = "remote.list"
	OpRemoteShow   Operation = "remote.show"
	OpRemoteRename Operation = "remote.rename"
	OpRemoteRemove Operation = "remote.remove"

	// Multi-instance, the SERVING side (#71). Credential custody and the origin
	// allowlist are both instance configuration.
	OpRemoteCredentialCreate Operation = "remote-credential.create"
	OpRemoteCredentialList   Operation = "remote-credential.list"
	OpRemoteCredentialShow   Operation = "remote-credential.show"
	OpRemoteCredentialRevoke Operation = "remote-credential.revoke"

	OpWorkspaceOriginList   Operation = "workspace-origin.list"
	OpWorkspaceOriginAdd    Operation = "workspace-origin.add"
	OpWorkspaceOriginRemove Operation = "workspace-origin.remove"

	// Deployment adapters (#65). The registry carries the plain
	// manage-adapters half; service code adds reveal over every affected
	// environment and reauthentication for configure/widen/adopt/sync.
	OpAdapterConfigure        Operation = "adapter.configure"
	OpAdapterCredentialSet    Operation = "adapter.credential-set"
	OpAdapterCredentialRevoke Operation = "adapter.credential-revoke"
	OpAdapterAdopt            Operation = "adapter.adopt"
	OpAdapterInspect          Operation = "adapter.inspect"
	OpAdapterPlan             Operation = "adapter.plan"
	OpAdapterTest             Operation = "adapter.test"
	OpAdapterSync             Operation = "adapter.sync"
	OpAdapterDelete           Operation = "adapter.delete"
	OpAdapterPush             Operation = "adapter.push"

	// Dynamic secrets (#147). Provider configuration is project-scoped standing
	// authority (manage-identities); a lease is an environment-scoped
	// short-lived credential. Mint carries read+reveal so the machine-reveal
	// opt-in and pin rules apply unchanged. OpLeaseRenew is the worker's
	// per-transition re-authorization for renew (mint re-auths through
	// OpLeaseMint); revoke/expire are the fail-safe direction and re-check no
	// grants.
	OpDynamicProviderConfigure        Operation = "dynamic-provider.configure"
	OpDynamicProviderInspect          Operation = "dynamic-provider.inspect"
	OpDynamicProviderCredentialSet    Operation = "dynamic-provider.credential-set"
	OpDynamicProviderCredentialRevoke Operation = "dynamic-provider.credential-revoke"
	OpDynamicProviderDelete           Operation = "dynamic-provider.delete"
	OpLeaseMint                       Operation = "lease.mint"
	OpLeaseInspect                    Operation = "lease.inspect"
	OpLeaseRenew                      Operation = "lease.renew"
	OpLeaseRevoke                     Operation = "lease.revoke"
	OpLeaseSettle                     Operation = "lease.settle"

	// SSH user certificates (#155). Everything is environment-scoped. CA and
	// profile management is manage-identities@project; reads of public trust
	// material and metadata are read@environment (machine-holdable, so a host
	// holding a workload credential fetches its trust bundle and KRL). Issue
	// is read@environment like lease.mint; the per-profile requester list and
	// the human mint ceremony are its service-side conjuncts. Revoke is
	// read@environment plus "requester or manage-identities" in the service.
	OpSSHCAConfigure      Operation = "ssh-ca.configure"
	OpSSHCAInspect        Operation = "ssh-ca.inspect"
	OpSSHCARotate         Operation = "ssh-ca.rotate"
	OpSSHCARetireKey      Operation = "ssh-ca.retire-key"
	OpSSHCADelete         Operation = "ssh-ca.delete"
	OpSSHProfileConfigure Operation = "ssh-profile.configure"
	OpSSHProfileInspect   Operation = "ssh-profile.inspect"
	OpSSHProfileDelete    Operation = "ssh-profile.delete"
	OpSSHCertIssue        Operation = "ssh-cert.issue"
	OpSSHCertInspect      Operation = "ssh-cert.inspect"
	OpSSHCertRevoke       Operation = "ssh-cert.revoke"
	// Transit (#156, transit ADR D7). Key management rides crypto-manage at
	// project scope (human-only); the data plane rides crypto-use at
	// environment scope (workload and automation may hold it). Inspection is
	// the bare `read@environment` metadata read, audited-none. transit.use
	// carries postGrantForbidden: key policy (state, version window, per-key
	// caller entries, allowed operations) refuses after the formula passes.
	OpTransitKeyCreate    Operation = "transit.key-create"
	OpTransitKeyInspect   Operation = "transit.key-inspect"
	OpTransitKeyConfigure Operation = "transit.key-configure"
	OpTransitKeyRotate    Operation = "transit.key-rotate"
	OpTransitKeyLifecycle Operation = "transit.key-lifecycle"
	OpTransitKeyTrim      Operation = "transit.key-trim"
	OpTransitUse          Operation = "transit.use"

	// Private PKI (#154, pki ADR). Issuers and profiles are instance policy
	// (`instance-config`); issuance is an environment act under the
	// `issue-certificate` atom, machine-holdable under the profile's
	// machine_issuance opt-in, which the service applies per caller class (the
	// lease.mint shape). Inspect is the audit-free certificate read.
	OpPKIIssuerInspect     Operation = "pki-issuer.inspect"
	OpPKIIssuerCreate      Operation = "pki-issuer.create"
	OpPKIIssuerInstall     Operation = "pki-issuer.install"
	OpPKIIssuerRotate      Operation = "pki-issuer.rotate"
	OpPKIIssuerRetire      Operation = "pki-issuer.retire"
	OpPKIIssuerRevoke      Operation = "pki-issuer.revoke"
	OpPKIIssuerReleaseHold Operation = "pki-issuer.release-hold"
	OpPKIIssuerPublishCRL  Operation = "pki-issuer.publish-crl"
	OpPKIProfileInspect    Operation = "pki-profile.inspect"
	OpPKIProfileCreate     Operation = "pki-profile.create"
	OpPKIProfileUpdate     Operation = "pki-profile.update"
	OpPKIProfileDelete     Operation = "pki-profile.delete"
	OpPKIProfileBind       Operation = "pki-profile.bind"
	OpPKIProfileUnbind     Operation = "pki-profile.unbind"
	OpCertificateIssue     Operation = "certificate.issue"
	OpCertificateRenew     Operation = "certificate.renew"
	OpCertificateRevoke    Operation = "certificate.revoke"
	OpCertificateInspect   Operation = "certificate.inspect"
)

The registered operations. Service code names operations through these constants; the registry below is keyed by them.

type OrgIdentity

type OrgIdentity = authn.OrgIdentity

OrgIdentity re-exports the resolution surface's navigation record so internal/service can name it without importing internal/store/authn, which the boundary test forbids.

type Origin

type Origin = authn.Origin

GrantRow, Origin and GrantLine are re-exported so the service layer never names the resolution-surface package.

type PasswordCredential

type PasswordCredential = authn.PasswordCredential

PasswordCredential is a resolved verifier row with its CAS version.

type PrincipalRef

type PrincipalRef = authn.PrincipalRef

PrincipalRef names a principal awaiting reconciliation.

type PrivacyAccountView

type PrivacyAccountView = authn.PrivacyAccountView

type PrivacyActivity

type PrivacyActivity = authn.PrivacyActivity

type PrivacySession

type PrivacySession = authn.PrivacySession

type Proof

type Proof interface {
	// contains filtered or unexported methods
}

Proof is evidence that authorize() ran, for one operation, inside one still-live transaction. It is an interface with an unexported method, implemented by exactly one unexported type in this package: outside code cannot implement it and cannot construct a non-nil value of it — the only forgeable value is nil, and the store boundary rejects that fail-closed (tenant-isolation ADR § chokepoint pattern). A proof is not a capability token: it dies with its transaction, so it cannot be stored, replayed, or reused across retries.

func SystemAuthority

func SystemAuthority(site SystemSite, tok *TxToken) (Proof, error)

SystemAuthority mints a SystemProof for one of the closed no-principal mint sites (boot, migration, recovery-mode reconciliation, break-glass, scheduler). It is not generic store authority: the proof is operation- and transaction-bound like every other kind, against the site's closed operation set in the system registry — growth of either set fails the build until the tenant-isolation ADR is amended (invariant 11).

type ProviderUpdate

type ProviderUpdate = authn.ProviderUpdate

ProviderUpdate is the provider reconfigure carrier.

type Reachable

type Reachable struct {
	// Current is where read(E) ∧ reveal(E) holds — current plaintext.
	Current map[domain.EnvID]bool
	// Historical is where read(E) ∧ reveal-history(E) holds — superseded
	// plaintext, which may still be live in an external service.
	Historical map[domain.EnvID]bool
}

Reachable is the ADR's reachability computation, and the comment is the point of the function: the two authority classes are computed INDEPENDENTLY and never collapsed into one "can reach plaintext" boolean.

Collapsing them is a named bypass in the ADR, and a subtle one: a service account already holding read(E) ∧ reveal(E) shows an EMPTY delta when granted reveal-history(E), so an actor with no historical access at all could hand a machine principal the power to read superseded secrets. The permission-model ADR fixed the rule this violates — "reveal-history implies nothing about reveal, and vice versa".

func ReachableFrom

func ReachableFrom(scope domain.Scope, envs []domain.EnvID, grants []domain.Grant) Reachable

ReachableFrom evaluates the two classes over a project's environments for one grant set. `grants` is the WHOLE set a principal would hold in the state being tested, so the caller computes a pre-state and a post-state and diffs them per class.

type ReauthWindow

type ReauthWindow = authn.ReauthWindow

ReauthWindow is a resolved reauthentication-window row.

type RecoveryBatch

type RecoveryBatch = authn.RecoveryBatch

RecoveryBatch is a resolved recovery-code batch.

type RegistrationEntry

type RegistrationEntry = authn.RegistrationEntry

RegistrationEntry is one external entry of a policy.

type RegistrationPolicy

type RegistrationPolicy = authn.RegistrationPolicy

RegistrationPolicy is a resolved policy with its child rows.

type RegistrationSignup

type RegistrationSignup = authn.RegistrationSignup

type RegistrationSignupRef

type RegistrationSignupRef = authn.RegistrationSignupRef

RegistrationSignupRef names one pending local sign-up row.

type Registry

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

Registry is the validated, immutable operation registry. newRegistry is the only way to build one, and mustNewRegistry installs it at package init, so a malformed policy table aborts initialization instead of surfacing later as a runtime authorization anomaly. Production lookups read this, never the raw table.

type RegistryFacts

type RegistryFacts struct{}

Registry exposes read-only registry facts to the invariant tests (registry completeness, classification totality, system-site enumeration) without exposing mutation. Production code has no business calling these.

func (RegistryFacts) AuditMappings

func (RegistryFacts) AuditMappings() map[Operation]AuditMapping

AuditMappings returns every registered operation's audit linkage.

func (RegistryFacts) Caches

func (RegistryFacts) Caches() map[string]Cache

Caches returns the cache registry for the invariant test.

func (RegistryFacts) FormulaPins

func (RegistryFacts) FormulaPins() []FormulaPin

FormulaPins returns the whole operation registry in a stable, diffable shape, sorted by operation name.

func (RegistryFacts) Formulas

func (RegistryFacts) Formulas() map[Operation]Formula

Formulas returns each operation's formula; a registered operation with an empty formula fails invariant 6.

func (RegistryFacts) Operations

func (RegistryFacts) Operations() map[Operation]Class

Operations lists every registered operation and its class.

func (RegistryFacts) StoreOps

func (RegistryFacts) StoreOps() map[StoreOp][]Operation

StoreOps returns the union of store operations reachable through the operation registry, keyed by which operations may invoke them.

func (RegistryFacts) SystemSiteEvents

func (RegistryFacts) SystemSiteEvents() map[SystemSite][]audit.EventType

SystemSiteEvents returns the event types each no-principal mint site may emit. Keeping this visible to the audit closure invariant prevents a system event from becoming dead catalogue merely because it has no human operation.

func (RegistryFacts) SystemSites

func (RegistryFacts) SystemSites() map[SystemSite][]StoreOp

SystemSites returns the closed mint-site enumeration and each site's operation set.

func (RegistryFacts) TenantOperations

func (RegistryFacts) TenantOperations() map[Operation]domain.Level

TenantOperations lists each tenant-class operation with the chain depth it addresses, for registry well-formedness checks.

func (RegistryFacts) Wire

func (RegistryFacts) Wire() map[string]Class

Wire returns the wire registry for the invariant tests.

func (RegistryFacts) WireEvents

func (RegistryFacts) WireEvents() map[string][]audit.EventType

WireEvents returns the direct wire→event mapping for the invariant tests.

func (RegistryFacts) WireRoutes

func (RegistryFacts) WireRoutes() map[string][]Operation

WireRoutes returns the route→operation(s) mapping for the invariant tests and the contract cross-check.

type RemotePairedConnection

type RemotePairedConnection = authn.RemotePairedConnection

Re-exported so the service layer never names the resolution-surface package.

type RemotePairingExchange

type RemotePairingExchange = authn.RemotePairingExchange

Re-exported so the service layer never names the resolution-surface package.

type RemotePairingInvite

type RemotePairingInvite = authn.RemotePairingInvite

Re-exported so the service layer never names the resolution-surface package.

type RestoreState

type RestoreState = authn.RestoreState

RestoreState is the instance's restore posture.

type RuleLine

type RuleLine = authn.RuleLine

RuleLine is re-exported for the service layer's rule listing.

type SAMLProvider

type SAMLProvider = authn.SAMLProvider

SAMLProvider is a resolved SAML identity-provider row.

type SAMLProviderUpdate

type SAMLProviderUpdate = authn.SAMLProviderUpdate

SAMLProviderUpdate is the provider compare-and-swap carrier.

type SAMLSPKey

type SAMLSPKey = authn.SAMLSPKey

SAMLSPKey is stored SP signing material.

type SAMLTransaction

type SAMLTransaction = authn.SAMLTransaction

SAMLTransaction is a server-side AuthnRequest transaction.

type SCIMCredential

type SCIMCredential = authn.SCIMCredential

The SCIM provisioning credential as AUTHENTICATION sees it (#73 §7). Its administration lives on the proof-carrying repository instead.

type ServiceAccount

type ServiceAccount = authn.ServiceAccount

Re-exported so the service layer never names the resolution-surface package.

type ServiceAccountCreation

type ServiceAccountCreation = authn.ServiceAccountCreation

Re-exported so the service layer never names the resolution-surface package.

type ServiceAccountDeletion

type ServiceAccountDeletion = authn.ServiceAccountDeletion

Re-exported so the service layer never names the resolution-surface package.

type SessionSummary

type SessionSummary = authn.SessionSummary

The workspace tier's carrier types, re-exported so the service layer never names internal/store/authn — the import-boundary test enforces that the resolution surface is reachable only through this package.

type StoreOp

type StoreOp string

StoreOp names one store method in the trusted query registry. Every store method is registered to the operation(s) it serves (invariant 6); the boundary check consults this registry on every call.

const (
	StoreSelfConfigSeedInputs          StoreOp = "selfconfig.SeedInputs"
	StoreSelfConfigHostSeedInputs      StoreOp = "selfconfig.HostSeedInputs"
	StoreSelfConfigPutSeedInput        StoreOp = "selfconfig.PutSeedInput"
	StoreSelfConfigRecoverTarget       StoreOp = "selfconfig.RecoverTarget"
	StoreSelfConfigBinding             StoreOp = "selfconfig.Binding"
	StoreSelfConfigPreviousRevision    StoreOp = "selfconfig.PreviousRevision"
	StoreSelfConfigRollout             StoreOp = "selfconfig.Rollout"
	StoreSelfConfigPutRollout          StoreOp = "selfconfig.PutRollout"
	StoreSelfConfigNextRolloutSequence StoreOp = "selfconfig.NextRolloutSequence"
	StoreSelfConfigJobs                StoreOp = "selfconfig.Jobs"
	StoreSelfConfigJob                 StoreOp = "selfconfig.Job"
	StoreSelfConfigJobByIdempotencyKey StoreOp = "selfconfig.JobByIdempotencyKey"
	StoreSelfConfigNodes               StoreOp = "selfconfig.Nodes"
	StoreSelfConfigRetained            StoreOp = "selfconfig.Retained"
	StoreSelfConfigCreateBinding       StoreOp = "selfconfig.CreateBinding"
	StoreSelfConfigBeginJob            StoreOp = "selfconfig.BeginJob"
	StoreSelfConfigCommitJob           StoreOp = "selfconfig.CommitJob"
	StoreSelfConfigFinishJob           StoreOp = "selfconfig.FinishJob"
	StoreSelfConfigPutNode             StoreOp = "selfconfig.PutNode"
	StoreSelfConfigFenceRestored       StoreOp = "selfconfig.FenceRestored"
	StoreKeysInsertInitialProjectDEK   StoreOp = "keys.InsertInitialProjectDEK"
	StoreOrgsCreate                    StoreOp = "orgs.Create"
	StoreOrgsGet                       StoreOp = "orgs.Get"
	StoreOrgsList                      StoreOp = "orgs.List"
	StoreOrgsCount                     StoreOp = "orgs.Count"
	StoreOrgsRename                    StoreOp = "orgs.Rename"
	StoreOrgsLock                      StoreOp = "orgs.Lock"
	StoreOrgsSetRetention              StoreOp = "orgs.SetRetention"
	StoreOrgsDelete                    StoreOp = "orgs.Delete"

	StoreProjectsCreate      StoreOp = "projects.Create"
	StoreProjectsGet         StoreOp = "projects.Get"
	StoreProjectsGetCapacity StoreOp = "projects.GetCapacity"
	StoreProjectsSetCapacity StoreOp = "projects.SetCapacity"
	StoreProjectsList        StoreOp = "projects.List"
	// StoreProjectsListAll is the cross-org enumeration the multi-instance
	// directory serves (#71). It belongs to instance-scope operations only.
	StoreProjectsListAll      StoreOp = "projects.ListAll"
	StoreProjectsLock         StoreOp = "projects.Lock"
	StoreProjectsRename       StoreOp = "projects.Rename"
	StoreProjectsSetRetention StoreOp = "projects.SetRetention"
	// StoreProjectsSetDefinitionsSource flips the git/db definitions mode (#70).
	// It rides project-settings authority, off the definitions-edit path.
	StoreProjectsSetDefinitionsSource StoreOp = "projects.SetDefinitionsSource"
	// StoreProjectsSetMachineReveal flips the per-project machine-reveal
	// opt-in (source-of-truth ADR), a project-settings write.
	StoreProjectsSetMachineReveal StoreOp = "projects.SetMachineReveal"
	StoreProjectsDelete           StoreOp = "projects.Delete"

	// The definitions plan ledger (#70). CreatePlan/MarkPlanApplied/PruneExpired
	// mutate; GetPlan/CountOpenPlans/LatestAppliedPlan read.
	StoreDefinitionsPlanCreate        StoreOp = "definitions.CreatePlan"
	StoreDefinitionsPlanGet           StoreOp = "definitions.GetPlan"
	StoreDefinitionsPlanCountOpen     StoreOp = "definitions.CountOpenPlans"
	StoreDefinitionsPlanApply         StoreOp = "definitions.MarkPlanApplied"
	StoreDefinitionsPlanPrune         StoreOp = "definitions.PruneExpiredPlans"
	StoreDefinitionsLatestAppliedPlan StoreOp = "definitions.LatestAppliedPlan"

	StoreEnvironmentParametersGet StoreOp = "environments.Parameters"
	StoreEnvironmentParametersSet StoreOp = "environments.SetParameters"
	StoreEnvironmentsCreate       StoreOp = "environments.Create"
	StoreEnvironmentsGet          StoreOp = "environments.Get"
	StoreEnvironmentsList         StoreOp = "environments.List"
	// StoreEnvironmentsListPage is the MCP-bounded keyset environment read (#629).
	StoreEnvironmentsListPage   StoreOp = "environments.ListPage"
	StoreEnvironmentsCount      StoreOp = "environments.Count"
	StoreEnvironmentsNextOrder  StoreOp = "environments.NextOrder"
	StoreEnvironmentsUpdateNote StoreOp = "environments.UpdateNote"
	StoreEnvironmentsRename     StoreOp = "environments.Rename"
	StoreEnvironmentsSetOrder   StoreOp = "environments.SetOrder"
	StoreEnvironmentsDelete     StoreOp = "environments.Delete"
	// The protected flag and per-environment window (#55).
	StoreEnvironmentsGetSettings StoreOp = "environments.Settings"
	StoreEnvironmentsSetSettings StoreOp = "environments.SetSettings"
	// StoreEnvironmentsListProtection is the project-scoped protected-flag read
	// behind the definitions plan/apply protected-set pin (#70).
	StoreEnvironmentsListProtection StoreOp = "environments.ListProtection"

	// The key catalogue (#49). Named `catalogue.*` and not `keys.*`: that
	// prefix is the KEYRING's (#43, wrapped crypto material), and two unrelated
	// senses of "key" sharing an operation prefix is how a proof minted for one
	// would look admissible for the other.
	StoreCatalogueCreate StoreOp = "catalogue.Create"
	StoreCatalogueGet    StoreOp = "catalogue.Get"
	StoreCatalogueList   StoreOp = "catalogue.List"
	// The MCP-bounded catalogue reads (#629): a keyset key page, a single key
	// resolved under the list authorization, and one key's presence rows.
	StoreCatalogueListPage          StoreOp = "catalogue.ListPage"
	StoreCatalogueGetInProject      StoreOp = "catalogue.GetInProject"
	StoreCataloguePresenceForKey    StoreOp = "catalogue.PresenceForKey"
	StoreCatalogueCount             StoreOp = "catalogue.Count"
	StoreCatalogueAdapterPins       StoreOp = "catalogue.AdapterPins"
	StoreCatalogueRename            StoreOp = "catalogue.Rename"
	StoreCatalogueUpdateMetadata    StoreOp = "catalogue.UpdateMetadata"
	StoreCatalogueUpdateDeclaration StoreOp = "catalogue.UpdateDeclaration"
	StoreCatalogueSetClassification StoreOp = "catalogue.SetClassification"
	StoreCatalogueSetGroup          StoreOp = "catalogue.SetGroup"
	StoreCatalogueDelete            StoreOp = "catalogue.Delete"
	StoreCatalogueGroupCreate       StoreOp = "catalogue.CreateGroup"
	StoreCatalogueGroupGet          StoreOp = "catalogue.GetGroup"
	StoreCatalogueGroupList         StoreOp = "catalogue.ListGroups"
	StoreCatalogueGroupCount        StoreOp = "catalogue.CountGroups"
	StoreCatalogueGroupRename       StoreOp = "catalogue.RenameGroup"
	StoreCatalogueGroupDelete       StoreOp = "catalogue.DeleteGroup"
	StoreCatalogueGroupClearMembers StoreOp = "catalogue.ClearGroupMembers"
	StoreCataloguePresenceList      StoreOp = "catalogue.ListPresence"
	StoreCataloguePresenceReplace   StoreOp = "catalogue.ReplacePresence"
	StoreCataloguePresenceCascade   StoreOp = "catalogue.DeletePresenceForEnvironment"
	StoreCatalogueRevisionGet       StoreOp = "catalogue.SchemaRevision"

	StoreAdaptersTarget                 StoreOp = "adapters.Target"
	StoreAdaptersGet                    StoreOp = "adapters.Get"
	StoreAdaptersConfiguration          StoreOp = "adapters.Configuration"
	StoreAdaptersConfigurationForUpdate StoreOp = "adapters.ConfigurationForUpdate"
	StoreAdaptersList                   StoreOp = "adapters.List"
	StoreAdaptersListTargets            StoreOp = "adapters.ListTargets"
	StoreAdaptersTargetKeyIDs           StoreOp = "adapters.TargetKeyIDs"
	StoreAdaptersCreate                 StoreOp = "adapters.Create"
	StoreAdaptersAddTarget              StoreOp = "adapters.AddTarget"
	StoreAdaptersRecordCredentialExpiry StoreOp = "adapters.RecordCredentialExpiry"
	StoreAdaptersBeginConfigureEffect   StoreOp = "adapters.BeginConfigureEffect"
	StoreAdaptersFinishConfigureEffect  StoreOp = "adapters.FinishConfigureEffect"
	StoreAdaptersUpdateTarget           StoreOp = "adapters.UpdateTarget"
	StoreAdaptersMoveTarget             StoreOp = "adapters.MoveTarget"
	StoreAdaptersMoveOrigin             StoreOp = "adapters.MoveOrigin"
	StoreAdaptersMove                   StoreOp = "adapters.Move"
	// Reencrypt walk over the two adapter credential columns.
	StoreAdaptersListForReencrypt      StoreOp = "adapters.ListAdaptersForReencrypt"
	StoreAdaptersReencrypt             StoreOp = "adapters.ReencryptAdapter"
	StoreAdaptersListMovesForReencrypt StoreOp = "adapters.ListRouteMovesForReencrypt"
	StoreAdaptersReencryptMove         StoreOp = "adapters.ReencryptRouteMove"
	StoreAdaptersCancelMove            StoreOp = "adapters.CancelMove"
	StoreAdaptersReplaceMoveTarget     StoreOp = "adapters.ReplaceMoveTarget"
	StoreAdaptersReplaceMoveOrigin     StoreOp = "adapters.ReplaceMoveOrigin"
	StoreAdaptersMapping               StoreOp = "adapters.Mapping"
	StoreAdaptersPlanMaterial          StoreOp = "adapters.PlanMaterial"
	StoreAdaptersTargetEnvironments    StoreOp = "adapters.TargetEnvironments"
	StoreAdaptersEnvironments          StoreOp = "adapters.Environments"
	StoreAdaptersConflicts             StoreOp = "adapters.Conflicts"
	StoreAdaptersRecordPlan            StoreOp = "adapters.RecordPlan"
	StoreAdaptersAdopt                 StoreOp = "adapters.Adopt"
	StoreAdaptersEnqueuePublished      StoreOp = "adapters.EnqueuePublished"
	StoreAdaptersTeardownTarget        StoreOp = "adapters.TeardownTarget"
	StoreAdaptersTeardownAdapter       StoreOp = "adapters.TeardownAdapter"
	StoreAdaptersReplaceCredential     StoreOp = "adapters.ReplaceCredential"
	StoreAdaptersRevokeCredential      StoreOp = "adapters.RevokeCredential"
	StoreAdaptersEnqueueManual         StoreOp = "adapters.EnqueueManual"
	StoreAdaptersTargetKeys            StoreOp = "adapters.TargetKeys"
	StoreAdaptersPauseTarget           StoreOp = "adapters.PauseTarget"
	StoreAdaptersResumeTarget          StoreOp = "adapters.ResumeTarget"
	StoreAdaptersHealthCounts          StoreOp = "adapters.HealthCounts"
	StoreCatalogueRevisionBump         StoreOp = "catalogue.BumpSchemaRevision"

	// Dynamic secrets (#147). Request-path (proof-carrying) store methods; the
	// worker's lease-transition SQL runs through the proof-free DynamicRuntime
	// (the domain-specific outbox pattern, like AdapterRuntime).
	StoreDynamicProvidersCreate               StoreOp = "dynamic.CreateProvider"
	StoreDynamicProvidersGet                  StoreOp = "dynamic.GetProvider"
	StoreDynamicProvidersCredentialCiphertext StoreOp = "dynamic.ProviderCredentialCiphertext"
	StoreDynamicProvidersList                 StoreOp = "dynamic.ListProviders"
	StoreDynamicProvidersReplaceCredential    StoreOp = "dynamic.ReplaceProviderCredential"
	StoreDynamicProvidersRevokeCredential     StoreOp = "dynamic.RevokeProviderCredential"
	StoreDynamicProvidersDelete               StoreOp = "dynamic.DeleteProvider"
	StoreDynamicProvidersListForReencrypt     StoreOp = "dynamic.ListProvidersForReencrypt"
	StoreDynamicProvidersReencrypt            StoreOp = "dynamic.ReencryptProvider"
	StoreDynamicLeasesActiveIDsForProvider    StoreOp = "dynamic.ActiveLeaseIDsForProvider"
	StoreDynamicLeasesCreate                  StoreOp = "dynamic.CreateLease"
	StoreDynamicLeasesGet                     StoreOp = "dynamic.GetLease"
	StoreDynamicLeasesList                    StoreOp = "dynamic.ListLeasesForEnvironment"
	StoreDynamicLeasesFinishMint              StoreOp = "dynamic.FinishMint"
	StoreDynamicLeasesEnqueueTransition       StoreOp = "dynamic.EnqueueTransition"

	// SSH user certificates (#155). Proof-carrying, environment-bound; the
	// sweeper's revocation SQL runs through the proof-free SSHRuntime.
	StoreSSHCreateCA                  StoreOp = "ssh.CreateCA"
	StoreSSHInsertCAKey               StoreOp = "ssh.InsertCAKey"
	StoreSSHGetCA                     StoreOp = "ssh.GetCA"
	StoreSSHListCAs                   StoreOp = "ssh.ListCAs"
	StoreSSHActiveCAKey               StoreOp = "ssh.ActiveCAKey"
	StoreSSHRetireActiveCAKey         StoreOp = "ssh.RetireActiveCAKey"
	StoreSSHRetireCAKey               StoreOp = "ssh.RetireCAKey"
	StoreSSHDeleteCA                  StoreOp = "ssh.DeleteCA"
	StoreSSHCountLiveProfilesForCA    StoreOp = "ssh.CountLiveProfilesForCA"
	StoreSSHActiveKeyLastExpiry       StoreOp = "ssh.ActiveKeyLastExpiry"
	StoreSSHGetProfile                StoreOp = "ssh.GetProfile"
	StoreSSHListProfiles              StoreOp = "ssh.ListProfiles"
	StoreSSHCreateProfile             StoreOp = "ssh.CreateProfile"
	StoreSSHUpdateProfile             StoreOp = "ssh.UpdateProfile"
	StoreSSHDeleteProfile             StoreOp = "ssh.DeleteProfile"
	StoreSSHIsRequester               StoreOp = "ssh.IsRequester"
	StoreSSHInsertCertificate         StoreOp = "ssh.InsertCertificate"
	StoreSSHGetCertificate            StoreOp = "ssh.GetCertificate"
	StoreSSHListCertificates          StoreOp = "ssh.ListCertificates"
	StoreSSHRevokeCertificate         StoreOp = "ssh.RevokeCertificate"
	StoreSSHRevokeProfileCertificates StoreOp = "ssh.RevokeProfileCertificates"
	StoreSSHRevokedSerials            StoreOp = "ssh.RevokedSerials"
	StoreSSHListCAKeysForReencrypt    StoreOp = "ssh.ListCAKeysForReencrypt"
	StoreSSHReencryptCAKey            StoreOp = "ssh.ReencryptCAKey"
	StoreSSHPurgeEnvironment          StoreOp = "ssh.PurgeEnvironment"
	// Transit (#156, transit ADR). Request-path, proof-carrying store methods;
	// the scheduler reaches the rotation and purge doors under scoped system
	// authority.
	StoreTransitKeysList                 StoreOp = "transit.ListKeys"
	StoreTransitKeysGet                  StoreOp = "transit.GetKey"
	StoreTransitKeysGetForUse            StoreOp = "transit.GetKeyForUse"
	StoreTransitKeysCount                StoreOp = "transit.CountKeys"
	StoreTransitKeysCreate               StoreOp = "transit.CreateKey"
	StoreTransitKeysConfigure            StoreOp = "transit.Configure"
	StoreTransitKeysChangeState          StoreOp = "transit.ChangeState"
	StoreTransitKeysCompromise           StoreOp = "transit.Compromise"
	StoreTransitVersionsList             StoreOp = "transit.ListVersions"
	StoreTransitVersionMaterial          StoreOp = "transit.VersionMaterial"
	StoreTransitVersionsAppend           StoreOp = "transit.AppendVersion"
	StoreTransitVersionsTrim             StoreOp = "transit.Trim"
	StoreTransitVersionsFenceTrim        StoreOp = "transit.FenceTrim"
	StoreTransitVersionsListForReencrypt StoreOp = "transit.ListVersionsForReencrypt"
	StoreTransitVersionsReencrypt        StoreOp = "transit.ReencryptVersion"
	StoreTransitCallersList              StoreOp = "transit.ListCallers"
	StoreTransitSelectDeletionDue        StoreOp = "transit.SelectDeletionDue"
	StoreTransitSelectRotationDue        StoreOp = "transit.SelectRotationDue"
	StoreTransitDestroyVersions          StoreOp = "transit.DestroyVersions"
	StoreTransitDestroy                  StoreOp = "transit.Destroy"

	// Private PKI (#154). Request-path store methods; the worker's expiry,
	// unknown and CRL sweeps run through the proof-free PKIRuntime.
	StorePKIIssuersList                 StoreOp = "pki.ListIssuers"
	StorePKIIssuersGet                  StoreOp = "pki.GetIssuer"
	StorePKIIssuersKey                  StoreOp = "pki.IssuerKey"
	StorePKIIssuersCreate               StoreOp = "pki.CreateIssuer"
	StorePKIIssuersInstall              StoreOp = "pki.InstallIssuerCertificate"
	StorePKIIssuersTransition           StoreOp = "pki.TransitionIssuer"
	StorePKIIssuersDestroyKey           StoreOp = "pki.DestroyIssuerKey"
	StorePKIIssuersHold                 StoreOp = "pki.SetIssuerHold"
	StorePKIIssuersPublishCRL           StoreOp = "pki.PublishCRL"
	StorePKIIssuersPublic               StoreOp = "pki.IssuerPublic"
	StorePKIIssuersActivePublic         StoreOp = "pki.ActiveIssuerPublic"
	StorePKIIssuersSigning              StoreOp = "pki.IssuerForSigning"
	StorePKIIssuersFence                StoreOp = "pki.FenceIssuance"
	StorePKIProfilesList                StoreOp = "pki.ListProfiles"
	StorePKIProfilesGet                 StoreOp = "pki.GetProfile"
	StorePKIProfilesCreate              StoreOp = "pki.CreateProfile"
	StorePKIProfilesUpdate              StoreOp = "pki.UpdateProfile"
	StorePKIProfilesDelete              StoreOp = "pki.DeleteProfile"
	StorePKIProfilesBound               StoreOp = "pki.BoundProfile"
	StorePKIProfilesBoundList           StoreOp = "pki.BoundProfiles"
	StorePKIBindingsList                StoreOp = "pki.ListBindings"
	StorePKIBindingsCreate              StoreOp = "pki.CreateBinding"
	StorePKIBindingsDelete              StoreOp = "pki.DeleteBinding"
	StorePKICertificatesGet             StoreOp = "pki.GetCertificate"
	StorePKICertificatesList            StoreOp = "pki.ListCertificates"
	StorePKICertificatesCreate          StoreOp = "pki.CreateCertificate"
	StorePKICertificatesFinish          StoreOp = "pki.FinishCertificate"
	StorePKICertificatesFail            StoreOp = "pki.FailCertificate"
	StorePKICertificatesClaimRenewal    StoreOp = "pki.ClaimRenewal"
	StorePKICertificatesCompleteRenewal StoreOp = "pki.CompleteRenewal"
	StorePKICertificatesReleaseRenewal  StoreOp = "pki.ReleaseRenewal"
	StorePKICertificatesRevoke          StoreOp = "pki.RevokeCertificate"
	StorePKICertificatesCountLive       StoreOp = "pki.CountLiveCertificates"
	StorePKICertificatesRevokeLive      StoreOp = "pki.RevokeLiveCertificates"
	StorePKICertificatesRevokedEntries  StoreOp = "pki.RevokedEntries"

	StoreFoldersCreate StoreOp = "folders.Create"
	StoreFoldersGet    StoreOp = "folders.Get"
	StoreFoldersList   StoreOp = "folders.List"
	StoreFoldersRename StoreOp = "folders.Rename"
	StoreFoldersDelete StoreOp = "folders.Delete"

	// The flat value model (#50). `values.*` rather than `value.*` to match
	// the CLI noun and to keep the prefix distinct from `catalogue.*` (the
	// key DECLARATIONS) and `keys.*` (the KEYRING, #43) — three neighbouring
	// senses of "key" that must never share a store-op prefix.
	StoreValuesGet                   StoreOp = "values.Get"
	StoreValuesList                  StoreOp = "values.List"
	StoreValuesEnvironmentsWithValue StoreOp = "values.EnvironmentsWithValue"
	StoreValuesPut                   StoreOp = "values.Put"
	// The reencrypt walk's project-wide page + in-place re-seal of value rows.
	StoreValuesListForReencrypt StoreOp = "values.ListForReencrypt"
	StoreValuesReencrypt        StoreOp = "values.Reencrypt"
	StoreValuesClear            StoreOp = "values.Clear"
	StoreValuesClearEnvironment StoreOp = "values.ClearEnvironment"
	// StoreValuesCountEnvironment is the project-scoped live-occurrence count
	// behind the definitions-apply environment-delete refusal (#70).
	StoreValuesCountEnvironment StoreOp = "values.CountEnvironmentValues"
	// StoreValuesClearKey clears a key's occurrences project-wide when
	// definitions apply deletes the key with --allow-delete (#70).
	StoreValuesClearKey StoreOp = "values.ClearKey"

	// Drafts and published revisions (#51). `pending.*` is the per-user
	// working state; `snapshots.*` is the published state, its lineage and
	// its payload — one aggregate because a revision, its resolved map and
	// its changed-key rows are written in one act and must never drift.
	StorePendingListForOwner              StoreOp = "pending.ListForOwner"
	StorePendingListForOwnerInEnvironment StoreOp = "pending.ListForOwnerInEnvironment"
	// StorePendingListForOwnerInEnvironmentPage is the MCP-bounded keyset draft
	// read (#629).
	StorePendingListForOwnerInEnvironmentPage StoreOp = "pending.ListForOwnerInEnvironmentPage"
	StorePendingListMarkers                   StoreOp = "pending.ListMarkers"
	StorePendingStage                         StoreOp = "pending.Stage"
	StorePendingListForReencrypt              StoreOp = "pending.ListForReencrypt"
	StorePendingReencrypt                     StoreOp = "pending.Reencrypt"
	StorePendingDiscard                       StoreOp = "pending.Discard"
	StorePendingDiscardEnvironment            StoreOp = "pending.DiscardEnvironment"
	StorePendingDiscardKey                    StoreOp = "pending.DiscardKey"
	// StorePendingCountForProjectExcludingCell is the per-project pending-cap
	// read taken during a stage: the project's pending total, less the cell
	// being staged (ops-spec §8, ≤100 pending versions per project).
	StorePendingCountForProjectExcludingCell StoreOp = "pending.CountForProjectExcludingCell"

	StoreSnapshotsLatest            StoreOp = "snapshots.Latest"
	StoreSnapshotsParameterContract StoreOp = "snapshots.ParameterContract"
	// StoreSnapshotsProjectRevisions is the project-scoped per-environment latest
	// revision behind the definitions plan/apply value-snapshot pin (#70).
	StoreSnapshotsProjectRevisions StoreOp = "snapshots.ProjectRevisions"
	StoreSnapshotsAtRevision       StoreOp = "snapshots.AtRevision"
	// StoreSnapshotsList is the whole-environment header read behind the pin
	// retention consequence; history surfaces page through ListPage instead.
	StoreSnapshotsList StoreOp = "snapshots.List"
	// StoreSnapshotsListPage is the bounded keyset revision-history read (#629):
	// the API, CLI and MCP history surfaces all page through it.
	StoreSnapshotsListPage         StoreOp = "snapshots.ListPage"
	StoreSnapshotsEntries          StoreOp = "snapshots.Entries"
	StoreSnapshotsListForReencrypt StoreOp = "snapshots.ListForReencrypt"
	StoreSnapshotsReencrypt        StoreOp = "snapshots.Reencrypt"
	StoreSnapshotsChanges          StoreOp = "snapshots.Changes"
	// StoreSnapshotsChangesInRange is the history page's lineage read: the
	// change rows of every revision on one page in one statement.
	StoreSnapshotsChangesInRange StoreOp = "snapshots.ChangesInRange"
	StoreSnapshotsInsert         StoreOp = "snapshots.Insert"
	StoreSnapshotsInsertEntry    StoreOp = "snapshots.InsertEntry"
	// StoreSnapshotsSecretValueOccurrenceIDsIn is the point membership read of
	// the sticky sensitivity lineage for a handful of named value entries.
	StoreSnapshotsSecretValueOccurrenceIDsIn  StoreOp = "snapshots.SecretValueOccurrenceIDsIn"
	StoreSnapshotsRecordSecretValueOccurrence StoreOp = "snapshots.RecordSecretValueOccurrence"
	StoreSnapshotsInsertChange                StoreOp = "snapshots.InsertChange"
	StoreSnapshotsDeleteEnvironment           StoreOp = "snapshots.DeleteEnvironment"

	StorePinsGetForWorkload    StoreOp = "pins.GetForWorkload"
	StorePinsList              StoreOp = "pins.List"
	StorePinsCountProject      StoreOp = "pins.CountProject"
	StorePinsInsert            StoreOp = "pins.Insert"
	StorePinsDelete            StoreOp = "pins.Delete"
	StorePinsDeleteEnvironment StoreOp = "pins.DeleteEnvironment"

	StoreDeliveryTargetsGet            StoreOp = "deliverytargets.Get"
	StoreDeliveryTargetsList           StoreOp = "deliverytargets.List"
	StoreDeliveryTargetsQuotaNotices   StoreOp = "deliverytargets.QuotaNotices"
	StoreDeliveryTargetsLastFetch      StoreOp = "deliverytargets.LastFetchAt"
	StoreDeliveryTargetsCountPrincipal StoreOp = "deliverytargets.CountForPrincipal"
	StoreDeliveryTargetsInsert         StoreOp = "deliverytargets.Insert"
	StoreDeliveryTargetsUpdate         StoreOp = "deliverytargets.Update"
	StoreDeliveryTargetsRecordRefusal  StoreOp = "deliverytargets.RecordRefusal"
	StoreDeliveryTargetsDelete         StoreOp = "deliverytargets.Delete"
	StoreDeliveryTargetsRecordQuota    StoreOp = "deliverytargets.RecordQuotaRefusal"
	// The hourly 30-day purge (ADR D6): scheduler authority only.
	StoreDeliveryTargetsSelectExpired StoreOp = "deliverytargets.SelectExpired"
	StoreDeliveryTargetsPurge         StoreOp = "deliverytargets.Purge"

	StoreFileTargetsList           StoreOp = "filetargets.List"
	StoreFileTargetsGet            StoreOp = "filetargets.Get"
	StoreFileTargetsKeys           StoreOp = "filetargets.Keys"
	StoreFileTargetsKeysForTargets StoreOp = "filetargets.KeysForTargets"
	StoreFileTargetsForPrincipal   StoreOp = "filetargets.ForPrincipal"
	StoreFileTargetsCreate         StoreOp = "filetargets.Create"
	StoreFileTargetsReplaceKeys    StoreOp = "filetargets.ReplaceKeys"
	StoreFileTargetsDelete         StoreOp = "filetargets.Delete"
	StoreFileTargetsRecordReport   StoreOp = "filetargets.RecordReport"

	StoreRetentionAuditPolicy    StoreOp = "retention.AuditPolicy"
	StoreRetentionSetAuditPolicy StoreOp = "retention.SetAuditPolicy"
	StoreRetentionPruneAudit     StoreOp = "retention.PruneAudit"
	StoreRetentionEligible       StoreOp = "retention.Eligible"
	StoreRetentionSnapshotLock   StoreOp = "retention.LockSnapshot"
	StoreRetentionMarkCollected  StoreOp = "retention.MarkCollected"
	StoreRetentionDeleteEntries  StoreOp = "retention.DeleteCollectedEntries"
	StoreRetentionLastSuccess    StoreOp = "retention.LastPruneSuccess"
	StoreRetentionSetLastSuccess StoreOp = "retention.SetLastPruneSuccess"
	StoreOpsDiagnosticsRead      StoreOp = "retention.Diagnostics"
	StoreEscrowVerificationWrite StoreOp = "retention.RecordEscrow"
	StoreReencryptSuccessWrite   StoreOp = "retention.RecordReencryptSuccess"

	// Disaster-recovery health row (#145, ops-spec section 11). Instance
	// operational state, no tenant chain: the scheduler's export and prune
	// jobs write it, the restore drill writes its verdict, and the audited
	// health read plus the /metrics scrape read it.
	StoreBackupStateGet              StoreOp = "backupstate.Get"
	StoreBackupStateSetExportSuccess StoreOp = "backupstate.SetExportSuccess"
	StoreBackupStateSetExportFailure StoreOp = "backupstate.SetExportFailure"
	StoreBackupStateSetPruneResult   StoreOp = "backupstate.SetPruneResult"
	StoreBackupStateSetDrill         StoreOp = "backupstate.SetDrill"
	// The restore drill's decrypt proof reads ONE stored secret cell,
	// ciphertext only, across the instance (#145). Opening it needs the
	// keyring the drill is handed separately; the read alone discloses nothing.
	StoreValuesSampleSecretEntry StoreOp = "values.SampleSecretEntry"

	// Per-project storage high-water (#185, ops-spec section 8 / section 141).
	// The two project-scoped byte sums are read at publish to refuse a project
	// already at the 4 GiB high-water; the two instance-scoped by-project sums
	// back the operator storage surface (doctor warn at 1 GiB, metric).
	StoreValuesPayloadBytesForProject      StoreOp = "values.PayloadBytesForProject"
	StoreSnapshotsPayloadBytesForProject   StoreOp = "snapshots.PayloadBytesForProject"
	StoreValuesInstancePayloadByProject    StoreOp = "values.InstancePayloadByProject"
	StoreSnapshotsInstancePayloadByProject StoreOp = "snapshots.InstancePayloadByProject"

	// Keyring persistence (#43). These carry no tenant chain: wrapped-key
	// rows are instance-scoped crypto material, and the scope a tier-3 key
	// belongs to is part of its AAD, not a tenant predicate.
	StoreKeysActiveMasterWrappers     StoreOp = "keys.ActiveMasterWrappers"
	StoreKeysActiveTier3              StoreOp = "keys.ActiveTier3"
	StoreKeysActiveTokenKeyForReceipt StoreOp = "keys.ActiveTokenKeyForReceipt"
	StoreKeysTier3Versions            StoreOp = "keys.Tier3Versions"
	StoreKeysAllOpenableTier3         StoreOp = "keys.AllOpenableTier3"
	// StoreKeysAssertActiveDEKVersion is the writer fence, invoked inside every
	// ciphertext-writing operation's transaction — a read (+ FOR SHARE lock on
	// postgres) of the sealed DEK version's state. It is in the store sets of the
	// operations that write ciphertext, not the boot set.
	StoreKeysAssertActiveDEKVersion     StoreOp = "keys.AssertActiveDEKVersion"
	StoreKeysAcquireHierarchyGeneration StoreOp = "keys.AcquireHierarchyGeneration"
	StoreKeysInsertMaster               StoreOp = "keys.InsertMaster"
	StoreKeysInsertTier3                StoreOp = "keys.InsertTier3"
	StoreKeysRotateTokenKey             StoreOp = "keys.RotateTokenKey"
	StoreKeysRotateScanningKey          StoreOp = "keys.RotateScanningKey"
	StoreKeysRotateDEK                  StoreOp = "keys.RotateDEK"
	StoreKeysRotateMasterKey            StoreOp = "keys.RotateMasterKey"
	StoreKeysRetireRetiringTier3        StoreOp = "keys.RetireRetiringTier3"

	// The instance-credential reencrypt surface (#75/#187), one ReencryptRepo.
	StoreReencryptListPasswordCreds        StoreOp = "reencrypt.ListPasswordCredsForReencrypt"
	StoreReencryptPasswordCred             StoreOp = "reencrypt.ReencryptPasswordCred"
	StoreReencryptListTotpCreds            StoreOp = "reencrypt.ListTotpCredsForReencrypt"
	StoreReencryptTotpCred                 StoreOp = "reencrypt.ReencryptTotpCred"
	StoreReencryptListRecoveryCodes        StoreOp = "reencrypt.ListRecoveryCodesForReencrypt"
	StoreReencryptRecoveryCodes            StoreOp = "reencrypt.ReencryptRecoveryCodes"
	StoreReencryptListOidcProviders        StoreOp = "reencrypt.ListOidcProvidersForReencrypt"
	StoreReencryptOidcProvider             StoreOp = "reencrypt.ReencryptOidcProvider"
	StoreReencryptListOauth2Providers      StoreOp = "reencrypt.ListOauth2ProvidersForReencrypt"
	StoreReencryptOauth2Provider           StoreOp = "reencrypt.ReencryptOauth2Provider"
	StoreReencryptListSelfConfigSeedInputs StoreOp = "reencrypt.ListSelfConfigSeedInputsForReencrypt"
	StoreReencryptSelfConfigSeedInput      StoreOp = "reencrypt.ReencryptSelfConfigSeedInput"
	StoreReencryptListSamlKeys             StoreOp = "reencrypt.ListSamlKeysForReencrypt"
	StoreReencryptSamlKey                  StoreOp = "reencrypt.ReencryptSamlKey"
	StoreReencryptListPairingInvites       StoreOp = "reencrypt.ListPairingInvitesForReencrypt"
	StoreReencryptPairingInvites           StoreOp = "reencrypt.ReencryptPairingInvites"
	StoreReencryptListPairingExchanges     StoreOp = "reencrypt.ListPairingExchangesForReencrypt"
	StoreReencryptPairingExchanges         StoreOp = "reencrypt.ReencryptPairingExchanges"
	StoreReencryptListRemotes              StoreOp = "reencrypt.ListRemotesForReencrypt"
	StoreReencryptRemote                   StoreOp = "reencrypt.ReencryptRemote"
	StoreReencryptListPkiIssuers           StoreOp = "reencrypt.ListPkiIssuersForReencrypt"
	StoreReencryptPkiIssuer                StoreOp = "reencrypt.ReencryptPkiIssuer"
	StoreKeysAssertRootKeyEpoch            StoreOp = "keys.AssertRootKeyEpoch"
	StoreKeysRootRotatePrepare             StoreOp = "keys.RootKeyRotatePrepare"
	StoreKeysRootRotateFinalize            StoreOp = "keys.RootKeyRotateFinalize"
	StoreKeysInsertScopeGeneration         StoreOp = "keys.InsertScopeGeneration"

	// Secret-scanning dismissal rows (#74, secret-scanning ADR section 4). The
	// "keep as config" sticky-dismissal surface. Insert/Exists ride the
	// environment-scoped config-value write; DeleteByKey rides key deletion and
	// reclassification-to-secret; DeleteByProject rides project deletion;
	// DeleteAll rides `rotate-scanning-key` (instance-scoped, cross-tenant).
	StoreScanningDismissalsInsert          StoreOp = "scanningdismissals.Insert"
	StoreScanningDismissalsExists          StoreOp = "scanningdismissals.Exists"
	StoreScanningDismissalsDeleteByKey     StoreOp = "scanningdismissals.DeleteByKey"
	StoreScanningDismissalsDeleteByProject StoreOp = "scanningdismissals.DeleteByProject"
	StoreScanningDismissalsDeleteAll       StoreOp = "scanningdismissals.DeleteAll"

	// Secret-change approvals (#151). The policy-bound review-and-merge engine's
	// store doors. Policy CRUD and its child approver/bypasser sets are
	// project-scoped; requests and votes are environment-scoped. The two
	// expiry-sweep doors are cross-tenant and ride scheduler authority.
	StoreApprovalPolicyInsert        StoreOp = "approvals.InsertPolicy"
	StoreApprovalPolicyGet           StoreOp = "approvals.GetPolicy"
	StoreApprovalPolicyCovering      StoreOp = "approvals.CoveringPolicy"
	StoreApprovalPolicyList          StoreOp = "approvals.ListPolicies"
	StoreApprovalPolicyUpdate        StoreOp = "approvals.UpdatePolicy"
	StoreApprovalPolicyDelete        StoreOp = "approvals.DeletePolicy"
	StoreApprovalApproverInsert      StoreOp = "approvals.InsertApprover"
	StoreApprovalApproverList        StoreOp = "approvals.ListApprovers"
	StoreApprovalApproverClear       StoreOp = "approvals.ClearApprovers"
	StoreApprovalBypasserInsert      StoreOp = "approvals.InsertBypasser"
	StoreApprovalBypasserList        StoreOp = "approvals.ListBypassers"
	StoreApprovalBypasserClear       StoreOp = "approvals.ClearBypassers"
	StoreApprovalBypasserGet         StoreOp = "approvals.IsBypasser"
	StoreApprovalRequestInsert       StoreOp = "approvals.InsertRequest"
	StoreApprovalRequestGet          StoreOp = "approvals.GetRequest"
	StoreApprovalRequestList         StoreOp = "approvals.ListRequests"
	StoreApprovalRequestUpdateState  StoreOp = "approvals.UpdateRequestState"
	StoreApprovalRequestSelectExpiry StoreOp = "approvals.SelectExpired"
	StoreApprovalRequestMarkExpired  StoreOp = "approvals.MarkExpired"
	StoreApprovalRequestCounts       StoreOp = "approvals.OperationalCounts"
	StoreApprovalVoteInsert          StoreOp = "approvals.InsertVote"
	StoreApprovalVoteGet             StoreOp = "approvals.GetVote"
	StoreApprovalVoteList            StoreOp = "approvals.ListVotes"

	// Approval-mediated temporary access (#152). Policy CRUD and its child
	// sets are project-scoped; requests and votes are environment-scoped. The
	// sweep and metric doors are cross-tenant and ride scheduler authority. The
	// time-bound grant rows are NOT here: they are on the resolution surface.
	StoreAccessPolicyInsert       StoreOp = "access.InsertPolicy"
	StoreAccessPolicyGet          StoreOp = "access.GetPolicy"
	StoreAccessPolicyCovering     StoreOp = "access.CoveringPolicy"
	StoreAccessPolicyList         StoreOp = "access.ListPolicies"
	StoreAccessPolicyUpdate       StoreOp = "access.UpdatePolicy"
	StoreAccessPolicyDelete       StoreOp = "access.DeletePolicy"
	StoreAccessApproverInsert     StoreOp = "access.InsertApprover"
	StoreAccessApproverList       StoreOp = "access.ListApprovers"
	StoreAccessApproverClear      StoreOp = "access.ClearApprovers"
	StoreAccessBypasserInsert     StoreOp = "access.InsertBypasser"
	StoreAccessBypasserList       StoreOp = "access.ListBypassers"
	StoreAccessBypasserClear      StoreOp = "access.ClearBypassers"
	StoreAccessBypasserGet        StoreOp = "access.IsBypasser"
	StoreAccessRequestInsert      StoreOp = "access.InsertRequest"
	StoreAccessRequestGet         StoreOp = "access.GetRequest"
	StoreAccessRequestList        StoreOp = "access.ListRequests"
	StoreAccessRequestGrant       StoreOp = "access.GrantRequest"
	StoreAccessRequestResolve     StoreOp = "access.ResolveRequest"
	StoreAccessRequestSelectDue   StoreOp = "access.SelectDue"
	StoreAccessRequestMarkExpired StoreOp = "access.MarkExpired"
	StoreAccessRequestCounts      StoreOp = "access.OperationalCounts"
	StoreAccessVoteInsert         StoreOp = "access.InsertVote"
	StoreAccessVoteGet            StoreOp = "access.GetVote"
	StoreAccessVoteList           StoreOp = "access.ListVotes"

	// Audit trails (#45). INSERT and SELECT only — the append-only invariant
	// lives at the query layer; these are the only store doors to it. The
	// denial writer does NOT pass through these: it is the authorization
	// package's own enumerated write path (audit-model ADR amendment part 4)
	// and runs with no proof to verify.
	// Multi-instance, the VIEWING side (#71). These are class=instance rows —
	// instance-scope configuration and foreign structure at rest — so unlike
	// the connection tables they ride the proof-gated repositories and need
	// registry entries. Reaching the sealed credential is its own StoreOp so
	// that an operation licensed to LIST remotes is not thereby licensed to
	// present one.
	StoreRemotesCreate    StoreOp = "remotes.Create"
	StoreRemotesList      StoreOp = "remotes.List"
	StoreRemotesGet       StoreOp = "remotes.Get"
	StoreRemotesGetByName StoreOp = "remotes.GetByName"
	StoreRemotesCount     StoreOp = "remotes.Count"
	StoreRemotesRename    StoreOp = "remotes.Rename"
	StoreRemotesDelete    StoreOp = "remotes.Delete"
	StoreRemotesSealed    StoreOp = "remotes.SealedCredential"

	StoreRemoteSnapshotsList  StoreOp = "remotes.Snapshots"
	StoreRemoteSnapshotsGet   StoreOp = "remotes.Snapshot"
	StoreRemoteSnapshotsWrite StoreOp = "remotes.WriteSnapshot"
	StoreRemoteSnapshotsFail  StoreOp = "remotes.RecordFetchFailure"

	StoreAuditTenantInsert       StoreOp = "audit.InsertTenant"
	StoreAuditInstanceInsert     StoreOp = "audit.InsertInstance"
	StoreAuditClaimOfflineRecord StoreOp = "audit.ClaimOfflineRecord"
	StoreAuditTenantPage         StoreOp = "audit.PageTenant"
	StoreAuditInstancePage       StoreOp = "audit.PageInstance"
	StoreAuditTenantMaxSeq       StoreOp = "audit.MaxTenantSeq"
	StoreAuditInstanceMaxSeq     StoreOp = "audit.MaxInstanceSeq"

	// SCIM provisioning (#73). One StoreOp per method on store.SCIMRepo, as
	// invariant 6 requires: the registry is reflected against the repository
	// bundle, so a method without a row here — or a row here without a method —
	// fails the build. Grouping several methods behind one coarse op would have
	// been shorter and would have let an operation authorized to read the
	// directory write it.
	StoreSCIMLockBinding StoreOp = "scim.LockBinding"

	StoreSCIMCreateCredential            StoreOp = "scim.CreateCredential"
	StoreSCIMCredential                  StoreOp = "scim.Credential"
	StoreSCIMCredentials                 StoreOp = "scim.Credentials"
	StoreSCIMRevokeCredential            StoreOp = "scim.RevokeCredential"
	StoreSCIMRevokeCredentialsForBinding StoreOp = "scim.RevokeCredentialsForBinding"
	StoreSCIMDeleteCredentialsForBinding StoreOp = "scim.DeleteCredentialsForBinding"

	StoreSCIMCreateBinding StoreOp = "scim.CreateBinding"
	StoreSCIMBinding       StoreOp = "scim.Binding"
	StoreSCIMBindings      StoreOp = "scim.Bindings"
	StoreSCIMTouchBinding  StoreOp = "scim.TouchBinding"
	StoreSCIMDeleteBinding StoreOp = "scim.DeleteBinding"
	// StoreSCIMRetireConnection removes a binding's provisioning connection,
	// scoped by the proof's org AND the binding row that owns it.
	StoreSCIMRetireConnection StoreOp = "scim.RetireConnectionPrincipal"

	StoreSCIMCreateMapping            StoreOp = "scim.CreateMapping"
	StoreSCIMMapping                  StoreOp = "scim.Mapping"
	StoreSCIMMappings                 StoreOp = "scim.Mappings"
	StoreSCIMMappingsForGroup         StoreOp = "scim.MappingsForGroup"
	StoreSCIMSetMappingInert          StoreOp = "scim.SetMappingInert"
	StoreSCIMUpdateMappingTemplate    StoreOp = "scim.UpdateMappingTemplate"
	StoreSCIMDeleteMapping            StoreOp = "scim.DeleteMapping"
	StoreSCIMDeleteMappingsForBinding StoreOp = "scim.DeleteMappingsForBinding"

	StoreSCIMCreateUser            StoreOp = "scim.CreateUser"
	StoreSCIMUser                  StoreOp = "scim.User"
	StoreSCIMUserByUserName        StoreOp = "scim.UserByUserName"
	StoreSCIMPageUsers             StoreOp = "scim.PageUsers"
	StoreSCIMUserBySubject         StoreOp = "scim.UserBySubject"
	StoreSCIMUserByAccount         StoreOp = "scim.UserByAccount"
	StoreSCIMUsers                 StoreOp = "scim.Users"
	StoreSCIMUpdateUser            StoreOp = "scim.UpdateUser"
	StoreSCIMDeleteUser            StoreOp = "scim.DeleteUser"
	StoreSCIMDeleteUsersForBinding StoreOp = "scim.DeleteUsersForBinding"

	StoreSCIMCreateGroup            StoreOp = "scim.CreateGroup"
	StoreSCIMGroup                  StoreOp = "scim.Group"
	StoreSCIMPageGroups             StoreOp = "scim.PageGroups"
	StoreSCIMGroups                 StoreOp = "scim.Groups"
	StoreSCIMUpdateGroup            StoreOp = "scim.UpdateGroup"
	StoreSCIMDeleteGroup            StoreOp = "scim.DeleteGroup"
	StoreSCIMDeleteGroupsForBinding StoreOp = "scim.DeleteGroupsForBinding"

	StoreSCIMAddGroupMember               StoreOp = "scim.AddGroupMember"
	StoreSCIMGroupMembers                 StoreOp = "scim.GroupMembers"
	StoreSCIMMembershipsForUser           StoreOp = "scim.MembershipsForUser"
	StoreSCIMRemoveGroupMember            StoreOp = "scim.RemoveGroupMember"
	StoreSCIMClearGroupMembers            StoreOp = "scim.ClearGroupMembers"
	StoreSCIMRemoveMembershipsForUser     StoreOp = "scim.RemoveMembershipsForUser"
	StoreSCIMDeleteGroupMembersForBinding StoreOp = "scim.DeleteGroupMembersForBinding"

	StoreSCIMEnterAttention            StoreOp = "scim.EnterAttention"
	StoreSCIMAttention                 StoreOp = "scim.Attention"
	StoreSCIMClearAttention            StoreOp = "scim.ClearAttention"
	StoreSCIMDeleteAttentionForBinding StoreOp = "scim.DeleteAttentionForBinding"
)

type StoredRule

type StoredRule = authn.StoredRule

StoredRule and StoredRuleItem are re-exported so the service layer never names the resolution-surface package.

type StoredRuleItem

type StoredRuleItem = authn.StoredRuleItem

StoredRule and StoredRuleItem are re-exported so the service layer never names the resolution-surface package.

type SystemSite

type SystemSite string

SystemSite is a SystemProof mint site. The set is closed by the tenant-isolation ADR (invariant 11): boot, migration, recovery-mode reconciliation, break-glass local host authority — the ADR names the existing no-principal set, it adds no new authority. Growth of this set, or of any site's operation set, fails the build until the ADR is amended.

const (
	SiteSelfConfigSeed     SystemSite = "self-config-seed"
	SiteSelfConfigRecovery SystemSite = "self-config-recovery"
	SiteSelfConfigRuntime  SystemSite = "self-config-runtime"
	SiteEscrow             SystemSite = "local-escrow-verification"
	SiteBoot               SystemSite = "boot"
	SiteMigration          SystemSite = "migration"
	SiteRecoveryReconcile  SystemSite = "recovery-mode-reconciliation"
	SiteBreakGlass         SystemSite = "break-glass"
	SiteScheduler          SystemSite = "scheduler"
)

type TOTPCredential

type TOTPCredential = authn.TOTPCredential

TOTPCredential is a resolved TOTP factor.

type TxAuthorizer

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

TxAuthorizer is the in-transaction face of authorize(). The transaction package constructs one per transaction attempt from the resolution surface bound to that same transaction; service code receives it inside the closure and can only mint proofs through it — the resolver itself is never exposed.

func NewTxAuthorizer

func NewTxAuthorizer(r *authn.Resolver, tok *TxToken) *TxAuthorizer

NewTxAuthorizer binds authorize() to one transaction attempt. Called by internal/store/tx only; the concrete *authn.Resolver requirement means no other package can supply a fabricated resolution surface.

func (*TxAuthorizer) AccountByEmail

func (a *TxAuthorizer) AccountByEmail(ctx context.Context, email string) (Account, error)

func (*TxAuthorizer) AccountByID

func (a *TxAuthorizer) AccountByID(ctx context.Context, id string) (Account, error)

AccountByID resolves an account by id.

func (*TxAuthorizer) AccountByPrincipal

func (a *TxAuthorizer) AccountByPrincipal(ctx context.Context, p domain.PrincipalID) (Account, error)

AccountByPrincipal resolves the account a session's principal owns — the bridge the factor paths need to reach an account's password/TOTP/recovery rows from the principal a session carries.

func (*TxAuthorizer) AccountByUsername

func (a *TxAuthorizer) AccountByUsername(ctx context.Context, username string) (Account, error)

AccountByUsername resolves a login handle inside this transaction.

func (*TxAuthorizer) AccountByWebAuthnUserHandle

func (a *TxAuthorizer) AccountByWebAuthnUserHandle(ctx context.Context, handle []byte) (Account, error)

AccountByWebAuthnUserHandle resolves the account a discoverable assertion names.

func (*TxAuthorizer) AccountCount

func (a *TxAuthorizer) AccountCount(ctx context.Context) (int64, error)

AccountCount answers the bootstrap path's one question. It has no network route: `hikyo admin create` runs on the server's own host.

func (*TxAuthorizer) AccountProfile

func (a *TxAuthorizer) AccountProfile(ctx context.Context, accountID string) (AccountProfile, error)

func (*TxAuthorizer) ActiveSAMLSPKey

func (a *TxAuthorizer) ActiveSAMLSPKey(ctx context.Context) (SAMLSPKey, error)

ActiveSAMLSPKey resolves the signing key used for AuthnRequests.

func (*TxAuthorizer) AddGrantOrigin

func (a *TxAuthorizer) AddGrantOrigin(ctx context.Context, id, grantID string, p domain.PrincipalID, o Origin, at time.Time) error

AddGrantOrigin attaches one origin to a grant row.

func (*TxAuthorizer) AdmitOperation

func (a *TxAuthorizer) AdmitOperation(ctx context.Context, caller Identity) error

AdmitOperation enforces the artifact classes declared by the exact network operation attached to a request. Authentication still resolves the live identity inside this transaction; this check then refuses a resolved bearer whose class the contract excludes before handler logic can use it.

An absent operation means an in-process caller. Each network adapter attaches a compiled contract before dispatch, so there is no request-derived fallback table and a new declaration takes effect without a second edit.

func (*TxAuthorizer) AdvanceGeneration

func (a *TxAuthorizer) AdvanceGeneration(ctx context.Context, p domain.PrincipalID) error

AdvanceGeneration invalidates every session of a principal at once. It runs in the same transaction as the change that triggered it.

func (*TxAuthorizer) AdvanceRestoreEpoch

func (a *TxAuthorizer) AdvanceRestoreEpoch(ctx context.Context, now time.Time) error

AdvanceRestoreEpoch performs the restore's invalidation.

func (*TxAuthorizer) AdvanceTOTPStep

func (a *TxAuthorizer) AdvanceTOTPStep(ctx context.Context, id string, rowVersion, step int64) (bool, error)

AdvanceTOTPStep consumes a code's step; false means it was not beyond the last.

func (*TxAuthorizer) AdvanceWebAuthnSignCount

func (a *TxAuthorizer) AdvanceWebAuthnSignCount(ctx context.Context, id string, rowVersion, count int64, at time.Time) (bool, error)

AdvanceWebAuthnSignCount writes the presented counter under a row_version CAS; false means the row moved or was disabled.

func (*TxAuthorizer) AllowWorkspaceOrigin

func (a *TxAuthorizer) AllowWorkspaceOrigin(ctx context.Context, o authn.WorkspaceOrigin) error

func (*TxAuthorizer) ApproveCLILogin

func (a *TxAuthorizer) ApproveCLILogin(ctx context.Context, id, session, snapshot string, code []byte) (bool, error)

func (*TxAuthorizer) ApproveCLIReauthHandoff

func (a *TxAuthorizer) ApproveCLIReauthHandoff(ctx context.Context, id string, codeVerifier, windows []byte) (bool, error)

func (*TxAuthorizer) ApproveWorkspaceHandoff

func (a *TxAuthorizer) ApproveWorkspaceHandoff(ctx context.Context, id string, codeVerifier []byte, p domain.PrincipalID, factors, factorClass string, authenticatedAt time.Time) (bool, error)

func (*TxAuthorizer) AssertActiveInstanceDEKVersion

func (a *TxAuthorizer) AssertActiveInstanceDEKVersion(ctx context.Context, version int64) error

AssertActiveInstanceDEKVersion is the writer fence for authentication-surface credential writes, which seal under the instance DEK with no tenant proof to carry the proof-based fence. It refuses (domain.ErrConflict) a write whose sealed instance DEK version a concurrent rotate-dek --instance has retired. See the authn.Resolver method for the query semantics.

func (*TxAuthorizer) AttributeDenials

func (a *TxAuthorizer) AttributeDenials(obj audit.Object)

AttributeDenials names the OBJECT every denial captured from here on addresses, so a refusal's envelope carries what it was about.

It exists for the schema model's per-key audit obligation on the reveal gates ("every attempt is audited ... per key and per principal"): the grant.denied PAYLOAD is a closed schema shared by every operation and must not grow a key field, but the envelope's object type/id is exactly the place an acted-on object belongs, and it already round-trips to both audit tables.

It attributes, it never authorizes: the object id is caller-supplied vocabulary that decides nothing, and the formula is evaluated as before.

func (*TxAuthorizer) Authenticate

func (a *TxAuthorizer) Authenticate(ctx context.Context, presented string, now time.Time) (Identity, error)

Authenticate resolves a presented artifact into a live identity inside this transaction.

Credential-liveness failures return domain.ErrUnauthenticated: absent, malformed, unknown, expired, generation-superseded and epoch-superseded artifacts are indistinguishable. Grammatical artifacts first spend the transport's source allowance; its overload and datastore faults propagate independently of credential liveness. On HTTP requests a live identity is then admitted against the attached OpenAPI operation; an excluded class returns the uniform domain.ErrNotFound and records the named refusal.

func (*TxAuthorizer) AuthenticateCaller

func (a *TxAuthorizer) AuthenticateCaller(ctx context.Context, presented string, now time.Time) (Identity, error)

AuthenticateCaller resolves every ordinary caller class — a human session, service-account credential, or instance connection — plus a SCIM provisioning credential when an HTTP operation is attached. Direct in-process SCIM callers must use AuthenticateSCIMCaller so the caller that owns the wire can also enforce its binding-path match. All resolve inside this same transaction, uncached, at the same chokepoint that mints proofs, which is what the machine-identities ADR requires and what makes revocation bite at the next request.

The split from Authenticate is deliberate and is the guard: a machine credential has no session, no cookie and no assurance record (#16), so a verb that manipulates one must not be reachable with a token. Making the broad function the named one, rather than the default, means a new session-surface verb is machine-proof unless someone opts it in.

The branch is on the TYPE THE CALLER TYPED, not on anything the server trusts: a value whose prefix says `au` still resolves against whatever row its verifier matches, and the row decides everything.

func (*TxAuthorizer) AuthenticateFederated

func (a *TxAuthorizer) AuthenticateFederated(ctx context.Context, issuerID, subject string, check BindingPredicate, now time.Time) (Identity, error)

AuthenticateFederated resolves a validated federated identity to its service account.

The reads are FIXED in number and order, like the bearer path's, and every predicate is evaluated after all of them. Returning as soon as one failed would make an unbound identity cost one query and a revoked binding two — a query-count oracle for which bindings exist. The resolution-surface read performs the same row decode on a miss as on a hit (federation.go's decoy block), so the work above the storage engine is equal too.

Two residuals, stated rather than discovered.

An UNKNOWN ISSUER short-circuits earlier than an unbound subject, because the caller cannot look up a binding without an issuer id and cannot verify a signature without keys. What that discloses is which issuers the instance trusts — instance configuration an operator publishes to the platforms it federates with anyway, not which workloads exist, which is the fact the uniformity rule protects.

The binding predicate's own COST varies with how far it gets: a token failing the audience check does less work than one failing the last pinned claim, and the miss path's decoy pins are three claims that will not match rather than this binding's. Equalising that would mean comparing every pin of every binding whatever the outcome, which is a different and larger machine than the one the ADR asks for; the request is uniformity "as far as practical, with residuals documented", and this is one. The response shape is identical in every case, which is the half that is not a residual.

func (*TxAuthorizer) AuthenticatePairedConnection

func (a *TxAuthorizer) AuthenticatePairedConnection(ctx context.Context, token, proof string, now time.Time) (Identity, error)

AuthenticatePairedConnection is a separate authentication door. Ordinary bearer authentication rejects every connection with a persisted key binding. Replay consumption and all live credential checks share the serve transaction.

func (*TxAuthorizer) AuthenticateSCIMCaller

func (a *TxAuthorizer) AuthenticateSCIMCaller(ctx context.Context, presented string, now time.Time) (Identity, string, error)

AuthenticateSCIMCaller resolves a live provisioning credential without assuming which route received it. The SCIM wire applies its binding-path match and last-used write after operation admission; generic HTTP routes need only the trusted class so an excluded SCIM credential reaches that admission.

func (*TxAuthorizer) AuthenticateSelfSurface

func (a *TxAuthorizer) AuthenticateSelfSurface(ctx context.Context, presented string, now time.Time) (Identity, error)

AuthenticateSelfSurface is the door for the SELF-SCOPED surface — the caller's own active-session listing and its revoke. It admits the three SESSION artifacts and nothing else.

It remains a named entry rather than a flag on AuthenticateCaller because the service behind it assumes a session row exists. HTTP calls first resolve every bearer class and apply the exact OpenAPI operation declaration, then this door narrows an admitted human-session to the three session artifacts.

A workspace bearer IS admitted, and must be: the shell's liveness poll is this endpoint, and it is how both kill switches become visible to a foreign origin. What a workspace bearer may SEE and REVOKE here is narrowed to its own row by the service, because enumerating and ending the human's CLI and browser sessions is not a power a credential living in another origin's JavaScript may hold.

func (*TxAuthorizer) AuthenticateSessionByID

func (a *TxAuthorizer) AuthenticateSessionByID(ctx context.Context, id string, now time.Time) (Identity, error)

AuthenticateSessionByID revalidates the session recorded in a server-side cross-site ceremony after that ceremony's independent opaque cookie has been proven. A session id by itself is never accepted from the wire.

func (*TxAuthorizer) AuthorityByValue

func (a *TxAuthorizer) AuthorityByValue(ctx context.Context, verifier []byte) (CredentialAuthority, error)

AuthorityByValue resolves a presented credential-establishment authority.

func (*TxAuthorizer) Authorize

func (a *TxAuthorizer) Authorize(ctx context.Context, caller Identity, op Operation, scope domain.Scope) (Proof, error)

Authorize evaluates the named operation's formula for the principal against the addressed scope, inside the current transaction, and mints the proof every store call requires. Outcomes:

  • Tenant-scoped operation, chain missing at any level OR formula denied: domain.ErrNotFound — unauthorized ≡ nonexistent, one error, one code path, and exactly one chain-resolution query either way. Missing chains also perform caller grant/rule and applicable decoy key reads, matching the refusal work for an existing inaccessible chain without minting a proof from unresolved or decoy data.
  • Instance-scoped operation, formula denied: domain.ErrUnauthorized — the grant-refusal contract; there is no tenant object whose nonexistence could be mimicked.
  • Registry or addressing bugs (unknown operation, scope depth mismatch): loud errors, never uniform responses — these are programming errors, not probe outcomes.

The caller is an Identity, not a bare principal, because the MFA-mandatory rule is evaluated HERE, in the same transaction and after the grant check: session assurance is a property of how this session authenticated, and the chokepoint that mints the proof is the one place it cannot diverge from the grant table. A session-less caller (Identity.SessionID == "") is local host authority — bootstrap, break-glass, `hikyo admin` — and is exempt, presenting no session and therefore no factor.

func (*TxAuthorizer) AuthorizeDEKRotation

func (a *TxAuthorizer) AuthorizeDEKRotation(ctx context.Context, caller Identity, scope domain.Scope) (Proof, error)

AuthorizeDEKRotation authorizes the instance-level rotation capability and, for a project DEK, also proves that the addressed project currently exists. Project key creation happens outside the transaction, so this check must run before any keyring preparation and again in the committing transaction.

func (*TxAuthorizer) AuthorizeKey

func (a *TxAuthorizer) AuthorizeKey(ctx context.Context, caller Identity, op Operation, scope domain.Scope, key KeyTarget) (Proof, error)

AuthorizeKey is Authorize for an operation acting on exactly one key. It evaluates the same formula; the key only lets a key-narrowed rule take part. A key that does not exist is the uniform nonexistent outcome.

func (*TxAuthorizer) AuthorizePublishKeys

func (a *TxAuthorizer) AuthorizePublishKeys(ctx context.Context, caller Identity, scope domain.Scope, ids []string) (Proof, error)

AuthorizePublishKeys proves the complete changed-key set of one environment. Snapshot materialization may carry unchanged cells forward, but may mutate only these keys. Empty selections never mint a collection proof.

func (*TxAuthorizer) AuthorizeRule

func (a *TxAuthorizer) AuthorizeRule(ctx context.Context, caller Identity, op Operation, scope domain.Scope, target domain.Rule) (Proof, error)

AuthorizeRule proves a member-management operation against the complete selector being changed, rather than a single representative key. It shares all caller, assurance, denial and proof checks with Authorize.

func (*TxAuthorizer) AuthorizeRuleList

func (a *TxAuthorizer) AuthorizeRuleList(ctx context.Context, caller Identity, scope domain.Scope) (Proof, error)

AuthorizeRuleList admits a project membership read through any live Manage access selector. The service must filter the listing with RulesManageable once, before resolving principal names or rendering selector metadata.

func (*TxAuthorizer) BindRemotePairedConnection

func (a *TxAuthorizer) BindRemotePairedConnection(ctx context.Context, c RemotePairedConnection) error

func (*TxAuthorizer) BindSessionToOAuth2Provider

func (a *TxAuthorizer) BindSessionToOAuth2Provider(ctx context.Context, sessionID, providerID string) (bool, error)

func (*TxAuthorizer) BindSessionToSAMLProvider

func (a *TxAuthorizer) BindSessionToSAMLProvider(ctx context.Context, sessionID, providerID string) (bool, error)

BindSessionToSAMLProvider records SAML provider provenance in the same transaction that mints the session.

func (*TxAuthorizer) BindingsForIssuer

func (a *TxAuthorizer) BindingsForIssuer(ctx context.Context, id string) (int64, error)

BindingsForIssuer is the delete guard's census: removing the issuer of a live binding is an authorization change wearing a configuration change's clothes.

func (*TxAuthorizer) CLILoginByCode

func (a *TxAuthorizer) CLILoginByCode(ctx context.Context, verifier []byte) (CLILogin, error)

func (*TxAuthorizer) CLILoginByState

func (a *TxAuthorizer) CLILoginByState(ctx context.Context, verifier []byte) (CLILogin, error)

func (*TxAuthorizer) CLILoginByUserCode

func (a *TxAuthorizer) CLILoginByUserCode(ctx context.Context, verifier []byte) (CLILogin, error)

func (*TxAuthorizer) CLIReauthHandoffByCode

func (a *TxAuthorizer) CLIReauthHandoffByCode(ctx context.Context, verifier []byte) (CLIReauthHandoff, error)

func (*TxAuthorizer) CLIReauthHandoffByState

func (a *TxAuthorizer) CLIReauthHandoffByState(ctx context.Context, verifier []byte) (CLIReauthHandoff, error)

func (*TxAuthorizer) CallerCanDefineKeys

func (a *TxAuthorizer) CallerCanDefineKeys(ctx context.Context, caller Identity, scope domain.Scope) (creatable, editable bool, err error)

CallerCanDefineKeys reports the caller's own existential catalogue affordances. It never mints authority: each write still checks its actual key, folder and complete publication footprint. A single-key selector can offer editing, but cannot offer creation of a different, future key.

func (*TxAuthorizer) CallerHolds

func (a *TxAuthorizer) CallerHolds(ctx context.Context, caller Identity,
	op Operation, scope domain.Scope) (bool, error)

CallerHolds answers a UI-affordance question about THE CALLER: would this identity satisfy `op` at this scope, right now?

It is deliberately NOT an authorization decision and it mints no denial event. Authorize() is still the only thing that produces a proof and the only thing that lets an operation proceed; this reads the same grant table through the same predicate so the two cannot disagree, and it exists because a surface has to know what to OFFER before anyone acts.

Concretely (#58): the write-only editing path is a first-class one — `edit` without `reveal` is a valid, supported state the permission model refuses to reject — so the value editor has to say "replace without seeing the current value" to a principal who cannot reveal, and "leave empty to keep unchanged" to one who can. Deriving that from whether a cell happens to be revealed on screen would make the affordance a function of what the human last clicked rather than of what they may do.

It takes a resolved Identity rather than a bare principal id, and answers only about that identity — an exported probe that accepted any principal would be an unaudited "what can THEY do?" oracle waiting for its first caller. It applies the same session policy the chokepoint does beyond the grant check (the MFA-mandatory floor), so a password-only session is not told it may reveal while real authorization refuses it.

It discloses only the caller's OWN capability on a scope they already resolved, which is exactly what the reveal ceremony's own refusals already tell them, and which they can read off their own grants.

func (*TxAuthorizer) CallerHoldsApprovalKeys

func (a *TxAuthorizer) CallerHoldsApprovalKeys(ctx context.Context, caller Identity, scope domain.Scope, ids []string) (bool, error)

CallerHoldsApprovalKeys is the live quorum eligibility check, scoped to approval decisions only. It never mints a proof or captures denials while recomputing recorded votes. Each pinned key must remain within the voter's current Publish reach; losing one key invalidates that voter's contribution.

func (*TxAuthorizer) CaptureAudit

func (a *TxAuthorizer) CaptureAudit(trail audit.Trail, scope domain.Scope, e audit.Event)

CaptureAudit enrols an event in the same DURABLE SETTLEMENT the denial writer uses: the transaction package rolls the attempt back and then flushes every captured record in its own small transaction, before the outcome returns to the caller.

It exists for the schema model's "every attempt is audited" obligation on the reveal gates. A gate attempt has to be recorded whether it was allowed, denied or rate-limited — and the denied and limited cases roll their transaction back, so an in-transaction insert would vanish exactly when it matters. This is the one path in the system that survives a rollback, and widening its use is a deliberate, reviewed act rather than a convenience: callers must carry no instance data in the payload, because these rows are written outside the operation's own authorization scope.

func (*TxAuthorizer) ClaimFederatedAuthority

func (a *TxAuthorizer) ClaimFederatedAuthority(ctx context.Context, id, kind string, at time.Time) (bool, error)

func (*TxAuthorizer) ClaimRemotePairingAttempt

func (a *TxAuthorizer) ClaimRemotePairingAttempt(ctx context.Context, id string, now time.Time) (bool, error)

func (*TxAuthorizer) ClaimRemotePairingReplay

func (a *TxAuthorizer) ClaimRemotePairingReplay(ctx context.Context, thumbprint string, v []byte, expires time.Time) (bool, error)

func (*TxAuthorizer) ClaimSAMLReplay

func (a *TxAuthorizer) ClaimSAMLReplay(ctx context.Context, replay NewSAMLReplay) (bool, error)

ClaimSAMLReplay atomically records an assertion ID. False means replay.

func (*TxAuthorizer) ClampCredentialExpiry

func (a *TxAuthorizer) ClampCredentialExpiry(ctx context.Context, ceiling time.Time) (int64, error)

func (*TxAuthorizer) ClampDeveloperCredentialExpiry

func (a *TxAuthorizer) ClampDeveloperCredentialExpiry(ctx context.Context, id string, at time.Time) error

func (*TxAuthorizer) ClampIndefiniteCredentials

func (a *TxAuthorizer) ClampIndefiniteCredentials(ctx context.Context, ceiling time.Time) (int64, error)

func (*TxAuthorizer) ClearPendingTOTP

func (a *TxAuthorizer) ClearPendingTOTP(ctx context.Context, accountID string) error

ClearPendingTOTP removes only in-progress enrolments.

func (*TxAuthorizer) CommittedRefusalReceipt

func (a *TxAuthorizer) CommittedRefusalReceipt(ctx context.Context)

CommittedRefusalReceipt is called only after the owning transaction commits.

func (*TxAuthorizer) ConfirmTOTP

func (a *TxAuthorizer) ConfirmTOTP(ctx context.Context, id string, rowVersion, step int64, at time.Time) (bool, error)

ConfirmTOTP promotes and consumes a step in one CAS; false means the row moved or the step was not beyond the last.

func (*TxAuthorizer) ConfirmedTOTP

func (a *TxAuthorizer) ConfirmedTOTP(ctx context.Context, accountID string) (TOTPCredential, error)

ConfirmedTOTP resolves an account's confirmed TOTP factor.

func (*TxAuthorizer) ConsumeAuthority

func (a *TxAuthorizer) ConsumeAuthority(ctx context.Context, id string, at time.Time) (bool, error)

ConsumeAuthority claims an authority atomically; false means it was already consumed and the caller must fail closed.

func (*TxAuthorizer) ConsumeCLILogin

func (a *TxAuthorizer) ConsumeCLILogin(ctx context.Context, id string, at time.Time) (bool, error)

func (*TxAuthorizer) ConsumeCLIReauthHandoff

func (a *TxAuthorizer) ConsumeCLIReauthHandoff(ctx context.Context, id string, at time.Time) (bool, error)

func (*TxAuthorizer) ConsumeLoginChallenge

func (a *TxAuthorizer) ConsumeLoginChallenge(ctx context.Context, id string, at time.Time) (bool, error)

ConsumeLoginChallenge claims a login challenge atomically; false means it was already consumed and the caller must fail closed.

func (*TxAuthorizer) ConsumeOAuth2Transaction

func (a *TxAuthorizer) ConsumeOAuth2Transaction(ctx context.Context, id string, at time.Time) (bool, error)

func (*TxAuthorizer) ConsumeOIDCTransaction

func (a *TxAuthorizer) ConsumeOIDCTransaction(ctx context.Context, id string, at time.Time) (bool, error)

ConsumeOIDCTransaction claims a transaction atomically; false means it moved.

func (*TxAuthorizer) ConsumeOutstandingAuthorities

func (a *TxAuthorizer) ConsumeOutstandingAuthorities(ctx context.Context, accountID string, at time.Time) error

ConsumeOutstandingAuthorities marks every unconsumed authority of an account consumed, in the same transaction as a fresh mint or consumption.

func (*TxAuthorizer) ConsumeRegistrationSignup

func (a *TxAuthorizer) ConsumeRegistrationSignup(ctx context.Context, id string, verifier []byte) (bool, error)

func (*TxAuthorizer) ConsumeRemotePairingExchange

func (a *TxAuthorizer) ConsumeRemotePairingExchange(ctx context.Context, id string, now time.Time, epoch int64) (bool, error)

func (*TxAuthorizer) ConsumeRemotePairingInvite

func (a *TxAuthorizer) ConsumeRemotePairingInvite(ctx context.Context, id string, now time.Time, epoch int64) (bool, error)

func (*TxAuthorizer) ConsumeSAMLTransaction

func (a *TxAuthorizer) ConsumeSAMLTransaction(ctx context.Context, id string, at time.Time) (bool, error)

ConsumeSAMLTransaction spends a transaction on first presentation, success or failure.

func (*TxAuthorizer) ConsumeSingleDecisionWindow

func (a *TxAuthorizer) ConsumeSingleDecisionWindow(ctx context.Context, id string, at time.Time) (bool, error)

ConsumeSingleDecisionWindow claims a single-decision window exactly once; false means it was already spent (B11 double-spend).

func (*TxAuthorizer) ConsumeWebAuthnCeremony

func (a *TxAuthorizer) ConsumeWebAuthnCeremony(ctx context.Context, id, credentialID string, at time.Time) (bool, error)

ConsumeWebAuthnCeremony claims a ceremony atomically and stamps the credential that answered it; false means it was already consumed.

func (*TxAuthorizer) ConsumeWorkspaceHandoff

func (a *TxAuthorizer) ConsumeWorkspaceHandoff(ctx context.Context, id string, at time.Time) (bool, error)

func (*TxAuthorizer) CorrectPrivacyAccount

func (a *TxAuthorizer) CorrectPrivacyAccount(ctx context.Context, account, username, displayName string) error

func (*TxAuthorizer) CountExternalIdentitiesForIssuer

func (a *TxAuthorizer) CountExternalIdentitiesForIssuer(ctx context.Context, kind, issuer string) (int64, error)

CountExternalIdentitiesForIssuer counts the links under one (kind, issuer).

func (*TxAuthorizer) CountGrantsInOrg

func (a *TxAuthorizer) CountGrantsInOrg(ctx context.Context, org string) (int64, error)

CountGrantsInOrg reports how many grant rows an organization holds — the read behind the per-org grant sanity cap.

func (*TxAuthorizer) CountLiveRemotePairingExchanges

func (a *TxAuthorizer) CountLiveRemotePairingExchanges(ctx context.Context, id string, now time.Time) (int64, error)

func (*TxAuthorizer) CountLiveRemotePairingInvites

func (a *TxAuthorizer) CountLiveRemotePairingInvites(ctx context.Context, now time.Time) (int64, error)

func (*TxAuthorizer) CountRegistrationPolicyOrgs

func (a *TxAuthorizer) CountRegistrationPolicyOrgs(ctx context.Context, policyID string) (int64, error)

CountRegistrationPolicyOrgs counts the live orgs a policy minted.

func (*TxAuthorizer) CountRemotePairingReplays

func (a *TxAuthorizer) CountRemotePairingReplays(ctx context.Context) (int64, error)

func (*TxAuthorizer) CountRemotePairingReplaysForKey

func (a *TxAuthorizer) CountRemotePairingReplaysForKey(ctx context.Context, thumbprint string) (int64, error)

func (*TxAuthorizer) CreateAccessGrant

func (a *TxAuthorizer) CreateAccessGrant(ctx context.Context, id string, p domain.PrincipalID, g domain.Grant,
	requestID string, at, expiresAt time.Time) error

CreateAccessGrant writes one environment-scoped temporary grant row.

func (*TxAuthorizer) CreateAccount

func (a *TxAuthorizer) CreateAccount(ctx context.Context, acc Account) error

func (*TxAuthorizer) CreateCLILogin

func (a *TxAuthorizer) CreateCLILogin(ctx context.Context, h CLILogin) error

func (*TxAuthorizer) CreateCLIReauthHandoff

func (a *TxAuthorizer) CreateCLIReauthHandoff(ctx context.Context, h NewCLIReauthHandoff) error

func (*TxAuthorizer) CreateDeveloperCredential

func (a *TxAuthorizer) CreateDeveloperCredential(ctx context.Context, c DeveloperCredential, v []byte) error

func (*TxAuthorizer) CreateExternalIdentity

func (a *TxAuthorizer) CreateExternalIdentity(ctx context.Context, n NewExternalIdentity) error

CreateExternalIdentity writes a link.

func (*TxAuthorizer) CreateFederationIssuer

func (a *TxAuthorizer) CreateFederationIssuer(ctx context.Context, iss NewFederationIssuer) error

func (*TxAuthorizer) CreateGrant

func (a *TxAuthorizer) CreateGrant(ctx context.Context, id string, p domain.PrincipalID, g domain.Grant, at time.Time) error

CreateGrant writes one grant row. The bootstrap path uses it to expand the `admin` template into separate, visible, individually revocable rows rather than an implicit bundle. The general grant surface is #55's.

func (*TxAuthorizer) CreateHumanPrincipal

func (a *TxAuthorizer) CreateHumanPrincipal(ctx context.Context, id domain.PrincipalID, at time.Time) error

CreateHumanPrincipal and CreateAccount are the bootstrap path's writes, reachable only from `hikyo admin create` on the server's own host — the closed local-authority exception set's boot/bootstrap member. There is no HTTP route to either, and the classification-totality invariant is what keeps that true.

func (*TxAuthorizer) CreateLoginChallenge

func (a *TxAuthorizer) CreateLoginChallenge(ctx context.Context, c NewLoginChallenge) error

CreateLoginChallenge writes a single-use, expiring login challenge (#760).

func (*TxAuthorizer) CreateMachineCredential

func (a *TxAuthorizer) CreateMachineCredential(ctx context.Context, c NewCredential) error

func (*TxAuthorizer) CreateMachinePrincipal

func (a *TxAuthorizer) CreateMachinePrincipal(ctx context.Context, id domain.PrincipalID, class domain.PrincipalClass, at time.Time) error

func (*TxAuthorizer) CreateOAuth2Provider

func (a *TxAuthorizer) CreateOAuth2Provider(ctx context.Context, n NewOAuth2Provider) error

OAuth2's profile-pinned provider and single-use transaction resolution.

func (*TxAuthorizer) CreateOAuth2Transaction

func (a *TxAuthorizer) CreateOAuth2Transaction(ctx context.Context, t NewOAuth2Transaction) error

func (*TxAuthorizer) CreateOIDCTransaction

func (a *TxAuthorizer) CreateOIDCTransaction(ctx context.Context, t NewOIDCTransaction) error

CreateOIDCTransaction writes a single-use transaction row.

func (*TxAuthorizer) CreateProvider

func (a *TxAuthorizer) CreateProvider(ctx context.Context, n NewProvider) error

CreateProvider inserts a provider row (authorized at the chokepoint first).

func (*TxAuthorizer) CreateProvisioningPrincipal

func (a *TxAuthorizer) CreateProvisioningPrincipal(ctx context.Context, id domain.PrincipalID, at time.Time) error

The two ends of the provisioning connection's life: created with its binding, retired by §6's state machine atomically with the structural grant it held. Neither takes a class: the first hardcodes it and the second requires it.

func (*TxAuthorizer) CreateRegistrationPolicy

func (a *TxAuthorizer) CreateRegistrationPolicy(ctx context.Context, p RegistrationPolicy) error

CreateRegistrationPolicy inserts a policy; a second one per scope is ErrConflict.

func (*TxAuthorizer) CreateRegistrationSignup

func (a *TxAuthorizer) CreateRegistrationSignup(ctx context.Context, n NewRegistrationSignup) error

CreateRegistrationSignup inserts a pending local sign-up row.

func (*TxAuthorizer) CreateRemotePairingExchange

func (a *TxAuthorizer) CreateRemotePairingExchange(ctx context.Context, e RemotePairingExchange) error

func (*TxAuthorizer) CreateRemotePairingInvite

func (a *TxAuthorizer) CreateRemotePairingInvite(ctx context.Context, i RemotePairingInvite) error

func (*TxAuthorizer) CreateRule

func (a *TxAuthorizer) CreateRule(ctx context.Context, rule domain.Rule, createdBy domain.PrincipalID, at time.Time, newItemID func() (string, error)) error

func (*TxAuthorizer) CreateSAMLProvider

func (a *TxAuthorizer) CreateSAMLProvider(ctx context.Context, provider NewSAMLProvider) error

CreateSAMLProvider inserts a provider after instance-config authorization.

func (*TxAuthorizer) CreateSAMLSPKey

func (a *TxAuthorizer) CreateSAMLSPKey(ctx context.Context, key NewSAMLSPKey) error

CreateSAMLSPKey stores a freshly minted encrypted private key.

func (*TxAuthorizer) CreateSAMLTransaction

func (a *TxAuthorizer) CreateSAMLTransaction(ctx context.Context, transaction NewSAMLTransaction) error

CreateSAMLTransaction writes a single-use AuthnRequest transaction.

func (*TxAuthorizer) CreateServiceAccountAggregate

func (a *TxAuthorizer) CreateServiceAccountAggregate(ctx context.Context, sa NewServiceAccount) (ServiceAccountCreation, error)

func (*TxAuthorizer) CreateTOTP

func (a *TxAuthorizer) CreateTOTP(ctx context.Context, c NewTOTPCredential) error

CreateTOTP inserts a pending TOTP enrolment.

func (*TxAuthorizer) CreateWebAuthnCeremony

func (a *TxAuthorizer) CreateWebAuthnCeremony(ctx context.Context, c NewWebAuthnCeremony) error

CreateWebAuthnCeremony writes a single-use, expiring challenge row.

func (*TxAuthorizer) CreateWebAuthnCredential

func (a *TxAuthorizer) CreateWebAuthnCredential(ctx context.Context, c NewWebAuthnCredential) error

CreateWebAuthnCredential inserts a freshly enrolled passkey.

func (*TxAuthorizer) CreateWorkspaceHandoff

func (a *TxAuthorizer) CreateWorkspaceHandoff(ctx context.Context, h authn.NewWorkspaceHandoff) error

func (*TxAuthorizer) CredentialAuthorityByID

func (a *TxAuthorizer) CredentialAuthorityByID(ctx context.Context, id string) (CredentialAuthority, error)

func (*TxAuthorizer) CredentialEpoch

func (a *TxAuthorizer) CredentialEpoch(ctx context.Context) (int64, error)

CredentialEpoch reads the instance epoch.

func (*TxAuthorizer) CredentialEstablish

func (a *TxAuthorizer) CredentialEstablish(ctx context.Context, sessionID string, principal domain.PrincipalID, at time.Time) (CredentialEstablishEvidence, error)

func (*TxAuthorizer) CredentialPolicy

func (a *TxAuthorizer) CredentialPolicy(ctx context.Context) (CredentialPolicy, error)

func (*TxAuthorizer) CredentialsBeyondCeiling

func (a *TxAuthorizer) CredentialsBeyondCeiling(ctx context.Context, ceiling time.Time) ([]AffectedCredential, error)

func (*TxAuthorizer) DeleteAccessGrantsForRequest

func (a *TxAuthorizer) DeleteAccessGrantsForRequest(ctx context.Context, p domain.PrincipalID, requestID string) (int64, error)

DeleteAccessGrantsForRequest releases every temporary row one request wrote.

func (*TxAuthorizer) DeleteExpiredSAMLReplay

func (a *TxAuthorizer) DeleteExpiredSAMLReplay(ctx context.Context, at time.Time) (int64, error)

DeleteExpiredSAMLReplay removes replay rows after their signed validity plus skew has elapsed.

func (*TxAuthorizer) DeleteFederationIssuer

func (a *TxAuthorizer) DeleteFederationIssuer(ctx context.Context, id string) (bool, error)

func (*TxAuthorizer) DeleteGrantRow

func (a *TxAuthorizer) DeleteGrantRow(ctx context.Context, grantID string, p domain.PrincipalID) (bool, error)

DeleteGrantRow removes a grant row whose last origin was released.

func (*TxAuthorizer) DeleteOAuth2Provider

func (a *TxAuthorizer) DeleteOAuth2Provider(ctx context.Context, id string) error

func (*TxAuthorizer) DeleteProvider

func (a *TxAuthorizer) DeleteProvider(ctx context.Context, id string) error

DeleteProvider removes a provider.

func (*TxAuthorizer) DeleteRegistrationPolicy

func (a *TxAuthorizer) DeleteRegistrationPolicy(ctx context.Context, id string, expected int64) (bool, error)

DeleteRegistrationPolicy removes a policy at an expected row version.

func (*TxAuthorizer) DeleteRegistrationSignup

func (a *TxAuthorizer) DeleteRegistrationSignup(ctx context.Context, id string) (bool, error)

DeleteRegistrationSignup deletes one pending local sign-up row.

func (*TxAuthorizer) DeleteRetiringSAMLSPKey

func (a *TxAuthorizer) DeleteRetiringSAMLSPKey(ctx context.Context, id string) (bool, error)

DeleteRetiringSAMLSPKey erases a retiring key.

func (*TxAuthorizer) DeleteRule

func (a *TxAuthorizer) DeleteRule(ctx context.Context, id string, p domain.PrincipalID) (bool, error)

func (*TxAuthorizer) DeleteRuleItem

func (a *TxAuthorizer) DeleteRuleItem(ctx context.Context, ruleID, itemID string, p domain.PrincipalID) error

func (*TxAuthorizer) DeleteSAMLProvider

func (a *TxAuthorizer) DeleteSAMLProvider(ctx context.Context, id string) error

DeleteSAMLProvider removes a locked provider row.

func (*TxAuthorizer) DeleteServiceAccountAggregate

func (a *TxAuthorizer) DeleteServiceAccountAggregate(ctx context.Context, in DeleteServiceAccountAggregateInput) (ServiceAccountDeletion, error)

func (*TxAuthorizer) DeleteSessionsForOAuth2Provider

func (a *TxAuthorizer) DeleteSessionsForOAuth2Provider(ctx context.Context, providerID string) (int64, error)

func (*TxAuthorizer) DeleteWebAuthnCredential

func (a *TxAuthorizer) DeleteWebAuthnCredential(ctx context.Context, id, accountID string) (bool, error)

DeleteWebAuthnCredential removes a credential (de-enrolment) under an account_id predicate. False means zero rows matched — refused fail-closed.

func (*TxAuthorizer) DeliveryReporterHolds

func (a *TxAuthorizer) DeliveryReporterHolds(ctx context.Context, principal domain.PrincipalID, scope domain.Scope) (bool, error)

DeliveryReporterHolds reports whether a principal holds `report-delivery-status` on the scope: the report operation's own formula, evaluated over its grants. The list uses it to name a quota-refused principal only in an environment that principal may report on (ADR D5), so a principal the environment never granted never appears there. Like DeliveryReporterLive it records no denial: the principal is not the caller.

func (*TxAuthorizer) DeliveryReporterLive

func (a *TxAuthorizer) DeliveryReporterLive(ctx context.Context, principal domain.PrincipalID, scope domain.Scope, now time.Time) (bool, error)

DeliveryReporterLive reports whether a principal that owns a delivery-target row can still report on it (k8s-condition-reporting ADR D5): it holds `report-delivery-status` on the scope, and at least one live credential (an unrevoked, unexpired `hikyo-token` or an active federation binding).

It records no denial and applies no session policy: the principal is not the caller. It answers only about a principal that already owns a row in an environment the caller was authorized to list, so it discloses nothing the list does not already name.

func (*TxAuthorizer) DenialCaptureError

func (a *TxAuthorizer) DenialCaptureError() error

DenialCaptureError reports a denial that could not even be captured (event-id mint failure). The transaction package MUST treat it exactly like a flush failure: loud refusal, never the uniform denial — a denial answer without its durable record is what fail-closed forbids.

func (*TxAuthorizer) DeveloperCredentialPolicy

func (a *TxAuthorizer) DeveloperCredentialPolicy(ctx context.Context) (time.Duration, error)

func (*TxAuthorizer) DeveloperDeliveryGrants

func (a *TxAuthorizer) DeveloperDeliveryGrants(ctx context.Context, caller Identity) ([]domain.Grant, error)

DeveloperDeliveryGrants projects only the two capabilities delegated by this artifact. The human's historical, write and cross-environment grants never travel into developer delivery, including when whole-environment rules supply the human's current authority.

func (*TxAuthorizer) DisableWebAuthnCredential

func (a *TxAuthorizer) DisableWebAuthnCredential(ctx context.Context, id string, rowVersion int64, at time.Time) (bool, error)

DisableWebAuthnCredential sets disabled_at under a CAS (the clone response); false means the row moved or was already disabled.

func (*TxAuthorizer) EnabledProviderByIssuer

func (a *TxAuthorizer) EnabledProviderByIssuer(ctx context.Context, kind, issuer string) (OIDCProvider, error)

EnabledProviderByIssuer resolves the currently enabled provider for an issuer.

func (*TxAuthorizer) EnabledProviderBySlug

func (a *TxAuthorizer) EnabledProviderBySlug(ctx context.Context, slug string) (OIDCProvider, error)

EnabledProviderBySlug resolves an enabled provider by slug, for start.

func (*TxAuthorizer) EnvironmentChainByID

func (a *TxAuthorizer) EnvironmentChainByID(ctx context.Context, envID string) (EnvironmentChain, error)

EnvironmentChainByID resolves an environment's chain from its id, so LowerEffectiveWindow can build the grant-coverage predicate from an env id.

func (*TxAuthorizer) EnvironmentReauthSettings

func (a *TxAuthorizer) EnvironmentReauthSettings(ctx context.Context, envID string) (EnvSetting, error)

EnvironmentReauthSettings reads an environment's protection state and its own reauthentication window, if it has one.

func (*TxAuthorizer) EnvironmentsInProject

func (a *TxAuthorizer) EnvironmentsInProject(ctx context.Context, scope domain.Scope) ([]domain.EnvID, error)

EnvironmentsInProject is the universe the mint and widen reachability formulas range over.

func (*TxAuthorizer) ErasePrivacyAccount

func (a *TxAuthorizer) ErasePrivacyAccount(ctx context.Context, account, p, username string) error

func (*TxAuthorizer) ExpiredRegistrationSignups

func (a *TxAuthorizer) ExpiredRegistrationSignups(ctx context.Context, at time.Time) ([]ExpiredRegistrationSignup, error)

func (*TxAuthorizer) ExternalIdentitiesForAccount

func (a *TxAuthorizer) ExternalIdentitiesForAccount(ctx context.Context, accountID string) ([]ExternalIdentity, error)

ExternalIdentitiesForAccount lists an account's linked identities.

func (*TxAuthorizer) ExternalIdentityByID

func (a *TxAuthorizer) ExternalIdentityByID(ctx context.Context, id string) (ExternalIdentity, error)

ExternalIdentityByID resolves a link by id.

func (*TxAuthorizer) ExternalIdentityByKey

func (a *TxAuthorizer) ExternalIdentityByKey(ctx context.Context, kind, issuer, subject string) (ExternalIdentity, error)

ExternalIdentityByKey resolves a byte-exact (kind, issuer, subject).

func (*TxAuthorizer) FederationIssuerByID

func (a *TxAuthorizer) FederationIssuerByID(ctx context.Context, id string) (FederationIssuer, error)

func (*TxAuthorizer) FederationIssuerByIssuer

func (a *TxAuthorizer) FederationIssuerByIssuer(ctx context.Context, issuer string) (FederationIssuer, error)

FederationIssuerByIssuer resolves a configuration by its BYTE-EXACT `iss`.

func (*TxAuthorizer) FederationIssuers

func (a *TxAuthorizer) FederationIssuers(ctx context.Context) ([]FederationIssuer, error)

func (*TxAuthorizer) GetRule

func (a *TxAuthorizer) GetRule(ctx context.Context, id string) (StoredRule, bool, error)

GetRule reads one stored rule, ungated; valid is false for a stored rule that no longer validates (the caller should delete it).

func (*TxAuthorizer) GrantLinesAtInstance

func (a *TxAuthorizer) GrantLinesAtInstance(ctx context.Context) ([]GrantLine, error)

GrantLinesAtInstance lists the instance-scope membership surface.

func (*TxAuthorizer) GrantLinesInOrg

func (a *TxAuthorizer) GrantLinesInOrg(ctx context.Context, org string) ([]GrantLine, error)

GrantLinesInOrg lists the membership surface for one org.

func (*TxAuthorizer) GrantLinesInProject

func (a *TxAuthorizer) GrantLinesInProject(ctx context.Context, org, project string) ([]GrantLine, error)

GrantLinesInProject lists the membership surface for one project.

func (*TxAuthorizer) GrantOriginCount

func (a *TxAuthorizer) GrantOriginCount(ctx context.Context, grantID string) (int64, error)

GrantOriginCount reports how many origins still hold a grant row.

func (*TxAuthorizer) GrantOriginsFor

func (a *TxAuthorizer) GrantOriginsFor(ctx context.Context, grantID string) ([]Origin, error)

GrantOriginsFor lists the origins holding one grant row.

func (*TxAuthorizer) GrantOriginsForPrincipal

func (a *TxAuthorizer) GrantOriginsForPrincipal(ctx context.Context, p domain.PrincipalID) ([]GrantOriginRow, error)

GrantOriginsForPrincipal lists every origin holding every grant row of one principal, read at one instant. The SCIM release algorithm (#73 §2.4) decides per origin and then counts what remains per row; seeing the two tables at different instants would let a row be judged against origins that had already moved.

func (*TxAuthorizer) GrantRowsForPrincipal

func (a *TxAuthorizer) GrantRowsForPrincipal(ctx context.Context, p domain.PrincipalID) ([]GrantRow, error)

GrantRowsForPrincipal lists a principal's grants with their row ids — the dedup read every create performs under the principal-row lock.

func (*TxAuthorizer) GrantsForResetTarget

func (a *TxAuthorizer) GrantsForResetTarget(ctx context.Context, p domain.PrincipalID) ([]domain.Grant, error)

GrantsForResetTarget reads the credential-reset target's full grant set for the org-bounded test, under the row lock the reset holds.

func (*TxAuthorizer) GrantsOf

func (a *TxAuthorizer) GrantsOf(ctx context.Context, p domain.PrincipalID) ([]domain.Grant, error)

GrantsOf returns a principal's full grant set — the pre-state input to the reachability diff.

func (*TxAuthorizer) GuardOAuth2ProviderForMint

func (a *TxAuthorizer) GuardOAuth2ProviderForMint(ctx context.Context, id string, rowVersion int64, issuer string) (bool, error)

func (*TxAuthorizer) GuardProviderForMint

func (a *TxAuthorizer) GuardProviderForMint(ctx context.Context, id string, rowVersion int64, issuer string) (bool, error)

GuardProviderForMint locks the pinned provider row inside a Phase-C mint tx and reports whether it still matches the Phase-A snapshot; false means the provider moved and the mint must refuse (A4 TOCTOU, sweep wins).

func (*TxAuthorizer) GuardSAMLProviderForMint

func (a *TxAuthorizer) GuardSAMLProviderForMint(ctx context.Context, id string, rowVersion int64, entityID string) (bool, error)

GuardSAMLProviderForMint proves the provider still matches the Phase-A snapshot immediately before a session or reauth window is written.

func (*TxAuthorizer) HoldRestoredPKIIssuers

func (a *TxAuthorizer) HoldRestoredPKIIssuers(ctx context.Context) error

func (*TxAuthorizer) HoldsInstanceCapability

func (a *TxAuthorizer) HoldsInstanceCapability(ctx context.Context, caller Identity, op Operation) (bool, error)

HoldsInstanceCapability reports whether the caller's own grants satisfy an INSTANCE-scoped operation's formula and its assurance floor, WITHOUT recording an operation or a denial. It is the disclosure-safe "may I even attempt this instance surface" check the UI gates on; real authorization is still evaluated at the chokepoint per request.

It deliberately mirrors authorizeInstance rather than CallerHolds: an instance op evaluates its formula against the empty scope and resolves no tenant chain, so routing it through the scoped path (CallerHolds) would ask ResolveChain to resolve an empty scope and error. It refuses a non-instance op for the same reason — the caller would get a silently wrong answer.

func (*TxAuthorizer) IncompatiblePasswordKDFCount

func (a *TxAuthorizer) IncompatiblePasswordKDFCount(ctx context.Context, kdf KDFParams) (int64, error)

IncompatiblePasswordKDFCount is for startup/configuration admission, not a public authentication route. It exposes only aggregate parameter metadata.

func (*TxAuthorizer) IndefiniteCredentials

func (a *TxAuthorizer) IndefiniteCredentials(ctx context.Context) ([]AffectedCredential, error)

func (*TxAuthorizer) InstanceConnectionByID

func (a *TxAuthorizer) InstanceConnectionByID(ctx context.Context, id string) (authn.InstanceConnection, error)

func (*TxAuthorizer) InstanceConnectionByPrincipal

func (a *TxAuthorizer) InstanceConnectionByPrincipal(ctx context.Context, p domain.PrincipalID) (authn.InstanceConnection, error)

InstanceConnectionByPrincipal answers "which connection is this caller", which is what the directory serve needs to stamp last-used and to name the actor in its audit event.

func (*TxAuthorizer) InstanceConnections

func (a *TxAuthorizer) InstanceConnections(ctx context.Context) ([]authn.InstanceConnection, error)

func (*TxAuthorizer) InstanceIdentity

func (a *TxAuthorizer) InstanceIdentity(ctx context.Context) (string, error)

InstanceIdentity is this instance's own opaque id — the value a directory listing carries and the one self-connection refusal compares against.

func (*TxAuthorizer) InvalidateReauthWindowsForEnvironment

func (a *TxAuthorizer) InvalidateReauthWindowsForEnvironment(ctx context.Context, environmentID string) (int64, error)

InvalidateReauthWindowsForEnvironment deletes every open window on one environment (the effective-window transition, B6) and returns the count.

func (*TxAuthorizer) InvalidateRestoredAdapterCredentials

func (a *TxAuthorizer) InvalidateRestoredAdapterCredentials(ctx context.Context) error

func (*TxAuthorizer) InvalidateRestoredDynamicProviderCredentials

func (a *TxAuthorizer) InvalidateRestoredDynamicProviderCredentials(ctx context.Context) error

func (*TxAuthorizer) InvalidateRestoredExternalCredentials

func (a *TxAuthorizer) InvalidateRestoredExternalCredentials(ctx context.Context, now time.Time) error

func (*TxAuthorizer) ListDeveloperCredentials

func (a *TxAuthorizer) ListDeveloperCredentials(ctx context.Context) ([]DeveloperCredential, error)

func (*TxAuthorizer) ListOAuth2Providers

func (a *TxAuthorizer) ListOAuth2Providers(ctx context.Context) ([]OAuth2Provider, error)

func (*TxAuthorizer) ListProviders

func (a *TxAuthorizer) ListProviders(ctx context.Context) ([]OIDCProvider, error)

ListProviders lists every configured provider.

func (*TxAuthorizer) ListRemotePairingInvites

func (a *TxAuthorizer) ListRemotePairingInvites(ctx context.Context) ([]RemotePairingInvite, error)

func (*TxAuthorizer) ListSAMLProviders

func (a *TxAuthorizer) ListSAMLProviders(ctx context.Context) ([]SAMLProvider, error)

ListSAMLProviders lists all configured SAML providers.

func (*TxAuthorizer) LiveAccessGrants

func (a *TxAuthorizer) LiveAccessGrants(ctx context.Context, p domain.PrincipalID, now time.Time) ([]AccessGrant, error)

LiveAccessGrants lists a principal's unexpired temporary grants.

func (*TxAuthorizer) LiveMachineCredentialCount

func (a *TxAuthorizer) LiveMachineCredentialCount(ctx context.Context, serviceAccountID string, epoch int64, now time.Time) (int64, error)

func (*TxAuthorizer) LiveMachineCredentialCounts

func (a *TxAuthorizer) LiveMachineCredentialCounts(ctx context.Context, scope domain.Scope, epoch int64, now time.Time) (map[string]int64, error)

func (*TxAuthorizer) LockCredentialPolicy

func (a *TxAuthorizer) LockCredentialPolicy(ctx context.Context) error

LockCredentialPolicy serializes a mint against a concurrent tightening.

func (*TxAuthorizer) LockInstanceIdentityRow

func (a *TxAuthorizer) LockInstanceIdentityRow(ctx context.Context) error

func (*TxAuthorizer) LockMachinePrincipal

func (a *TxAuthorizer) LockMachinePrincipal(ctx context.Context, p domain.PrincipalID) error

LockMachinePrincipal takes a service account's principal-row lock — THE SAME LOCK the grant writers take — so a mint and a grant landing on that principal serialize. Without it a grant can widen the account between the mint's post-state check and its insert, producing a token whose authority never passed the gate.

func (*TxAuthorizer) LockOAuth2ProviderForDelete

func (a *TxAuthorizer) LockOAuth2ProviderForDelete(ctx context.Context, id string) error

func (*TxAuthorizer) LockProviderForDelete

func (a *TxAuthorizer) LockProviderForDelete(ctx context.Context, id string) error

LockProviderForDelete locks the provider row inside the delete tx so the session sweep runs with the row held and a concurrent mint guard serializes behind it (A14). ErrNotFound means a concurrent delete already removed it.

func (*TxAuthorizer) LockSAMLProviderForDelete

func (a *TxAuthorizer) LockSAMLProviderForDelete(ctx context.Context, id string) error

LockSAMLProviderForDelete serializes provider deletion against Phase-C mints.

func (*TxAuthorizer) LockTargetPrincipal

func (a *TxAuthorizer) LockTargetPrincipal(ctx context.Context, p domain.PrincipalID) error

LockTargetPrincipal takes the target principal's row lock so the org-bounded test and every grant mutation serialize on the same row (B14).

func (*TxAuthorizer) LockWorkspaceOrigin

func (a *TxAuthorizer) LockWorkspaceOrigin(ctx context.Context, origin string) (bool, error)

LockWorkspaceOrigin and LockInstanceIdentityRow are the two row locks the serving side's read-then-write decisions serialize on under postgres' READ COMMITTED semantics.

func (*TxAuthorizer) LockoutRetentions

func (a *TxAuthorizer) LockoutRetentions(ctx context.Context) ([]LockoutRetention, error)

LockoutRetentions lists every `lockout-retention` origin in the instance, which is what the deterministic cure sweep walks (#73 §2.4).

func (*TxAuthorizer) LockoutRetentionsInOrg

func (a *TxAuthorizer) LockoutRetentionsInOrg(ctx context.Context, org domain.OrgID) ([]LockoutRetention, error)

LockoutRetentionsInOrg is the org-bounded cure sweep.

func (*TxAuthorizer) LoginChallengeByID

func (a *TxAuthorizer) LoginChallengeByID(ctx context.Context, id string) (LoginChallenge, error)

LoginChallengeByID resolves a login challenge, or domain.ErrNotFound.

func (*TxAuthorizer) MachineCredentialsFor

func (a *TxAuthorizer) MachineCredentialsFor(ctx context.Context, serviceAccountID string) ([]MachineCredential, error)

func (*TxAuthorizer) MachineRevealOptIn

func (a *TxAuthorizer) MachineRevealOptIn(ctx context.Context, caller Identity, project domain.ProjectID) (bool, int64, error)

MachineRevealOptIn reports the project's machine-reveal opt-in for callers that project grants per key (the delivery path) rather than per formula, together with the opt-in's GENERATION - a counter every flip advances, so a cursor bound to it moves on every flip (machine-identities ADR: "any authorization movement invalidates the cursor", naming the opt-in change), including for a principal whose grant rows make the flip invisible and across an off-on-off pair between two polls. A machine identity without the opt-in is delivered secret presence only, whatever reveal rows it holds. Humans always answer true at generation 0: the flag governs machine disclosure and nothing else.

func (*TxAuthorizer) ManageMembersHolders

func (a *TxAuthorizer) ManageMembersHolders(ctx context.Context, org string) ([]domain.PrincipalID, error)

ManageMembersHolders is the lockout invariant's census at one org, or at instance scope when org is empty.

func (*TxAuthorizer) MarkSAMLSPKeyRetiring

func (a *TxAuthorizer) MarkSAMLSPKeyRetiring(ctx context.Context, id string, rowVersion int64) (bool, error)

MarkSAMLSPKeyRetiring compare-and-swaps an active key into overlap state.

func (*TxAuthorizer) MintAuthority

func (a *TxAuthorizer) MintAuthority(ctx context.Context, n NewCredentialAuthority) error

MintAuthority writes a new credential-establishment authority.

func (*TxAuthorizer) MintInstanceConnection

func (a *TxAuthorizer) MintInstanceConnection(ctx context.Context, n authn.NewInstanceConnection) error

func (*TxAuthorizer) MintSession

func (a *TxAuthorizer) MintSession(ctx context.Context, s NewSession) error

MintSession writes a session row.

func (*TxAuthorizer) OAuth2ProviderBySlug

func (a *TxAuthorizer) OAuth2ProviderBySlug(ctx context.Context, slug string) (OAuth2Provider, error)

func (*TxAuthorizer) OAuth2ProviderForCallback

func (a *TxAuthorizer) OAuth2ProviderForCallback(ctx context.Context, id string) (OAuth2Provider, error)

func (*TxAuthorizer) OAuth2TransactionByState

func (a *TxAuthorizer) OAuth2TransactionByState(ctx context.Context, stateVerifier []byte) (OAuth2Transaction, error)

func (*TxAuthorizer) OIDCTransactionByState

func (a *TxAuthorizer) OIDCTransactionByState(ctx context.Context, stateVerifier []byte) (OIDCTransaction, error)

OIDCTransactionByState resolves a transaction by its state verifier.

func (*TxAuthorizer) OpenReauthWindow

func (a *TxAuthorizer) OpenReauthWindow(ctx context.Context, w NewReauthWindow) error

OpenReauthWindow opens a reauthentication window over one environment.

func (*TxAuthorizer) OrgsForPrincipal

func (a *TxAuthorizer) OrgsForPrincipal(ctx context.Context, caller Identity) ([]OrgIdentity, error)

OrgsForPrincipal projects the caller's OWN grants onto the organisations they name. It authorizes nothing and needs no proof: the result set is defined by the caller's own grant rows, so it can disclose nothing they do not already hold. See the resolver for why an instance-scoped principal correctly gets an empty set. Protected instance configuration additionally requires the caller's current MFA assurance before its org enters navigation.

func (*TxAuthorizer) PasswordCredentialFor

func (a *TxAuthorizer) PasswordCredentialFor(ctx context.Context, accountID string) (PasswordCredential, error)

PasswordCredentialFor reads an account's verifier row.

func (*TxAuthorizer) PeekDeveloperCredentialPolicy

func (a *TxAuthorizer) PeekDeveloperCredentialPolicy(ctx context.Context) (time.Duration, error)

func (*TxAuthorizer) PendingDenials

func (a *TxAuthorizer) PendingDenials() []Denial

PendingDenials hands the attempt's captured denials to the transaction package. The authorizer lives exactly one attempt, so there is no reset.

func (*TxAuthorizer) PendingTOTP

func (a *TxAuthorizer) PendingTOTP(ctx context.Context, accountID string) (TOTPCredential, error)

PendingTOTP resolves an account's in-progress enrolment.

func (*TxAuthorizer) PinGeneration

func (a *TxAuthorizer) PinGeneration(ctx context.Context, p domain.PrincipalID, env domain.EnvID) (int64, error)

PinGeneration reads the conditional cursor's pin component.

func (*TxAuthorizer) PollCLILogin

func (a *TxAuthorizer) PollCLILogin(ctx context.Context, id string, at time.Time, interval int64) error

func (*TxAuthorizer) PrincipalClass

PrincipalClass resolves a principal's class for the normative machine allowlists.

func (*TxAuthorizer) PrincipalGeneration

func (a *TxAuthorizer) PrincipalGeneration(ctx context.Context, p domain.PrincipalID) (int64, error)

PrincipalGeneration reads the principal's current session generation, so a freshly minted session records the generation it was born under.

func (*TxAuthorizer) PrivacyAccount

func (a *TxAuthorizer) PrivacyAccount(ctx context.Context, p string) (PrivacyAccountView, error)

func (*TxAuthorizer) PrivacyActivity

func (a *TxAuthorizer) PrivacyActivity(ctx context.Context, p string) ([]PrivacyActivity, error)

func (*TxAuthorizer) PrivacySessions

func (a *TxAuthorizer) PrivacySessions(ctx context.Context, p string) ([]PrivacySession, error)

func (*TxAuthorizer) ProjectMachineReveal

func (a *TxAuthorizer) ProjectMachineReveal(ctx context.Context, projectID string) (authn.MachineRevealState, error)

ProjectMachineReveal reads the per-project machine-reveal opt-in (source-of-truth ADR). ErrNotFound for an unknown project.

func (*TxAuthorizer) ProviderBySlug

func (a *TxAuthorizer) ProviderBySlug(ctx context.Context, slug string) (OIDCProvider, error)

ProviderBySlug resolves a provider by slug for administration (any state). The mutation that follows is authorized at the chokepoint first.

func (*TxAuthorizer) ProviderForCallback

func (a *TxAuthorizer) ProviderForCallback(ctx context.Context, id string) (OIDCProvider, error)

ProviderForCallback resolves the provider a transaction pinned, by id.

func (*TxAuthorizer) PruneCLILogins

func (a *TxAuthorizer) PruneCLILogins(ctx context.Context, at time.Time) error

func (*TxAuthorizer) PruneExpiredRegistrationSignup

func (a *TxAuthorizer) PruneExpiredRegistrationSignup(ctx context.Context, id string, at time.Time) (bool, error)

func (*TxAuthorizer) PruneRemotePairingState

func (a *TxAuthorizer) PruneRemotePairingState(ctx context.Context, now time.Time) error

func (*TxAuthorizer) ReactivateBinding

func (a *TxAuthorizer) ReactivateBinding(ctx context.Context, id string, at time.Time) (bool, error)

ReactivateBinding records a restore-time re-validation (§ Restore). #76 owns the operator ceremony; the write exists here because the refusal it drives exists now.

func (*TxAuthorizer) ReauthWindowFor

func (a *TxAuthorizer) ReauthWindowFor(ctx context.Context, sessionID, environmentID string) (ReauthWindow, error)

ReauthWindowFor resolves the window over one environment for one session.

func (*TxAuthorizer) RebindSAMLExternalIdentityProvider

func (a *TxAuthorizer) RebindSAMLExternalIdentityProvider(ctx context.Context, id, expectedProviderID, newProviderID string) (bool, error)

RebindSAMLExternalIdentityProvider compare-and-swaps provider provenance after the same byte-exact entity has been removed and configured again.

func (*TxAuthorizer) ReconcilePrincipal

func (a *TxAuthorizer) ReconcilePrincipal(ctx context.Context, p domain.PrincipalID) (bool, error)

ReconcilePrincipal commits ONE principal's reconciliation. The signature is the guarantee: one id in, one answer out. There is no set-taking sibling of this method anywhere in the module, and the drill asserts that.

func (*TxAuthorizer) RecordAuthEvent

func (a *TxAuthorizer) RecordAuthEvent(ctx context.Context, e audit.Event) error

RecordAuthEvent writes an authentication audit event through the resolution surface's proof-free path. Authentication events cannot carry a proof: they are what produces the principal a proof would be minted for, and credential establishment deliberately produces no session at all.

The event commits with the transaction that caused it, so a login without its durable record does not complete — the same durability discipline domain writes follow.

func (*TxAuthorizer) RecordedPrincipalHolds

func (a *TxAuthorizer) RecordedPrincipalHolds(ctx context.Context, caller Identity,
	principal domain.PrincipalID, op Operation, scope domain.Scope) (bool, error)

RecordedPrincipalHolds checks the grant formula for a principal recorded as authority on a standing delegation. It deliberately does not synthesize a caller identity or apply session policy: the principal is not the caller, and the delegation's own fetch path records the decision and its outcome.

func (*TxAuthorizer) RecoveryCodesFor

func (a *TxAuthorizer) RecoveryCodesFor(ctx context.Context, accountID string) (RecoveryBatch, error)

RecoveryCodesFor resolves an account's batch.

func (*TxAuthorizer) RegistrationAuthorityHolds

func (a *TxAuthorizer) RegistrationAuthorityHolds(ctx context.Context, principal domain.PrincipalID, op Operation, scope domain.Scope) (bool, error)

RegistrationAuthorityHolds re-checks a policy's standing delegation (#579 d4): does the recorded authority principal's CURRENT grant set satisfy op's formula at scope? It is a pure evaluation. It records no operation and no denial, because it runs where no caller is acting as that principal (the Members panel render, the public sign-up door); the principal comes from the policy row, never from the request, so it is not the unaudited "what can THEY do?" oracle CallerHolds refuses to be. A sign-up that acts on the answer records its own refusal cause.

Instance operations evaluate against the empty scope (authorizeInstance's shape); tenant operations resolve the chain first, and an unresolvable scope holds nothing.

func (*TxAuthorizer) RegistrationPolicyFor

func (a *TxAuthorizer) RegistrationPolicyFor(ctx context.Context, org domain.OrgID) (RegistrationPolicy, error)

RegistrationPolicyFor resolves the policy of one scope ("" = instance).

func (*TxAuthorizer) RegistrationSignupByEmail

func (a *TxAuthorizer) RegistrationSignupByEmail(ctx context.Context, email string) (RegistrationSignup, error)

func (*TxAuthorizer) RegistrationSignupByVerifier

func (a *TxAuthorizer) RegistrationSignupByVerifier(ctx context.Context, verifier []byte) (RegistrationSignup, error)

func (*TxAuthorizer) RegistrationSignupsForPolicy

func (a *TxAuthorizer) RegistrationSignupsForPolicy(ctx context.Context, policyID string) ([]RegistrationSignupRef, error)

RegistrationSignupsForPolicy lists a policy's pending local sign-ups.

func (*TxAuthorizer) ReissueRegistrationSignup

func (a *TxAuthorizer) ReissueRegistrationSignup(ctx context.Context, n NewRegistrationSignup) error

func (*TxAuthorizer) ReleaseGrantOrigin

func (a *TxAuthorizer) ReleaseGrantOrigin(ctx context.Context, grantID string, p domain.PrincipalID, o Origin) (bool, error)

ReleaseGrantOrigin releases one origin, reporting whether it held the row.

func (*TxAuthorizer) RemotePairedConnectionByID

func (a *TxAuthorizer) RemotePairedConnectionByID(ctx context.Context, id string) (RemotePairedConnection, error)

func (*TxAuthorizer) RemotePairingExchangeByID

func (a *TxAuthorizer) RemotePairingExchangeByID(ctx context.Context, id string) (RemotePairingExchange, error)

func (*TxAuthorizer) RemotePairingInviteByCapability

func (a *TxAuthorizer) RemotePairingInviteByCapability(ctx context.Context, v []byte) (RemotePairingInvite, error)

func (*TxAuthorizer) RemotePairingInviteByID

func (a *TxAuthorizer) RemotePairingInviteByID(ctx context.Context, id string) (RemotePairingInvite, error)

func (*TxAuthorizer) RemoveExternalIdentity

func (a *TxAuthorizer) RemoveExternalIdentity(ctx context.Context, id string) error

RemoveExternalIdentity removes a link (unlink).

func (*TxAuthorizer) RemoveTOTPForAccount

func (a *TxAuthorizer) RemoveTOTPForAccount(ctx context.Context, accountID string) error

RemoveTOTPForAccount deletes every TOTP row of an account.

func (*TxAuthorizer) RemoveWorkspaceOrigin

func (a *TxAuthorizer) RemoveWorkspaceOrigin(ctx context.Context, origin string) (bool, error)

RemoveWorkspaceOrigin and RevokeWorkspaceSessionsForOrigin are ONE ACT in two statements and must be called in one transaction. That pairing is the ADR's atomic kill switch; splitting it leaves a window in which an origin is de-allowlisted and its sessions still authenticate.

func (*TxAuthorizer) ReplacePasswordCredential

func (a *TxAuthorizer) ReplacePasswordCredential(ctx context.Context, c PasswordCredential, at time.Time) (bool, error)

ReplacePasswordCredential compare-and-swaps an existing verifier. False means the row moved underneath and the caller must not write a stale verifier back.

func (*TxAuthorizer) ReplaceRecoveryCodes

func (a *TxAuthorizer) ReplaceRecoveryCodes(ctx context.Context, b RecoveryBatch, at time.Time) (bool, error)

ReplaceRecoveryCodes compare-and-swaps the batch; false means it moved.

func (*TxAuthorizer) ReplaceRegistrationPolicy

func (a *TxAuthorizer) ReplaceRegistrationPolicy(ctx context.Context, p RegistrationPolicy, expected int64) (bool, error)

ReplaceRegistrationPolicy compare-and-swaps a policy and replaces its children.

func (*TxAuthorizer) ResolveChain

func (a *TxAuthorizer) ResolveChain(ctx context.Context, scope domain.Scope) (domain.Scope, error)

ResolveChain answers "is this (org, project, environment) a real chain" — the same single-query resolution authorize() itself performs, exposed for the one caller that must ask about a scope it is NOT currently authorizing: a SCIM mapping row names a scope at AUTHORING time and expands it at every sync, and a row whose environment does not belong to its project would write grants against a chain that never existed. It mints no proof and reveals nothing a caller could not learn by addressing the scope: an unresolvable chain answers domain.ErrNotFound uniformly, whether the link is missing or foreign.

func (*TxAuthorizer) RestoreState

func (a *TxAuthorizer) RestoreState(ctx context.Context) (RestoreState, error)

RestoreState reads the instance's restore posture.

func (*TxAuthorizer) RestrictPrivacyPrincipal

func (a *TxAuthorizer) RestrictPrivacyPrincipal(ctx context.Context, p, state string) error

func (*TxAuthorizer) RevokeAllSessionsFor

func (a *TxAuthorizer) RevokeAllSessionsFor(ctx context.Context, p domain.PrincipalID) error

RevokeAllSessionsFor deletes every session of a principal.

func (*TxAuthorizer) RevokeDeveloperCredentials

func (a *TxAuthorizer) RevokeDeveloperCredentials(ctx context.Context, authority domain.PrincipalID, scope domain.Scope, id string, at time.Time) ([]DeveloperCredential, error)

func (*TxAuthorizer) RevokeDeveloperCredentialsByProvenance

func (a *TxAuthorizer) RevokeDeveloperCredentialsByProvenance(ctx context.Context, kind, id string, at time.Time) ([]DeveloperCredential, error)

func (*TxAuthorizer) RevokeInstanceConnection

func (a *TxAuthorizer) RevokeInstanceConnection(ctx context.Context, id string, at time.Time) (bool, error)

func (*TxAuthorizer) RevokeInvalidDeveloperCredentials

func (a *TxAuthorizer) RevokeInvalidDeveloperCredentials(ctx context.Context, authority domain.PrincipalID, org domain.OrgID, at time.Time) ([]DeveloperCredential, error)

func (*TxAuthorizer) RevokeMachineCredential

func (a *TxAuthorizer) RevokeMachineCredential(ctx context.Context, serviceAccountID, id string, at time.Time) (bool, error)

func (*TxAuthorizer) RevokeRemotePairingInvite

func (a *TxAuthorizer) RevokeRemotePairingInvite(ctx context.Context, id string, now time.Time) (bool, error)

func (*TxAuthorizer) RevokeSession

func (a *TxAuthorizer) RevokeSession(ctx context.Context, id string) error

RevokeSession deletes one session in this transaction.

func (*TxAuthorizer) RevokeSessionForPrincipal

func (a *TxAuthorizer) RevokeSessionForPrincipal(ctx context.Context, id string, p domain.PrincipalID) (bool, error)

func (*TxAuthorizer) RevokeWorkspaceSessionsForOrigin

func (a *TxAuthorizer) RevokeWorkspaceSessionsForOrigin(ctx context.Context, origin string) (int64, error)

func (*TxAuthorizer) RotateSessionFactors

func (a *TxAuthorizer) RotateSessionFactors(ctx context.Context, id string, verifier []byte, factors string) error

RotateSessionFactors rotates the acting session token and rewrites its factor set on step-up, preserving the original authentication attribution.

func (*TxAuthorizer) RuleCapabilityHeld

func (a *TxAuthorizer) RuleCapabilityHeld(ctx context.Context, caller Identity, target domain.Rule, project domain.ProjectID) (bool, error)

RuleCapabilityHeld is the grantor bound. A selector may not confer a capability beyond the grantor's own reach, including future objects on an all-except axis. This is separate from the management proof: possessing Manage access never implies Reveal or Publish.

func (*TxAuthorizer) RuleIDsForEnvironment

func (a *TxAuthorizer) RuleIDsForEnvironment(ctx context.Context, s domain.Scope) ([]string, error)

func (*TxAuthorizer) RuleIDsForKey

func (a *TxAuthorizer) RuleIDsForKey(ctx context.Context, s domain.Scope, keyID string) ([]string, error)

func (*TxAuthorizer) RuleIDsForOrg

func (a *TxAuthorizer) RuleIDsForOrg(ctx context.Context, org domain.OrgID) ([]string, error)

func (*TxAuthorizer) RuleIDsForProject

func (a *TxAuthorizer) RuleIDsForProject(ctx context.Context, s domain.Scope) ([]string, error)

func (*TxAuthorizer) RuleKeyExists

func (a *TxAuthorizer) RuleKeyExists(ctx context.Context, s domain.Scope, keyID string) error

RuleKeyExists reports ErrNotFound unless the key id exists in the project scope names; the rule writer uses it to refuse a dangling key item clearly.

func (*TxAuthorizer) RuleLinesInOrg

func (a *TxAuthorizer) RuleLinesInOrg(ctx context.Context, org domain.OrgID) ([]RuleLine, error)

RuleLinesInOrg lists the rule surface for one org.

func (*TxAuthorizer) RuleLinesInProject

func (a *TxAuthorizer) RuleLinesInProject(ctx context.Context, s domain.Scope) ([]RuleLine, error)

RuleLinesInProject lists the rule surface for one project, reading only that project's items.

func (*TxAuthorizer) RulesForProject

func (a *TxAuthorizer) RulesForProject(ctx context.Context, org domain.OrgID, project domain.ProjectID) ([]domain.Rule, error)

RulesForProject is the folder-move widening census: every rule of a human principal naming this project, a superset of what the chokepoint honours (a currently restricted principal is still named).

func (*TxAuthorizer) RulesManageable

func (a *TxAuthorizer) RulesManageable(ctx context.Context, caller Identity, targets []domain.Rule, project domain.ProjectID) ([]bool, error)

RulesManageable evaluates a listing against one live authorization snapshot. Key metadata is shared only inside this call, never across later mutations.

func (*TxAuthorizer) SAMLProviderBySlug

func (a *TxAuthorizer) SAMLProviderBySlug(ctx context.Context, slug string) (SAMLProvider, error)

SAMLProviderBySlug resolves a provider in any state for administration.

func (*TxAuthorizer) SAMLProviderForCallback

func (a *TxAuthorizer) SAMLProviderForCallback(ctx context.Context, id string) (SAMLProvider, error)

SAMLProviderForCallback resolves the provider pinned by a transaction.

func (*TxAuthorizer) SAMLSPKeys

func (a *TxAuthorizer) SAMLSPKeys(ctx context.Context) ([]SAMLSPKey, error)

SAMLSPKeys lists active and overlap-retiring public material.

func (*TxAuthorizer) SAMLTransactionByRelayState

func (a *TxAuthorizer) SAMLTransactionByRelayState(ctx context.Context, verifier []byte) (SAMLTransaction, error)

SAMLTransactionByRelayState resolves the opaque front-channel handle before the strict wrapper's single response-validation pass.

func (*TxAuthorizer) SCIMCredentialByVerifier

func (a *TxAuthorizer) SCIMCredentialByVerifier(ctx context.Context, presented []byte) (SCIMCredential, error)

func (*TxAuthorizer) ScopedSystemAuthority

func (a *TxAuthorizer) ScopedSystemAuthority(ctx context.Context, site SystemSite, scope domain.Scope) (Proof, error)

ScopedSystemAuthority mints system authority carrying a database-resolved tenant chain. It exists for system jobs whose durable audit rows belong to the acted-on tenant trail: callers may supply identifiers, but the proof carries only the canonical chain resolved inside this transaction.

func (*TxAuthorizer) SelfConfigRecoveryAuthority

func (a *TxAuthorizer) SelfConfigRecoveryAuthority(ctx context.Context, revision int64) (Proof, error)

SelfConfigRecoveryAuthority is a host-local, exact-revision recovery reader. It cannot use the runtime worker's retained-root privilege as a general read.

func (*TxAuthorizer) SelfConfigRuntimeAuthority

func (a *TxAuthorizer) SelfConfigRuntimeAuthority(ctx context.Context, snapshotID string) (Proof, error)

SelfConfigRuntimeAuthority selects only the local binding's retained snapshot. No network operation can mint this authority, even with valid admin grants. An empty snapshot ID selects the durable desired revision.

func (*TxAuthorizer) SelfConfigSeedAuthority

func (a *TxAuthorizer) SelfConfigSeedAuthority(ctx context.Context) (Proof, error)

SelfConfigSeedAuthority is the boot worker's encrypted-input exchange before adoption. The repository refuses access once a binding exists. Network callers use their ordinary MFA-protected adoption proof for preview reads; they cannot mint this writer or replace another node's startup inputs.

func (*TxAuthorizer) ServiceAccountAt

func (a *TxAuthorizer) ServiceAccountAt(ctx context.Context, scope domain.Scope, id string) (ServiceAccount, error)

ServiceAccountAt resolves one service account within an addressed project; an id from another project answers domain.ErrNotFound.

func (*TxAuthorizer) ServiceAccountByPrincipal

func (a *TxAuthorizer) ServiceAccountByPrincipal(ctx context.Context, p domain.PrincipalID) (ServiceAccount, error)

ServiceAccountByPrincipal resolves the service account a machine principal is, for the grant surface's subtree confinement.

func (*TxAuthorizer) ServiceAccountsIn

func (a *TxAuthorizer) ServiceAccountsIn(ctx context.Context, scope domain.Scope) ([]ServiceAccount, error)

func (*TxAuthorizer) SessionsForPrincipal

func (a *TxAuthorizer) SessionsForPrincipal(ctx context.Context, p domain.PrincipalID) ([]authn.SessionSummary, error)

SessionsForPrincipal and RevokeSessionForPrincipal are the self-scoped active-session surface (#71 criterion 5). The principal conjunct is in the SQL, so one caller structurally cannot reach another's row.

func (*TxAuthorizer) SetClock

func (a *TxAuthorizer) SetClock(now time.Time)

SetClock fixes the instant time-bound grants are evaluated against for the rest of this transaction. The service layer's authorize prelude sets it from the service clock, so expiry is judged by one clock per operation. Zero restores wall-clock evaluation at each lookup.

func (*TxAuthorizer) SetCredentialPolicy

func (a *TxAuthorizer) SetCredentialPolicy(ctx context.Context, p CredentialPolicy, actor domain.PrincipalID, at time.Time) error

func (*TxAuthorizer) SetDeveloperCredentialPolicy

func (a *TxAuthorizer) SetDeveloperCredentialPolicy(ctx context.Context, d time.Duration) error

func (*TxAuthorizer) SetLocalAccountEmail

func (a *TxAuthorizer) SetLocalAccountEmail(ctx context.Context, id, email string, at time.Time) error

func (*TxAuthorizer) SetPinGeneration

func (a *TxAuthorizer) SetPinGeneration(ctx context.Context, p domain.PrincipalID, env domain.EnvID, generation int64) error

SetPinGeneration advances it. #52 owns pin creation, reassignment and release.

func (*TxAuthorizer) SetWebAuthnUserHandle

func (a *TxAuthorizer) SetWebAuthnUserHandle(ctx context.Context, accountID string, handle []byte) (bool, error)

SetWebAuthnUserHandle sets the opaque handle once; false means one already exists (the caller reads it back rather than rotating).

func (*TxAuthorizer) SlideReauthWindow

func (a *TxAuthorizer) SlideReauthWindow(ctx context.Context, id string, windowExpires time.Time) (bool, error)

SlideReauthWindow advances a sliding window's idle clock; false means the row moved and the caller must not extend it.

func (*TxAuthorizer) SlideSession

func (a *TxAuthorizer) SlideSession(ctx context.Context, id string, seen, idleExpires time.Time) error

SlideSession advances the idle clock only. The absolute lifetime is never extended by activity — two independent clocks is the design.

func (*TxAuthorizer) StampCredentialEstablish

func (a *TxAuthorizer) StampCredentialEstablish(ctx context.Context, sessionID, identityID string, expires time.Time) error

func (*TxAuthorizer) StrandedRevealPrincipals

func (a *TxAuthorizer) StrandedRevealPrincipals(ctx context.Context, org, project, env string) ([]domain.PrincipalID, error)

StrandedRevealPrincipals enumerates the reveal-holding principals a 0 effective window would strand on the given environment chain (B6).

func (*TxAuthorizer) SweepExpiredWorkspaceHandoffs

func (a *TxAuthorizer) SweepExpiredWorkspaceHandoffs(ctx context.Context, before time.Time) (int64, error)

func (*TxAuthorizer) SweepSessionsForProvider

func (a *TxAuthorizer) SweepSessionsForProvider(ctx context.Context, providerID string) (int64, error)

SweepSessionsForProvider deletes every session minted through a provider and returns the count for audit (A4).

func (*TxAuthorizer) SweepSessionsForSAMLProvider

func (a *TxAuthorizer) SweepSessionsForSAMLProvider(ctx context.Context, providerID string) (int64, error)

SweepSessionsForSAMLProvider deletes all sessions minted through a SAML IdP.

func (*TxAuthorizer) SweepSessionsForWebAuthnCredential

func (a *TxAuthorizer) SweepSessionsForWebAuthnCredential(ctx context.Context, credentialID string) (int64, error)

SweepSessionsForWebAuthnCredential deletes every session a passkey login minted through a credential and returns the count for audit (B9 clone sweep).

func (*TxAuthorizer) Token

func (a *TxAuthorizer) Token() *TxToken

Token exposes the attempt's transaction identity to the enumerated system mint sites (boot's keyring reads and writes), which have no principal to authorize and therefore call SystemAuthority instead of Authorize. A token alone authorizes nothing — minting the proof is what is privileged, and SystemAuthority checks the site registry.

func (*TxAuthorizer) TouchInstanceConnection

func (a *TxAuthorizer) TouchInstanceConnection(ctx context.Context, id string, at time.Time) error

func (*TxAuthorizer) TouchMachineCredential

func (a *TxAuthorizer) TouchMachineCredential(ctx context.Context, id string, at time.Time) error

func (*TxAuthorizer) TouchSCIMCredential

func (a *TxAuthorizer) TouchSCIMCredential(ctx context.Context, id string, at time.Time) error

func (*TxAuthorizer) UnreconciledPrincipals

func (a *TxAuthorizer) UnreconciledPrincipals(ctx context.Context) ([]PrincipalRef, error)

UnreconciledPrincipals lists who is still inert.

func (*TxAuthorizer) UpdateAccountProfile

func (a *TxAuthorizer) UpdateAccountProfile(ctx context.Context, accountID string, profile AccountProfile) error

func (*TxAuthorizer) UpdateFederationIssuer

func (a *TxAuthorizer) UpdateFederationIssuer(ctx context.Context, id string, source jwkssource.KeySource, refused []string, caBundle string, actor domain.PrincipalID, at time.Time) (bool, error)

func (*TxAuthorizer) UpdateOAuth2Provider

func (a *TxAuthorizer) UpdateOAuth2Provider(ctx context.Context, u OAuth2ProviderUpdate) (bool, error)

func (*TxAuthorizer) UpdateProvider

func (a *TxAuthorizer) UpdateProvider(ctx context.Context, u ProviderUpdate) (bool, error)

UpdateProvider compare-and-swaps a provider; false means the row moved.

func (*TxAuthorizer) UpdateRequestRefusals

func (a *TxAuthorizer) UpdateRequestRefusals(ctx context.Context, sample *audit.RefusalSample) (int64, error)

func (*TxAuthorizer) UpdateSAMLProvider

func (a *TxAuthorizer) UpdateSAMLProvider(ctx context.Context, provider SAMLProviderUpdate) (bool, error)

UpdateSAMLProvider compare-and-swaps a provider configuration.

func (*TxAuthorizer) VerifiedAccountEmailExists

func (a *TxAuthorizer) VerifiedAccountEmailExists(ctx context.Context, email string) (bool, error)

func (*TxAuthorizer) WebAuthnCeremonyByChallenge

func (a *TxAuthorizer) WebAuthnCeremonyByChallenge(ctx context.Context, challengeVerifier []byte) (WebAuthnCeremony, error)

WebAuthnCeremonyByChallenge resolves a ceremony by its challenge verifier.

func (*TxAuthorizer) WebAuthnCeremonyByID

func (a *TxAuthorizer) WebAuthnCeremonyByID(ctx context.Context, id string) (WebAuthnCeremony, error)

WebAuthnCeremonyByID resolves a ceremony by id, for single-decision window unit matching at disclosure.

func (*TxAuthorizer) WebAuthnCredentialByCredentialID

func (a *TxAuthorizer) WebAuthnCredentialByCredentialID(ctx context.Context, credentialID []byte) (WebAuthnCredential, error)

WebAuthnCredentialByCredentialID resolves the row a passkey assertion names.

func (*TxAuthorizer) WebAuthnCredentialByID

func (a *TxAuthorizer) WebAuthnCredentialByID(ctx context.Context, id string) (WebAuthnCredential, error)

WebAuthnCredentialByID resolves a credential by its surrogate id.

func (*TxAuthorizer) WebAuthnCredentialsForAccount

func (a *TxAuthorizer) WebAuthnCredentialsForAccount(ctx context.Context, accountID string) ([]WebAuthnCredential, error)

WebAuthnCredentialsForAccount lists an account's passkeys.

func (*TxAuthorizer) WebAuthnUserHandle

func (a *TxAuthorizer) WebAuthnUserHandle(ctx context.Context, accountID string) ([]byte, error)

WebAuthnUserHandle reads an account's opaque handle, or nil when unset.

func (*TxAuthorizer) WorkloadPinState

func (a *TxAuthorizer) WorkloadPinState(ctx context.Context, p domain.PrincipalID, env domain.EnvID) (WorkloadPinState, error)

WorkloadPinState reads the conditional reveal-history admission fact.

func (*TxAuthorizer) WorkspaceHandoffByCode

func (a *TxAuthorizer) WorkspaceHandoffByCode(ctx context.Context, verifier []byte) (authn.WorkspaceHandoff, error)

func (*TxAuthorizer) WorkspaceHandoffByState

func (a *TxAuthorizer) WorkspaceHandoffByState(ctx context.Context, verifier []byte) (authn.WorkspaceHandoff, error)

func (*TxAuthorizer) WorkspaceOriginAllowed

func (a *TxAuthorizer) WorkspaceOriginAllowed(ctx context.Context, origin string) (bool, error)

func (*TxAuthorizer) WorkspaceOrigins

func (a *TxAuthorizer) WorkspaceOrigins(ctx context.Context) ([]authn.WorkspaceOrigin, error)

func (*TxAuthorizer) WritePasswordCredential

func (a *TxAuthorizer) WritePasswordCredential(ctx context.Context, c PasswordCredential, at time.Time) error

WritePasswordCredential inserts the first verifier for an account.

func (*TxAuthorizer) WriteRecoveryCodes

func (a *TxAuthorizer) WriteRecoveryCodes(ctx context.Context, b RecoveryBatch, at time.Time) error

WriteRecoveryCodes writes the first batch for an account.

type TxToken

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

TxToken is the transaction identity a proof is bound to. The transaction package mints one per transaction attempt and invalidates it at commit or rollback; a proof presented under any other token — a later retry attempt, a different transaction, or after its own transaction ended — dies at the store boundary. Constructing tokens is not privileged (a token without a matching proof authorizes nothing); minting proofs is.

func NewTxToken

func NewTxToken() *TxToken

NewTxToken mints a live transaction identity.

func (*TxToken) Invalidate

func (t *TxToken) Invalidate()

Invalidate marks the transaction ended. Idempotent; only ever tightens.

type WebAuthnCeremony

type WebAuthnCeremony = authn.WebAuthnCeremony

WebAuthnCeremony is a resolved ceremony row.

type WebAuthnCredential

type WebAuthnCredential = authn.WebAuthnCredential

WebAuthnCredential is a resolved registered passkey.

type WorkloadPinState

type WorkloadPinState = authn.WorkloadPinState

Re-exported so the service layer never names the resolution-surface package.

type WorkspaceHandoff

type WorkspaceHandoff = authn.WorkspaceHandoff

The workspace tier's carrier types, re-exported so the service layer never names internal/store/authn — the import-boundary test enforces that the resolution surface is reachable only through this package.

type WorkspaceOrigin

type WorkspaceOrigin = authn.WorkspaceOrigin

The workspace tier's carrier types, re-exported so the service layer never names internal/store/authn — the import-boundary test enforces that the resolution surface is reachable only through this package.

Directories

Path Synopsis
Command gen compiles reviewed authority metadata into static Go.
Command gen compiles reviewed authority metadata into static Go.

Jump to

Keyboard shortcuts

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