credentials

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

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

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

func NewGlobalStore(password string) (*Store, error)

NewGlobalStore creates a store for global credentials only.

func NewStore

func NewStore(sessionDir, password string) (*Store, error)

NewStore creates a store with both global and session-specific credential access.

func (*Store) Delete

func (s *Store) Delete(id string) error

Delete removes a credential by ID.

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.

func (*Store) Save

func (s *Store) Save(cred *core.Credential) error

Save stores a credential. Global credentials are stored in ~/.revoco/credentials/, session credentials are stored in the session's credentials directory.

Jump to

Keyboard shortcuts

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