Documentation
¶
Index ¶
Constants ¶
const NoAppSecret = ""
NoAppSecret marks that a credential source does not provide a real app secret. Token-only sources should return this value instead of inventing placeholder text.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct {
AppID string
AppSecret string // real app secret; empty or NoAppSecret means unavailable
Brand Brand // BrandLark or BrandFeishu
DefaultAs Identity // IdentityUser / IdentityBot / IdentityAuto; empty = not set
ProfileName string
OpenID string // optional; if UAT is available, API result takes precedence
SupportedIdentities IdentitySupport // zero = provider did not declare; treat as no restriction
}
Account holds resolved app credentials and configuration.
type BlockError ¶
BlockError is returned by a Provider to actively reject a request and prevent subsequent providers in the chain from being consulted.
func (*BlockError) Error ¶
func (e *BlockError) Error() string
type IdentitySupport ¶
type IdentitySupport uint8
IdentitySupport declares which identities a credential source can provide.
const ( SupportsUser IdentitySupport = 1 << iota SupportsBot SupportsAll = SupportsUser | SupportsBot )
func (IdentitySupport) BotOnly ¶
func (s IdentitySupport) BotOnly() bool
BotOnly returns true if only bot identity is supported.
func (IdentitySupport) Has ¶
func (s IdentitySupport) Has(flag IdentitySupport) bool
Has reports whether s includes the given flag.
func (IdentitySupport) UserOnly ¶
func (s IdentitySupport) UserOnly() bool
UserOnly returns true if only user identity is supported.
type Provider ¶
type Provider interface {
Name() string
ResolveAccount(ctx context.Context) (*Account, error)
ResolveToken(ctx context.Context, req TokenSpec) (*Token, error)
}
Provider is the unified interface for credential resolution.
Flow control uses Go's native mechanisms:
- Handle: return &Account{...}, nil or return &Token{...}, nil
- Skip: return nil, nil
- Block: return nil, &BlockError{...}
type Token ¶
type Token struct {
Value string
Scopes string // space-separated; empty = skip scope pre-check
Source string // e.g. "env:LARKSUITE_CLI_USER_ACCESS_TOKEN", "vault:addr"
}
Token holds a resolved access token and optional metadata.