Files
Agent-System-Backend/internal/store/owner_initialization.go
T
weichen ff6b44bc32 Integrate U3 account contract with serialized account transactions
Why: U7 account audit and identity gates advanced on main while U3 account initialization and recovery were in progress.

Evidence: SELF merge-tree checks passed with go test ./... and isolated PostgreSQL store/server tests; exact-head replay follows.

Impact: Preserve pending-account grants, proof-linked recovery, protected CLI delivery, account serialization, and atomic audit.

Refs: IAM U3 r1; U7 PR #185
2026-10-14 05:27:42 +00:00

19 lines
1.0 KiB
Go

package store
// InitializePendingAccount is reserved for the local machine/DB owner CLI. It
// accepts a stable user ID and expected versions, never an actor string from a
// request. The audit actor is the actual local OS UID. The caller must use the
// protected delivery channel; a failed delivery is retried with the same ID.
func (s *Store) InitializePendingAccount(userID string, expectedStateVersion, expectedGeneration int64) (string, error) {
out, err := s.InitializePendingAccountWithAudit(userID, expectedStateVersion, expectedGeneration, "")
return out.Plain, err
}
// CreateLocalPendingAccount is the local owner-only new-account path. Account
// and first activation grant commit together, including a local administrator
// flag when explicitly requested by the machine/DB owner CLI.
func (s *Store) CreateLocalPendingAccount(owner, name string, isAdmin bool) (Account, string, error) {
account, out, err := s.CreateLocalPendingAccountWithAudit(owner, name, isAdmin, "")
return account, out.Plain, err
}