Documentation
¶
Overview ¶
Package credentials provides storage and management for connector authentication. It supports both global credentials (shared across sessions) and session-specific credentials, with encryption at rest using the secrets package.
Storage layout:
Global: ~/.revoco/credentials/<connector_id>/<credential_id>.json Session: <session_dir>/credentials/<credential_id>.json
Index ¶
- func IsExpired(cred *core.Credential) bool
- func NewAPIKeyCredential(connectorID, name string, scope core.CredentialScope, apiKey string) *core.Credential
- func NewCookieCredential(connectorID, name string, scope core.CredentialScope, ...) *core.Credential
- func NewCredential(connectorID, name, authType string, scope core.CredentialScope) *core.Credential
- func NewOAuthCredential(connectorID, name string, scope core.CredentialScope, ...) *core.Credential
- type Store
- func (s *Store) Delete(id string) error
- func (s *Store) List() ([]*core.Credential, error)
- func (s *Store) ListForConnector(connectorID string) ([]*core.Credential, error)
- func (s *Store) Load(id string) (*core.Credential, error)
- func (s *Store) LoadForConnector(id, connectorID string) (*core.Credential, error)
- func (s *Store) Save(cred *core.Credential) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsExpired ¶
func IsExpired(cred *core.Credential) bool
IsExpired checks if a credential has expired.
func NewAPIKeyCredential ¶
func NewAPIKeyCredential(connectorID, name string, scope core.CredentialScope, apiKey string) *core.Credential
NewAPIKeyCredential creates a credential for API key authentication.
func NewCookieCredential ¶
func NewCookieCredential(connectorID, name string, scope core.CredentialScope, cookies map[string]string) *core.Credential
NewCookieCredential creates a credential for cookie-based authentication.
func NewCredential ¶
func NewCredential(connectorID, name, authType string, scope core.CredentialScope) *core.Credential
NewCredential creates a new credential with a generated ID.
func NewOAuthCredential ¶
func NewOAuthCredential(connectorID, name string, scope core.CredentialScope, accessToken, refreshToken string, expiresAt int64) *core.Credential
NewOAuthCredential creates a credential for OAuth authentication.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages credential storage and retrieval.
func NewGlobalStore ¶
NewGlobalStore creates a store for global credentials only.
func (*Store) List ¶
func (s *Store) List() ([]*core.Credential, error)
List returns all available credentials (both global and session-specific).
func (*Store) ListForConnector ¶
func (s *Store) ListForConnector(connectorID string) ([]*core.Credential, error)
ListForConnector returns credentials for a specific connector type.
func (*Store) Load ¶
func (s *Store) Load(id string) (*core.Credential, error)
Load retrieves a credential by ID. It searches session-specific credentials first, then falls back to global credentials.
func (*Store) LoadForConnector ¶
func (s *Store) LoadForConnector(id, connectorID string) (*core.Credential, error)
LoadForConnector retrieves a credential by ID that must match the specified connector.