Versions in this module Expand all Collapse all v1 v1.1.0 Sep 5, 2026 Changes in this version type Store + func (s *Store) TOTPEnrolled(ctx context.Context, username string) (bool, error) v1.0.2 Sep 4, 2026 v1.0.1 Sep 4, 2026 v1.0.0 Sep 3, 2026 Changes in this version + const FileHistoryDefaultLimit + const FileHistoryMaxLimit + const PendingRejected + const PendingWaiting + const StateActive + const StateDeleted + const StateInactive + var ErrAccessDenied = errors.New("store: access denied") + var ErrAccountNotProvisioned = errors.New("store: account does not exist and auto-create is off") + var ErrAdminBindRefused = errors.New("store: administrator account cannot be claimed by username") + var ErrAdminPasswordRefused = errors.New("store: an administrator account cannot hold a password") + var ErrConflict = errors.New("store: already exists") + var ErrCredentialExists = errors.New("store: account already has a local credential") + var ErrIdentityConflict = errors.New("store: identity conflict") + var ErrInvalid = errors.New("store: invalid value") + var ErrNotFound = errors.New("store: not found") + var ErrTooSlow = errors.New("store: search took too long and was stopped") + func CleanSearchPath(p string) string + func ValidateLabel(key, value string) error + type AdminHolder struct + Username string + Via string + type AdminLogEntry struct + Action string + Actor string + At time.Time + Details string + Entity string + Via string + type ArchiveBacklogReport struct + Failing int + Lost int + Oldest time.Time + Pending int + type ArchivePending struct + Attempts int + RecordingPath string + SessionID string + StartedAt time.Time + type ArchiveState struct + Archived bool + ArchivedAt time.Time + Attempts int + Bucket string + LastError string + ObjectKey string + SHA256 string + SizeBytes int64 + type Credential struct + Chosen bool + MustChange bool + Verifier string + type DirectoryAccount struct + Groups []string + Subject string + Username string + type FileQuery struct + Limit int + Path string + Target string + Under bool + User string + type FileTouch struct + OSUser string + SrcIP string + Target string + User string + type GroupMapping struct + CreatedAt time.Time + CreatedBy string + ExternalGroup string + Role string + type LocalCredentialHolder struct + Chosen bool + CreatedAt time.Time + CreatedBy string + IsAdmin bool + LastUsedAt time.Time + MustChange bool + State string + Username string + type PendingUser struct + DecidedAt time.Time + DecidedBy string + Email string + FirstSeen time.Time + ID string + LastSeen time.Time + Reason string + SeenGroups []string + Source string + State string + Subject string + Username string + type ProvisionRequest struct + AdminGroupMember bool + AutoCreate bool + Email string + Groups []string + GroupsResolved bool + Issuer string + Subject string + Username string + type PublicKey struct + AddedAt time.Time + Blob []byte + Comment string + type PurgeResult struct + At time.Time + FormerUsername string + Keys int + Roles int + type PurgedAccount struct + FormerUsername string + PurgedAt time.Time + type SessionFile struct + At time.Time + Detail string + Flags string + ID string + NewPath string + OK bool + Op string + Path string + Read int64 + SessionID string + Wrote int64 + type SessionStart struct + ID string + OSUser string + RecordingPath string + SrcIP string + StartedAt time.Time + TargetName string + Username string + type SettingView struct + Key string + Secret bool + UpdatedAt time.Time + UpdatedBy string + Value string + type StaleAccount struct + Confirmed time.Time + DirBound bool + ManualRoles int + SSOOnly bool + State string + Username string + type Store struct + func Open(ctx context.Context, conn string) (*Store, error) + func (s *Store) AccountID(ctx context.Context, username string) (string, error) + func (s *Store) AccountState(ctx context.Context, username string) (state string, confirmed time.Time, err error) + func (s *Store) AddGroupMapping(ctx context.Context, externalGroup, roleName, actor string) error + func (s *Store) AddLocalCredential(ctx context.Context, username, verifier, by string) error + func (s *Store) AddPublicKey(ctx context.Context, username string, keyBlob []byte, comment string) error + func (s *Store) AddSessionFiles(ctx context.Context, sessionID string, files []SessionFile) error + func (s *Store) AdminLog(ctx context.Context, limit int) ([]AdminLogEntry, error) + func (s *Store) AdminVia(ctx context.Context, username string) (string, error) + func (s *Store) Admins(ctx context.Context) ([]AdminHolder, error) + func (s *Store) AllTargetFacts(ctx context.Context) (map[string]model.TargetFacts, error) + func (s *Store) AllowIdentityBind(ctx context.Context, username string, at time.Time) error + func (s *Store) ApplyAdminGroup(ctx context.Context, members []string) (granted, revoked []string, err error) + func (s *Store) ApprovePending(ctx context.Context, id, osUser, by string) (PendingUser, error) + func (s *Store) ArchiveBacklog(ctx context.Context) (b ArchiveBacklogReport, err error) + func (s *Store) ArchiveStateOf(ctx context.Context, sessionID string) (ArchiveState, bool, error) + func (s *Store) ArchivedIDs(ctx context.Context, ids []string) (map[string]bool, error) + func (s *Store) AssignRole(ctx context.Context, username, roleName string, expiresAt time.Time) error + func (s *Store) BeginTOTP(ctx context.Context, username, secret string) error + func (s *Store) BindDirIdentity(ctx context.Context, username, subject string) error + func (s *Store) BindIdPSubject(ctx context.Context, username, issuer, subject string) error + func (s *Store) ClaimArchives(ctx context.Context, limit int, now time.Time, ...) ([]ArchivePending, error) + func (s *Store) ClaimByVerifiedEmail(ctx context.Context, email, issuer, subject string, adminGroupMember bool) (model.User, error) + func (s *Store) Close() error + func (s *Store) CloseOrphanSessions(ctx context.Context, at time.Time) (closed, queued int64, err error) + func (s *Store) ConfirmAccount(ctx context.Context, username string, at time.Time) error + func (s *Store) ConfirmTOTP(ctx context.Context, username string, step int64) error + func (s *Store) CreateFromDirectory(ctx context.Context, acc DirectoryAccount) (model.User, error) + func (s *Store) CreateRole(ctx context.Context, name string) (string, error) + func (s *Store) CreateTarget(ctx context.Context, t model.Target) (string, error) + func (s *Store) CreateUser(ctx context.Context, username, email, osUser string) (string, error) + func (s *Store) DeleteRole(ctx context.Context, name string) error + func (s *Store) DeleteSetting(ctx context.Context, key string) error + func (s *Store) DeleteTarget(ctx context.Context, name string) error + func (s *Store) DeleteTargetLabel(ctx context.Context, targetName, key, actor, via string) error + func (s *Store) DeleteUser(ctx context.Context, username string) error + func (s *Store) DirSubjectOf(ctx context.Context, username string) (string, error) + func (s *Store) DisableTOTP(ctx context.Context, username string) error + func (s *Store) EndSession(ctx context.Context, id string, endedAt time.Time) error + func (s *Store) FileHistory(ctx context.Context, q FileQuery) ([]FileTouch, error) + func (s *Store) FinishSyncRun(ctx context.Context, run SyncRun) error + func (s *Store) FirstKeyAdded(ctx context.Context, username string) (bool, error) + func (s *Store) ForgetPending(ctx context.Context, id string) error + func (s *Store) GrantTarget(ctx context.Context, roleName, targetName string) error + func (s *Store) GroupMappings(ctx context.Context) ([]GroupMapping, error) + func (s *Store) HasIdPIdentity(ctx context.Context, username string) (bool, error) + func (s *Store) ListPending(ctx context.Context) ([]PendingUser, error) + func (s *Store) LocalCredential(ctx context.Context, username string) (Credential, error) + func (s *Store) LocalCredentialHolders(ctx context.Context) ([]LocalCredentialHolder, error) + func (s *Store) LogAdmin(ctx context.Context, e AdminLogEntry) error + func (s *Store) MarkArchiveFailed(ctx context.Context, sessionID, reason string, permanent bool, at time.Time) error + func (s *Store) MarkArchived(ctx context.Context, sessionID, bucket, key, sha string, size int64, ...) error + func (s *Store) MarkDirectoryMissing(ctx context.Context, username string, at time.Time) error + func (s *Store) MarkDirectorySeen(ctx context.Context, username string, at time.Time) error + func (s *Store) MarkFirstKeyAdded(ctx context.Context, username string, at time.Time) error + func (s *Store) Migrate(ctx context.Context) error + func (s *Store) OpenSessions(ctx context.Context) ([]model.Session, error) + func (s *Store) PendingByID(ctx context.Context, id string) (PendingUser, error) + func (s *Store) PendingMigrations(ctx context.Context) (int, error) + func (s *Store) Ping(ctx context.Context) error + func (s *Store) ProvisionUser(ctx context.Context, req ProvisionRequest) (model.User, error) + func (s *Store) PublicKeyCounts(ctx context.Context) (map[string]int, error) + func (s *Store) PublicKeys(ctx context.Context, username string) ([]PublicKey, error) + func (s *Store) PurgeAccount(ctx context.Context, username string, at time.Time) (PurgeResult, error) + func (s *Store) PurgedAccounts(ctx context.Context) ([]PurgedAccount, error) + func (s *Store) QueueArchive(ctx context.Context, sessionID string) error + func (s *Store) RecordPending(ctx context.Context, p PendingUser) (string, error) + func (s *Store) RecordTargetError(ctx context.Context, targetName, reason string) error + func (s *Store) RecordTargetProbe(ctx context.Context, targetName string, p model.TargetProbe) error + func (s *Store) RecordTargetProbeAttempt(ctx context.Context, targetName string, at time.Time) error + func (s *Store) RecordTargetSeen(ctx context.Context, targetName string, f model.TargetFacts) error + func (s *Store) RecordUnmappedGroups(ctx context.Context, groups []string) error + func (s *Store) RefuseIfDeleted(ctx context.Context, username string) error + func (s *Store) RefuseIfDeletedByID(ctx context.Context, id string) error + func (s *Store) RejectPending(ctx context.Context, id, reason, by string) error + func (s *Store) RemoveGroupMapping(ctx context.Context, externalGroup, roleName string) error + func (s *Store) RemoveLocalCredential(ctx context.Context, username string) error + func (s *Store) RemovePublicKey(ctx context.Context, username string, keyBlob []byte) error + func (s *Store) ReplaceLocalCredential(ctx context.Context, username, verifier, by string) (replaced bool, err error) + func (s *Store) RevokeRole(ctx context.Context, username, roleName string) error + func (s *Store) RevokeTarget(ctx context.Context, roleName, targetName string) error + func (s *Store) RoleGrantSource(ctx context.Context, username, roleName string) (source string, found bool, err error) + func (s *Store) Roles(ctx context.Context) ([]model.Role, error) + func (s *Store) RolesForGroups(ctx context.Context, groups []string) (roles, unmapped []string, err error) + func (s *Store) Rollback(ctx context.Context) error + func (s *Store) SchemaVersion(ctx context.Context) (int, error) + func (s *Store) SeenGroupNames(ctx context.Context) ([]string, error) + func (s *Store) Session(ctx context.Context, id string) (model.Session, error) + func (s *Store) SessionFiles(ctx context.Context, sessionID string) ([]SessionFile, error) + func (s *Store) Sessions(ctx context.Context, username string, limit int) ([]model.Session, error) + func (s *Store) SetAccountState(ctx context.Context, username, state string) error + func (s *Store) SetChosenPassword(ctx context.Context, username, verifier string, at time.Time) error + func (s *Store) SetGroupAdmin(ctx context.Context, username string, admin bool) error + func (s *Store) SetRecordingPathForTest(ctx context.Context, sessionID, path string) error + func (s *Store) SetSearchTimeoutForTest(d time.Duration) + func (s *Store) SetSetting(ctx context.Context, key, value string, encrypt bool, actor string) error + func (s *Store) SetTargetLabel(ctx context.Context, targetName, key, value, actor, via string) error + func (s *Store) SetUserAdmin(ctx context.Context, username string, admin bool) error + func (s *Store) SetUserEmail(ctx context.Context, username, email string) error + func (s *Store) SetUserOSUser(ctx context.Context, username, osUser string) error + func (s *Store) SetUserSSOOnly(ctx context.Context, username string, ssoOnly bool) error + func (s *Store) Setting(ctx context.Context, key string) (string, error) + func (s *Store) Settings(ctx context.Context) ([]SettingView, error) + func (s *Store) SourceAccountCount(ctx context.Context) (int, error) + func (s *Store) StaleAccounts(ctx context.Context, olderThan time.Time, state string) ([]StaleAccount, error) + func (s *Store) StartSession(ctx context.Context, rec SessionStart) error + func (s *Store) StartSyncRun(ctx context.Context, source, trigger string, dryRun bool) (int64, error) + func (s *Store) SyncCandidates(ctx context.Context) ([]SyncCandidate, error) + func (s *Store) SyncRoles(ctx context.Context, username string, roleNames []string) error + func (s *Store) SyncRuns(ctx context.Context, limit int) ([]SyncRun, error) + func (s *Store) TOTP(ctx context.Context, username string) (TOTPCredential, error) + func (s *Store) Target(ctx context.Context, name string) (model.Target, error) + func (s *Store) TargetFacts(ctx context.Context, targetName string) (model.TargetFacts, error) + func (s *Store) TargetLabels(ctx context.Context, targetName string) (map[string]string, error) + func (s *Store) Targets(ctx context.Context) ([]model.Target, error) + func (s *Store) TouchLocalCredential(ctx context.Context, username string, at time.Time) error + func (s *Store) TryLockSync(ctx context.Context) (release func(), acquired bool, err error) + func (s *Store) UnbindDirIdentity(ctx context.Context, username string) error + func (s *Store) UnmappedGroups(ctx context.Context) ([]UnmappedGroup, error) + func (s *Store) UseSecretBox(box *secret.Box) + func (s *Store) UseTOTPStep(ctx context.Context, username string, step int64) error + func (s *Store) User(ctx context.Context, username string) (model.User, error) + func (s *Store) UserByDirSubject(ctx context.Context, subject string) (model.User, error) + func (s *Store) UserByEmail(ctx context.Context, email string) (model.User, error) + func (s *Store) UserByIdPSubject(ctx context.Context, issuer, subject string) (model.User, error) + func (s *Store) UserByNameFold(ctx context.Context, name string) (string, error) + func (s *Store) UserByPublicKey(ctx context.Context, keyBlob []byte) (model.User, error) + func (s *Store) UserProfile(ctx context.Context, username string) (UserProfile, error) + func (s *Store) Users(ctx context.Context) ([]model.User, error) + type SyncCandidate struct + DirSubject string + Email string + ManualRoles int + MissingSince time.Time + SSORoles int + Username string + type SyncRun struct + Absent int + Considered int + DryRun bool + FinishedAt time.Time + ID int64 + Outcome string + Present int + Reason string + Revoked int + RolesChanged int + Source string + StartedAt time.Time + Trigger string + Unknown int + type TOTPCredential struct + Confirmed bool + ConfirmedAt time.Time + CreatedAt time.Time + LastUsedAt time.Time + Secret string + type UnmappedGroup struct + LastSeen time.Time + Name string + SeenCount int + type UserProfile struct + AdminVia string + Confirmed time.Time + CredChosen bool + CredCreatedAt time.Time + CredCreatedBy string + CredLastUsed time.Time + CredMustChange bool + Email string + HasCredential bool + Purged bool + State string