Documentation
¶
Overview ¶
Package anonymouspostgres owns primary anonymous lifecycle metadata inside identity's existing coordinator. Kernel and session state keep their owners.
Index ¶
- func CreationFields(subject anonymous.AnonymousSubject) ([]identity.FeatureField, error)
- func CreationSubject(command identity.Command) (anonymous.AnonymousSubject, error)
- func DeletionFields(subject anonymous.AnonymousSubject) ([]identity.FeatureField, error)
- func ExpiryFields(subject anonymous.AnonymousSubject) ([]identity.FeatureField, error)
- func ExpirySubject(c identity.Command) (anonymous.AnonymousSubject, error)
- func NewSessionService(pool *database.Pool, c SessionServiceConfig) (*session.AnonymousSessionService, error)
- func UpgradeFields(p anonymous.MergePlan) ([]identity.FeatureField, error)
- func ValidateUpgradePlan(command identity.Command, plan anonymous.MergePlan) error
- type CleanupConfig
- type CleanupCursor
- type CleanupItem
- type CleanupRequest
- type CleanupResult
- type CleanupService
- func (s *CleanupService) CleanupExpired(ctx context.Context, r CleanupRequest) (out CleanupResult, err error)
- func (s *CleanupService) CleanupSubject(ctx context.Context, r CleanupSubjectRequest) (out CleanupItem, err error)
- func (*CleanupService) Format(f fmt.State, _ rune)
- func (*CleanupService) MarshalJSON() ([]byte, error)
- func (s *CleanupService) RecoverCleanup(ctx context.Context, q identity.RecoveryQuery) (out CleanupItem, err error)
- type CleanupSubjectRequest
- type Config
- type DeletionConfig
- type DeletionService
- func (s *DeletionService) Delete(ctx context.Context, r anonymous.DeletionRequest) (out anonymous.DeletionResult, err error)
- func (s *DeletionService) DeletionRateSource(ctx context.Context, r anonymous.DeletionRequest) (user identity.UserID, err error)
- func (*DeletionService) Format(f fmt.State, _ rune)
- func (*DeletionService) MarshalJSON() ([]byte, error)
- func (s *DeletionService) RecoverDeletion(ctx context.Context, r anonymous.DeletionRecoveryRequest) (out anonymous.DeletionResult, err error)
- type DisposalMigrationSource
- type ExpiryMigrationSource
- type MigrationSource
- type Repository
- func (*Repository) Format(f fmt.State, _ rune)
- func (*Repository) MarshalJSON() ([]byte, error)
- func (*Repository) MarshalText() ([]byte, error)
- func (r *Repository) Read(ctx context.Context, q anonymous.SubjectQuery) (anonymous.AnonymousSubject, error)
- func (r *Repository) RecoverCreation(ctx context.Context, w kernel.RecoveryWork, ...) (kernel.RecoveryStatus, error)
- func (r *Repository) RecoverDisposal(ctx context.Context, w kernel.RecoveryWork, ...) (kernel.RecoveryStatus, error)
- func (r *Repository) RecoverExpiredDisposal(ctx context.Context, w kernel.RecoveryWork, ...) (kernel.RecoveryStatus, error)
- func (r *Repository) RecoverUpgrade(ctx context.Context, w kernel.RecoveryWork, ...) (kernel.RecoveryStatus, error)
- func (r *Repository) RequireCreation(ctx context.Context, w kernel.Work, owner kernel.FeatureExecutionContributor, ...) error
- func (r *Repository) RequireDisposal(ctx context.Context, w kernel.Work, p kernel.FeatureExecutionContributor, ...) error
- func (r *Repository) RequireExpiredDisposal(ctx context.Context, w kernel.Work, p kernel.FeatureExecutionContributor, ...) error
- func (r *Repository) RequireUpgrade(ctx context.Context, w kernel.Work, owner kernel.AnonymousUpgradeContributor, ...) error
- func (r *Repository) StageCreation(ctx context.Context, w kernel.Work, owner kernel.FeatureExecutionContributor, ...) error
- func (r *Repository) StageDisposal(ctx context.Context, w kernel.Work, p kernel.FeatureExecutionContributor, ...) error
- func (r *Repository) StageExpiredDisposal(ctx context.Context, w kernel.Work, p kernel.FeatureExecutionContributor, ...) error
- func (r *Repository) StageUpgrade(ctx context.Context, w kernel.Work, owner kernel.AnonymousUpgradeContributor, ...) error
- type SessionServiceConfig
- type SigninConfig
- type SigninService
- func (SigninService) Format(f fmt.State, _ rune)
- func (SigninService) MarshalJSON() ([]byte, error)
- func (s *SigninService) RecoverSignin(ctx context.Context, r anonymous.SigninRecoveryRequest) (out anonymous.SigninResult, err error)
- func (s *SigninService) Signin(ctx context.Context, r anonymous.SigninRequest) (out anonymous.SigninResult, err error)
- func (s *SigninService) SigninRateSource(ctx context.Context, r anonymous.SigninRequest) (source string, err error)
- type UpgradeConfig
- type UpgradeMigrationSource
- type UpgradeService
- func (*UpgradeService) Format(f fmt.State, _ rune)
- func (*UpgradeService) MarshalJSON() ([]byte, error)
- func (s *UpgradeService) RecoverUpgrade(ctx context.Context, r anonymous.UpgradeRecoveryRequest) (out anonymous.UpgradeResult, err error)
- func (s *UpgradeService) Upgrade(ctx context.Context, r anonymous.UpgradeRequest) (out anonymous.UpgradeResult, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreationFields ¶
func CreationFields(subject anonymous.AnonymousSubject) ([]identity.FeatureField, error)
CreationFields freezes the complete anonymous-owned initial lifecycle before command fingerprinting. Kernel/session fields remain separately owner-mapped. The result contains no bearer or credential and grants no current authority.
func CreationSubject ¶
func CreationSubject(command identity.Command) (anonymous.AnonymousSubject, error)
CreationSubject reconstructs only this owner's original lifecycle projection from the exact closed anonymous command. Missing/extra/foreign fields deny; independent namespaces remain their owners' responsibility. It performs no IO and cannot authenticate a browser, authorize creation or renew expiry.
func DeletionFields ¶
func DeletionFields(subject anonymous.AnonymousSubject) ([]identity.FeatureField, error)
DeletionFields freezes this owner's original lifecycle before fingerprinting. It neither authorizes disposal nor selects retention or kernel/session state.
func ExpiryFields ¶
func ExpiryFields(subject anonymous.AnonymousSubject) ([]identity.FeatureField, error)
ExpiryFields freezes the original lifecycle for the exact service-expiry command. Mapping grants neither maintenance authority nor expiry, retention, kernel or session evidence. The returned fields are caller-owned.
func ExpirySubject ¶
func ExpirySubject(c identity.Command) (anonymous.AnonymousSubject, error)
ExpirySubject reconstructs only the complete original lifecycle in an exact service-expiry command. This pure projection performs no IO, authentication, expiry check or authorization. It cannot convert browser custody into service authority; current owners must fence the command in the coordinator's Work.
func NewSessionService ¶
func NewSessionService(pool *database.Pool, c SessionServiceConfig) (*session.AnonymousSessionService, error)
NewSessionService composes the actual lifecycle, kernel, session and policy primary owners with the existing anonymous-only core validator. Construction has no IO and owns no pool, goroutine, cache, transaction or token. The caller closes its pool only after calls finish. Reads are concurrent-safe, never create a credential reference and return only unprivileged anonymous custody; existing verified-user session APIs remain closed to this method.
func UpgradeFields ¶
func UpgradeFields(p anonymous.MergePlan) ([]identity.FeatureField, error)
UpgradeFields commits the bounded original source, permanent target and canonical typed merge plan before command fingerprinting. It carries no credential or resource payload and grants no authentication/transfer authority. The native owner must retain the complete plan in encrypted preparation; unsupported resource transfers still deny before mutation.
func ValidateUpgradePlan ¶
ValidateUpgradePlan checks exact native command/typed plan agreement without IO, a clock, permission, proof consumption or mutation. Target UserID/ActorID remain distinct from the guest RecordID. Other owner namespaces are untouched.
Types ¶
type CleanupConfig ¶
type CleanupConfig struct {
Repository Config
Sessions sessionpg.Config
GlobalAuthorityID string
ActorID identity.ActorID
ConfigurationID, PolicyID string
MaximumBatch uint32
Clock clock.Clock
Retention *identity.PolicyEvaluator
RetentionPolicyVersion uint64
RequestKeys kernel.RequestKeyConfig
Coordinator kernel.CoordinatorConfig
IntentKey [32]byte
ActiveEnvelopeKeyID string
}
CleanupConfig selects trusted maintenance, not browser authentication. ActorID is fixed by composition; the configured current authorization engine must allow selection on identity.anonymous/expired and individual disposal on identity.anonymous/<user>, in addition to the coordinator's admission/query scopes. Retention runs outside SQL; holds and deferred decisions stay pending. MaximumBatch is 1..1000. ConfigurationID versions callback semantics. Install selected kernel/session/anonymous disposal+expiry and existing request-key preparation histories. Construction never installs or migrates.
func (CleanupConfig) MarshalJSON ¶
func (CleanupConfig) MarshalJSON() ([]byte, error)
func (CleanupConfig) MarshalText ¶
func (CleanupConfig) MarshalText() ([]byte, error)
type CleanupCursor ¶
CleanupCursor is an exclusive indexed seek position, not eligibility or authorization. Eligibility always uses fresh authoritative database time. Advance past deferred subjects using Next, then start a later run from zero to revisit them. Preserve the exact returned expiry and user tie-breaker.
type CleanupItem ¶
type CleanupItem struct {
UserID identity.UserID
Outcome identity.CommitOutcome
Recovery identity.RecoveryQuery
Replayed bool
RetryAfter time.Duration
Error error
}
CleanupItem is historical per-subject metadata, never authentication. Error is populated by batch execution for a deferred or interrupted item. Unknown and InProgress require original recovery, not an invented success/rollback.
func (CleanupItem) MarshalJSON ¶
func (CleanupItem) MarshalJSON() ([]byte, error)
type CleanupRequest ¶
type CleanupRequest struct {
TenantID identity.TenantID
RunID identity.CommandID
Limit uint32
After *CleanupCursor
}
CleanupRequest selects one bounded tenant page. Generate RunID once and keep it across interruption/retry: each selected subject gets an original random command through the existing immutable request-key owner. A batch is NOT one atomic/idempotent receipt: repeating selection can include other still-active expired subjects. Individual results and CleanupSubject retain exact retries. No caller-supplied timestamp, actor, cleanup policy or guest credential exists.
type CleanupResult ¶
type CleanupResult struct {
Items []CleanupItem
Next *CleanupCursor
ObservedAt time.Time
RemainingLag time.Duration
LagKnown bool
}
CleanupResult preserves completed/attempted items even when a later item fails. Next follows the last attempted subject; reconcile unknown work before advancing. LagKnown alone makes RemainingLag meaningful: it observes the tenant's complete active backlog, including held/contended subjects, at ObservedAt and saturates at 8760 hours. It is not a future-empty guarantee.
func (CleanupResult) MarshalJSON ¶
func (CleanupResult) MarshalJSON() ([]byte, error)
type CleanupService ¶
type CleanupService struct {
// contains filtered or unexported fields
}
CleanupService owns bounded explicit maintenance, not a scheduler, background goroutine, pool or second transaction/recovery engine. Immutable composition supports concurrent calls; keep borrowed pool, policies, clock and keys alive.
func NewCleanupService ¶
func NewCleanupService(pool *database.Pool, c CleanupConfig, keys *keyring.Provider) (*CleanupService, error)
NewCleanupService freezes native owners without IO, callbacks or entropy. Expired credentials are never accepted as maintenance authority. Stored retain/anonymize/delete policy and original hold/authority versions survive preparation; every actual owner rechecks them in the same final transaction.
func (*CleanupService) CleanupExpired ¶
func (s *CleanupService) CleanupExpired(ctx context.Context, r CleanupRequest) (out CleanupResult, err error)
CleanupExpired selects at most Limit indexed expired subjects, then executes their independently atomic owner commands. Selection holds no locks across callbacks: original version/expiry/hold fences arbitrate upgrade/deletion races. It stops on unknown/unavailable/cancellation, preserving attempted original queries; policy-denied items remain pending and do not starve later pages when the caller advances Next. No automatic retry or scheduler runs.
func (*CleanupService) CleanupSubject ¶
func (s *CleanupService) CleanupSubject(ctx context.Context, r CleanupSubjectRequest) (out CleanupItem, err error)
CleanupSubject expires one exact subject with original per-run retry custody. Preparation/callbacks occur outside SQL; the existing coordinator alone owns reservation, commit, failure and reconciliation. A terminal retry does not reread a now-disposed subject, renew its deadline or perform disposal twice.
func (*CleanupService) MarshalJSON ¶
func (*CleanupService) MarshalJSON() ([]byte, error)
func (*CleanupService) RecoverCleanup ¶
func (s *CleanupService) RecoverCleanup(ctx context.Context, q identity.RecoveryQuery) (out CleanupItem, err error)
RecoverCleanup reconciles the original command under current service query policy. It restores authenticated input, never live guest authentication or retention admission; missing/corrupt history never establishes rollback.
type CleanupSubjectRequest ¶
type CleanupSubjectRequest struct {
TenantID identity.TenantID
UserID identity.UserID
RunID identity.CommandID
}
CleanupSubjectRequest names a maintenance target and stable run correlation. It grants no authority and cannot dispose a permanent/unexpired/terminal user. Retry the same input after uncertain request-key admission; after a command exists, save its Recovery query. New policy/admission needs a new RunID.
type Config ¶
Config selects an installed dedicated schema and positive primary IO budget of at most one minute. The caller owns pool lifetime and all migration IO.
type DeletionConfig ¶
type DeletionConfig struct {
Repository Config
Sessions sessionpg.Config
Profile sessionpg.AnonymousAdmissionConfig
Validation session.ServiceConfig
CSRFKeys []session.CSRFKey
Origins, Reasons []string
ConfigurationID, PolicyID string
Retention *identity.PolicyEvaluator
RetentionPolicyVersion uint64
RequestKeys kernel.RequestKeyConfig
Coordinator kernel.CoordinatorConfig
Risk riskpg.Config
IntentKey [32]byte
ActiveEnvelopeKeyID string
}
DeletionConfig selects authenticated self-disposal of an existing native anonymous user. No signin/password implementation is required at construction. Install kernel/anonymous/session disposal and request-key preparation histories, the actual protected risk-counter history, authorization, audit and outbox. Retention is a bounded pure policy callback evaluated outside SQL; this profile accepts explicit Allow only, and denies legal holds or deferred erasure rather than ignoring them. Cleanup comes from the stored subject, never the request. ConfigurationID must change when callback semantics change. Borrow all owner pools/keys/clocks until calls finish; no background work is created.
func (DeletionConfig) MarshalJSON ¶
func (DeletionConfig) MarshalJSON() ([]byte, error)
func (DeletionConfig) MarshalText ¶
func (DeletionConfig) MarshalText() ([]byte, error)
type DeletionService ¶
type DeletionService struct {
// contains filtered or unexported fields
}
DeletionService composes real primary owners under the existing coordinator. It owns neither a transaction/replay ledger nor session/token authority. Immutable composition is concurrency-safe, with one private phase per call.
func NewDeletionService ¶
func NewDeletionService(pool *database.Pool, c DeletionConfig, keys *keyring.Provider) (*DeletionService, error)
NewDeletionService freezes explicit trusted native composition without IO, migration, policy callbacks, entropy or session generation. It accepts no application-provided store, transaction engine or identity assertion.
func (*DeletionService) Delete ¶
func (s *DeletionService) Delete(ctx context.Context, r anonymous.DeletionRequest) (out anonymous.DeletionResult, err error)
Delete binds the actual anonymous bearer/CSRF and original retry intent. Only a new command can enter live admission. Exact terminal retries return metadata, never reactivate a user, reevaluate retention or revoke twice.
func (*DeletionService) DeletionRateSource ¶
func (s *DeletionService) DeletionRateSource(ctx context.Context, r anonymous.DeletionRequest) (user identity.UserID, err error)
DeletionRateSource authenticates original anonymous credential and CSRF possession before returning its rate subject. Retained revoked sessions select only the same historical retry scope, never active authority. Delete independently admits live state for new work and original-command policy for replay. No command, retention callback, risk effect or mutation occurs here. The value is internal routing metadata, not public identity disclosure or a reusable proof. Borrowed dependencies retain their bounded concurrent owners.
func (*DeletionService) MarshalJSON ¶
func (*DeletionService) MarshalJSON() ([]byte, error)
func (*DeletionService) RecoverDeletion ¶
func (s *DeletionService) RecoverDeletion(ctx context.Context, r anonymous.DeletionRecoveryRequest) (out anonymous.DeletionResult, err error)
RecoverDeletion authenticates original encrypted input plus original bearer/ CSRF possession, even after self-revocation or session payload cleanup. It only asks the existing coordinator to reconcile retained owner evidence. No live permission, retention reevaluation, issuance or reexecution occurs.
type DisposalMigrationSource ¶
type DisposalMigrationSource struct {
Schema string
Version migrations.Version
}
DisposalMigrationSource appends retained anonymous-owned self-deletion evidence after subject/kernel histories; schema/version are permanent explicit installation inputs. Existing creation SQL remains byte-for-byte unchanged.
func (DisposalMigrationSource) Load ¶
func (s DisposalMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
Load performs no IO and enables no endpoint. The existing runner owns the forward-only installation; invalid scope/order at installation fails closed.
type ExpiryMigrationSource ¶
type ExpiryMigrationSource struct {
Schema string
Version migrations.Version
}
ExpiryMigrationSource appends service-expiry support to the installed anonymous disposal journal. Existing creation/deletion/upgrade SQL and rows are unchanged. Expired delete is distinct from requested self-deletion; anonymize and retain preserve their stored-policy terminal classifications. Allocate Version after selected predecessors; no destructive downgrade exists.
func (ExpiryMigrationSource) Load ¶
func (s ExpiryMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
Load returns one forward-only suffix without IO or capability activation. Wrong/missing predecessor constraints fail when the existing runner installs the suffix. Nil contexts, invalid schema/version and cancellation deny.
type MigrationSource ¶
type MigrationSource struct {
Schema string
Version migrations.Version
}
MigrationSource installs this dedicated owner after the actual kernel's anonymous-placeholder history. Version is a permanent unused allocation; callers use the existing migration runner's explicit history namespace. It enables no endpoint and has no destructive downgrade or automatic bootstrap.
func (MigrationSource) Load ¶
func (s MigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
Load returns one independently owned forward migration without IO. Kernel reference failures are fatal; no IF EXISTS fallback adopts another history.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository owns only anonymous lifecycle metadata. It borrows a PRIMARY pool, opens no transaction and has no goroutines or mutable global state. Read is concurrent-safe; borrowed Work and command custody remain serial-use.
func NewRepository ¶
func NewRepository(pool *database.Pool, c Config) (*Repository, error)
NewRepository freezes explicit configuration without IO or state creation. This is neither an anonymous signin service nor session authority.
func (*Repository) MarshalJSON ¶
func (*Repository) MarshalJSON() ([]byte, error)
func (*Repository) MarshalText ¶
func (*Repository) MarshalText() ([]byte, error)
func (*Repository) Read ¶
func (r *Repository) Read(ctx context.Context, q anonymous.SubjectQuery) (anonymous.AnonymousSubject, error)
Read returns an exact primary lifecycle projection, preserving terminal states and original expiry/version. No credential is accepted and no positive lease is issued. A session consumer must check all owners under its original bounded read window; absence cannot prove noncommit or authorize recreation.
func (*Repository) RecoverCreation ¶
func (r *Repository) RecoverCreation(ctx context.Context, w kernel.RecoveryWork, owner kernel.FeatureExecutionContributor) (kernel.RecoveryStatus, error)
RecoverCreation inspects this participant's retained original creation correlation only. It grants no access, restores no bearer and performs no mutation. Missing metadata describes this participant, never proves overall rollback: the existing coordinator must reconcile every enlisted owner.
func (*Repository) RecoverDisposal ¶
func (r *Repository) RecoverDisposal(ctx context.Context, w kernel.RecoveryWork, p kernel.FeatureExecutionContributor) (kernel.RecoveryStatus, error)
RecoverDisposal reads retained original metadata, never infers a successful deletion from absence or mutable user/session status. Only the sole existing coordinator can reconcile this participant with kernel/session/audit/outbox.
func (*Repository) RecoverExpiredDisposal ¶
func (r *Repository) RecoverExpiredDisposal(ctx context.Context, w kernel.RecoveryWork, p kernel.FeatureExecutionContributor) (kernel.RecoveryStatus, error)
RecoverExpiredDisposal votes only from retained original expiry-command evidence. Missing lifecycle rows do not prove success, and recovery grants no current access or right to re-execute. The existing coordinator reconciles this vote with kernel, sessions and required audit/outbox effects.
func (*Repository) RecoverUpgrade ¶
func (r *Repository) RecoverUpgrade(ctx context.Context, w kernel.RecoveryWork, owner kernel.AnonymousUpgradeContributor, plan anonymous.MergePlan) (kernel.RecoveryStatus, error)
RecoverUpgrade reads the exact retained source/target/typed-plan correlation only under the original coordinator's recovery invocation. It does not infer commitment from an absent guest row, authenticate a target or return a bearer. The caller must reconcile kernel, capability, password, session and required effects; mismatched or missing evidence cannot independently prove success.
func (*Repository) RequireCreation ¶
func (r *Repository) RequireCreation(ctx context.Context, w kernel.Work, owner kernel.FeatureExecutionContributor, command identity.Command) error
RequireCreation repeats exact original lifecycle and expiry under share lock in the same owner's final read-only invocation. It neither writes nor renews time. Caller must also repeat kernel/session/current-policy admission.
func (*Repository) RequireDisposal ¶
func (r *Repository) RequireDisposal(ctx context.Context, w kernel.Work, p kernel.FeatureExecutionContributor, c identity.Command) error
RequireDisposal verifies this owner's exact terminal state and original lifetime during the final read-only same-Work fence; no time is renewed.
func (*Repository) RequireExpiredDisposal ¶
func (r *Repository) RequireExpiredDisposal(ctx context.Context, w kernel.Work, p kernel.FeatureExecutionContributor, c identity.Command) error
RequireExpiredDisposal repeats the exact terminal lifecycle and original database-time expiry in the same final Work fence. It cannot renew expiry or replace current kernel, service, retention or session-owner checks.
func (*Repository) RequireUpgrade ¶
func (r *Repository) RequireUpgrade(ctx context.Context, w kernel.Work, owner kernel.AnonymousUpgradeContributor, command identity.Command, plan anonymous.MergePlan) error
RequireUpgrade repeats this owner's exact upgraded lifecycle, original merge decision and expiry under the same Work after all downstream effects. It is read-only and does not infer target authentication or extend validity.
func (*Repository) StageCreation ¶
func (r *Repository) StageCreation(ctx context.Context, w kernel.Work, owner kernel.FeatureExecutionContributor, command identity.Command) error
StageCreation writes only anonymous metadata after actual kernel creation in the exact native participant's original Work. Risk and session effects remain required owner phases. No independent transaction or identity/session writes occur here. Every error must abort Work; success is provisional, not issuance.
func (*Repository) StageDisposal ¶
func (r *Repository) StageDisposal(ctx context.Context, w kernel.Work, p kernel.FeatureExecutionContributor, c identity.Command) error
StageDisposal terminalizes only this owner's exact active subject after the actual kernel's disposal in the same Work. Minimal lifecycle/command linkage is retained for non-resurrection and ambiguity recovery; no personal fields, credentials, bearer or application merge payloads are duplicated here. Every error must abort the complete command, including session effects.
func (*Repository) StageExpiredDisposal ¶
func (r *Repository) StageExpiredDisposal(ctx context.Context, w kernel.Work, p kernel.FeatureExecutionContributor, c identity.Command) error
StageExpiredDisposal terminalizes the exact database-time-expired active subject after actual kernel disposal in the same service-expiry Work. Stored cleanup is preserved; delete becomes expired, anonymize and retain keep their distinct terminal states. Upgrade/version races deny, never erase a target.
func (*Repository) StageUpgrade ¶
func (r *Repository) StageUpgrade(ctx context.Context, w kernel.Work, owner kernel.AnonymousUpgradeContributor, command identity.Command, plan anonymous.MergePlan) error
StageUpgrade writes only anonymous lifecycle and bounded merge metadata after the actual kernel's guest disposal and provisional one-use consumption in the same exact native Work. It never writes target identity, credentials, bearer or application data. Missing/changed source loses the optimistic race. Errors abort every owner; success is provisional until the coordinator commits.
type SessionServiceConfig ¶
type SessionServiceConfig struct {
Repository Config
Sessions sessionpg.Config
Profile sessionpg.AnonymousAdmissionConfig
Validation session.ServiceConfig
}
SessionServiceConfig explicitly selects anonymous lifecycle and session schemas on one borrowed PRIMARY pool. Both owner IO budgets must fit within Validation.MaximumDuration. Directory, anonymous kernel/lifecycle, session issuance and guest-policy histories must already be installed. Validation's clock and retained lookup keys keep the session owner's existing semantics. Applications supply configuration, not domain stores or authority readers.
func (SessionServiceConfig) MarshalJSON ¶
func (SessionServiceConfig) MarshalJSON() ([]byte, error)
func (SessionServiceConfig) MarshalText ¶
func (SessionServiceConfig) MarshalText() ([]byte, error)
type SigninConfig ¶
type SigninConfig struct {
Repository Config
Sessions sessionpg.Config
Profile sessionpg.AnonymousAdmissionConfig
Policy anonymous.Policy
ConfigurationID, PolicyID, DisplayNameField string
Fields *identity.AttributeProcessor
FieldSchema identity.AttributeSchema
FlowKeys []session.DigestKey
Origins, CallbackURLs []string
RequestKeys kernel.RequestKeyConfig
IntentKey [32]byte
ActiveEnvelopeKeyID string
Risk risk.AuthenticationAdmissionCustodyConfig
Coordinator kernel.CoordinatorConfig
Issuer session.IssuerConfig
CSRF session.CSRFKey
}
SigninConfig is immutable trusted composition. The selected DisplayNameField is admitted through Fields/FieldSchema as a system-created attribute, never a caller-selected contact. ConfigurationID versions callback semantics. The guest namespace/audience must be deliberately unprivileged. Separate request intent, lookup, flow, envelope and risk keys retain their owners/rotation. Install the kernel preparation/key, anonymous, directory, pre-auth, session issuance and CSRF, authorization, audit and outbox histories before enabling Signin. CSRFMigrationSource is required even in the base anonymous-only profile: its genuine issuer persists digest-only synchronizer state, not schema-1 rows.
func (SigninConfig) MarshalJSON ¶
func (SigninConfig) MarshalJSON() ([]byte, error)
func (SigninConfig) MarshalText ¶
func (SigninConfig) MarshalText() ([]byte, error)
type SigninService ¶
type SigninService struct {
// contains filtered or unexported fields
}
SigninService composes concrete primary owners under the sole existing coordinator. It borrows the pool/local keyring and owns no transaction, goroutine, mutable request cache, sender or automatic retry. Every call has its own native phase. Keep borrowed dependencies alive until calls finish.
func NewSigninService ¶
func NewSigninService(pool *database.Pool, c SigninConfig, keys *keyring.Provider) (*SigninService, error)
NewSigninService freezes explicit configuration without IO, callbacks, migrations or entropy. Applications supply configuration, not domain stores.
func (SigninService) MarshalJSON ¶
func (SigninService) MarshalJSON() ([]byte, error)
func (*SigninService) RecoverSignin ¶
func (s *SigninService) RecoverSignin(ctx context.Context, r anonymous.SigninRecoveryRequest) (out anonymous.SigninResult, err error)
RecoverSignin authenticates original encrypted input and cookie before native disclosure/reconciliation. It performs no generation, external risk or retry.
func (*SigninService) Signin ¶
func (s *SigninService) Signin(ctx context.Context, r anonymous.SigninRequest) (out anonymous.SigninResult, err error)
Signin executes one original scoped request through native prepared-input and generation custody. Terminal retry/recovery cannot generate a second token.
func (*SigninService) SigninRateSource ¶
func (s *SigninService) SigninRateSource(ctx context.Context, r anonymous.SigninRequest) (source string, err error)
SigninRateSource authenticates the original pre-auth possession and intent before returning its stable HTTP rate dimension. It reads only the primary original flow and performs no identity lookup, admission, command preparation, risk evaluation, entropy or mutation. The returned value is not an identifier supplied by the browser and must never be logged or treated as authority.
Retained consumed/expired flows keep this rate scope for keyed retries, not permission to create another guest. Signin independently enforces live flow admission for a new command; only its existing owner can recover old work. Calls are bounded, concurrency-safe and preserve redacted error identities.
type UpgradeConfig ¶
type UpgradeConfig struct {
Guest DeletionConfig
Primary *passwordpg.ActionPrimarySource
Target sessionpg.SessionServiceConfig
TargetCSRFKeys []session.CSRFKey
ProofAudience string
Issuer session.IssuerConfig
CSRF session.CSRFKey
Capability capabilitypg.IssuerConfig
CapabilityPreparation capabilitypg.IssuancePreparationConfig
}
UpgradeConfig composes the existing guest, password, capability and session owners. Guest supplies disposal/retention, primary stores, request-key custody and protected risk counters; it does not select deletion permission. Primary must select identity.anonymous.upgrade and ProofAudience. Target is the real single-factor password session profile. Both original cookies require CSRF. Capability and CapabilityPreparation must retain their keys for recovery. Install the corresponding forward histories before use. Constructors perform no IO, migration, entropy or provider work. Borrow pools/clocks until calls end.
func (UpgradeConfig) MarshalJSON ¶
func (UpgradeConfig) MarshalJSON() ([]byte, error)
func (UpgradeConfig) MarshalText ¶
func (UpgradeConfig) MarshalText() ([]byte, error)
type UpgradeMigrationSource ¶
type UpgradeMigrationSource struct {
Schema string
Version migrations.Version
}
UpgradeMigrationSource adds this owner's retained source/target merge journal after existing anonymous history. Existing SQL and deletion evidence stay unchanged. This finite profile transfers no resources: the only nonempty explicit decision is preserving profile.display_name on the permanent target. Kernel, password, MFA, capability and session histories remain independently required before the native upgrade can be selected. No endpoint is enabled.
func (UpgradeMigrationSource) Load ¶
func (s UpgradeMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
Load returns one forward-only migration without IO. Version/schema are permanent explicit installation inputs; the existing runner owns ordering.
type UpgradeService ¶
type UpgradeService struct {
// contains filtered or unexported fields
}
UpgradeService owns native composition, not a second transaction, proof, session or replay engine. Immutable configuration permits concurrent calls; every call retains its own phase and reveal-once prospective session.
func NewUpgradeService ¶
func NewUpgradeService(pool *database.Pool, c UpgradeConfig, keys *keyring.Provider) (*UpgradeService, error)
NewUpgradeService freezes explicit native owner composition. This finite profile preserves an existing permanent account, transferring no application resources or credentials. Unsupported merge decisions and enrolled MFA deny.
func (*UpgradeService) MarshalJSON ¶
func (*UpgradeService) MarshalJSON() ([]byte, error)
func (*UpgradeService) RecoverUpgrade ¶
func (s *UpgradeService) RecoverUpgrade(ctx context.Context, r anonymous.UpgradeRecoveryRequest) (out anonymous.UpgradeResult, err error)
RecoverUpgrade authenticates both original cookies/CSRF and exact retained two-command scope. It reconciles existing owner evidence only: no current signin, new proof, grant generation, mutation or credential redelivery.
func (*UpgradeService) Upgrade ¶
func (s *UpgradeService) Upgrade(ctx context.Context, r anonymous.UpgradeRequest) (out anonymous.UpgradeResult, err error)
Upgrade commits original grant issuance first, then atomically consumes that grant and fresh target proof with all guest/session effects. Unknown retains both original correlations. Only a known newly committed final execution may reveal its invocation-local session; retries and recovery reveal no secrets.
Source Files
¶
- cleanup_phase.go
- cleanup_selection.go
- cleanup_service.go
- creation.go
- deletion_phase.go
- deletion_service.go
- disposal.go
- disposal_migration.go
- doc.go
- expiry_migration.go
- http_source.go
- migration.go
- repository.go
- session.go
- signin_input.go
- signin_phase.go
- signin_service.go
- upgrade.go
- upgrade_execution.go
- upgrade_input.go
- upgrade_migration.go
- upgrade_preparation.go
- upgrade_service.go