botidentity

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package botidentity resolves the authoritative lifecycle identity behind a bot UID. It deliberately reads only the robot and app_bot tables: user.robot is presentation metadata and is not an authorization source.

Index

Constants

View Source
const (
	KindUserBot Kind = "user_bot"
	KindAppBot  Kind = "app_bot"

	// ScopePlatform and ScopeSpace are the authoritative app_bot.scope values.
	ScopePlatform = "platform"
	ScopeSpace    = "space"
)

Variables

View Source
var (
	// ErrAmbiguousIdentity indicates a broken cross-table uniqueness invariant.
	// Callers must fail closed rather than silently choosing one bot kind.
	ErrAmbiguousIdentity = errors.New("ambiguous bot identity")
	// ErrResolverUnavailable indicates a construction or wiring failure.
	ErrResolverUnavailable = errors.New("bot identity resolver unavailable")
)

Functions

This section is empty.

Types

type Identity

type Identity struct {
	UID        string
	Kind       Kind
	CreatorUID string
	AppScope   string
	AppSpaceID string
}

Identity is the minimum authoritative metadata consumers need.

type Kind

type Kind string

Kind identifies which authoritative bot table owns a UID.

type Resolver

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

Resolver performs live authoritative lookups. It intentionally has no package-level cache; consumers that need presentation caching own it locally.

func New

func New(ctx *config.Context) *Resolver

func (*Resolver) Active

func (r *Resolver) Active(uid string) (bool, error)

Active is a boolean convenience that preserves all lookup and invariant errors. It must not be used to collapse an error into an unqualified false.

func (*Resolver) Resolve

func (r *Resolver) Resolve(uid string) (*Identity, error)

Resolve returns nil when uid is not an active bot identity. Lookup and invariant errors are preserved so callers cannot accidentally fail open.

Jump to

Keyboard shortcuts

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