Documentation
¶
Overview ¶
Package administration owns standalone server identities and administrative state.
Index ¶
- Constants
- func RecoverAdministrator(ctx context.Context, cfg Config, id string) (string, error)
- type Action
- type Config
- type Manager
- func (m *Manager) Audience() string
- func (m *Manager) Authenticate(token, audience string) (Principal, bool)
- func (m *Manager) Close() error
- func (m *Manager) Complete(ctx context.Context, id string, succeeded bool) (Receipt, error)
- func (m *Manager) Create(ctx context.Context, actor Principal, id string, role Role) (string, error)
- func (m *Manager) Operation(actor Principal, id string) (Receipt, error)
- func (m *Manager) Revoke(ctx context.Context, actor Principal, id string) error
- func (m *Manager) Rotate(ctx context.Context, actor Principal, id string, overlap time.Duration) (string, error)
- func (m *Manager) StartOperation(ctx context.Context, actor Principal, action Action, subject string) (Receipt, error)
- func (m *Manager) Status() Status
- func (m *Manager) Track(ctx context.Context, principal Principal) (context.Context, context.CancelFunc)
- type Principal
- type Receipt
- type Reports
- type Role
- type State
- type Status
Constants ¶
const MaximumRotationOverlap = 24 * time.Hour
MaximumRotationOverlap bounds the interval that accepts old and new credentials.
Variables ¶
This section is empty.
Functions ¶
func RecoverAdministrator ¶
RecoverAdministrator replaces a lost administrator credential through explicit local filesystem authority. It requires exclusive private state access and a valid audit history. Stop the server first.
Types ¶
type Action ¶
type Action string
Action identifies an administrative effect recorded before execution.
const ( // Bootstrap creates the first local administrator. Bootstrap Action = "bootstrap" // CreateIdentity adds an administrator or subscriber. CreateIdentity Action = "create_identity" // RotateIdentity replaces a credential with a bounded overlap. RotateIdentity Action = "rotate_identity" // RevokeIdentity withdraws all credentials for an identity. RevokeIdentity Action = "revoke_identity" // RefreshCatalog starts explicit catalog acquisition. RefreshCatalog Action = "refresh_catalog" // CancelOperation asks an accepted operation to stop. CancelOperation Action = "cancel_operation" )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns identities, audit events, and operation receipts for one server. Authentication reads an immutable snapshot. Administrative writes use one process lease.
func Initialize ¶
func Initialize(ctx context.Context, cfg Config, administratorID string) (_ *Manager, token string, resultErr error)
Initialize creates the first administrator through an explicit local operation. It refuses existing identities and returns the credential only after durable completion.
func Open ¶
Open restores private administration state without creating an administrator. Audit failures leave authenticated diagnostics available and reject new mutations.
func (*Manager) Audience ¶
Audience returns the immutable catalog namespace bound to this administration store.
func (*Manager) Authenticate ¶
Authenticate accepts an active credential for the configured audience without filesystem I/O.
func (*Manager) Complete ¶
Complete persists the operation outcome before its caller reports success. A failed effect can have partial results. Recovery never executes the effect again.
func (*Manager) Create ¶
func (m *Manager) Create(ctx context.Context, actor Principal, id string, role Role) (string, error)
Create adds a distinct identity and returns its credential after durable audit completion.
func (*Manager) Operation ¶
Operation returns a retained durable operation receipt for authorized diagnostics.
func (*Manager) Revoke ¶
Revoke withdraws an identity while retaining at least one active administrator.
func (*Manager) Rotate ¶
func (m *Manager) Rotate(ctx context.Context, actor Principal, id string, overlap time.Duration) (string, error)
Rotate returns a new credential and retains the prior active key for the selected overlap. A second rotation cannot discard a key whose overlap has not ended.
func (*Manager) StartOperation ¶
func (m *Manager) StartOperation(ctx context.Context, actor Principal, action Action, subject string) (Receipt, error)
StartOperation records an administrator's operation intent before the caller starts its effects.
type Principal ¶
type Principal struct {
// contains filtered or unexported fields
}
Principal identifies an authenticated caller. Callers cannot construct its authority.
func (Principal) Audience ¶
Audience returns the catalog authority namespace assigned to this identity.
type Receipt ¶
type Receipt struct {
ID string `json:"id"`
Audience string `json:"audience"`
Actor string `json:"actor"`
Action Action `json:"action"`
Subject string `json:"subject"`
State State `json:"state"`
AcceptedAt time.Time `json:"accepted_at"`
CompletedAt time.Time `json:"completed_at"`
Revision uint64 `json:"revision"`
BeforeDigest string `json:"before_digest,omitempty"`
AfterDigest string `json:"after_digest,omitempty"`
}
Receipt reports one administrative operation without credential material.
type Reports ¶
type Reports struct {
// contains filtered or unexported fields
}
Reports holds detached configuration reports prepared by the host application. The host must redact secrets before construction. Reports require no catalog startup.
func NewReports ¶
NewReports validates and copies versioned JSON objects for administrative diagnostics.
type State ¶
type State string
State records the durable outcome of an administrative operation.
const ( // Accepted means the audit intent is durable and effects may start. Accepted State = "accepted" // Succeeded means the effect and its audit outcome are durable. Succeeded State = "succeeded" // Failed means the operation reported a failure. Effects can be partial. Failed State = "failed" // Interrupted means recovery cannot prove the effect's outcome. It never replays the effect. Interrupted State = "interrupted" )
type Status ¶
type Status struct {
MutationReady bool `json:"mutation_ready"`
Reason string `json:"reason,omitempty"`
Revision uint64 `json:"revision"`
RetainedOperations int `json:"retained_operations"`
OperationLimit int `json:"operation_limit"`
AuditBytes int64 `json:"audit_bytes"`
AuditByteLimit int64 `json:"audit_byte_limit"`
}
Status reports administration readiness without credential material.