credentials

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: Apache-2.0 Imports: 17 Imported by: 9

Documentation

Index

Constants

View Source
const (
	CredentialTypeTool          CredentialType = "tool"
	CredentialTypeModelProvider CredentialType = "modelProvider"
	ExistingCredential                         = "GPTSCRIPT_EXISTING_CREDENTIAL"
	CredentialExpiration                       = "GPTSCRIPT_CREDENTIAL_EXPIRATION"
)
View Source
const (
	DefaultCredentialContext = "default"
	AllCredentialContexts    = "*"
)

Variables

This section is empty.

Functions

func GitURLForRepoName added in v0.9.5

func GitURLForRepoName(repoName string) (string, error)

func NewHelper

func NewHelper(c *config.CLIConfig, helper string) (credentials.Store, error)

func RepoNameForCredentialStore added in v0.9.5

func RepoNameForCredentialStore(store string) string

Types

type Credential

type Credential struct {
	Context      string            `json:"context"`
	ToolName     string            `json:"toolName"`
	Type         CredentialType    `json:"type"`
	Env          map[string]string `json:"env"`
	Ephemeral    bool              `json:"ephemeral,omitempty"`
	ExpiresAt    *time.Time        `json:"expiresAt"`
	RefreshToken string            `json:"refreshToken"`
}

func (Credential) IsExpired added in v0.8.4

func (c Credential) IsExpired() bool

type CredentialBuilder added in v0.9.0

type CredentialBuilder interface {
	EnsureCredentialHelpers(ctx context.Context) error
}

type CredentialHelperDirs added in v0.8.2

type CredentialHelperDirs struct {
	RevisionFile, LastCheckedFile, BinDir string
}

func GetCredentialHelperDirs added in v0.8.2

func GetCredentialHelperDirs(cacheDir, store string) CredentialHelperDirs

type CredentialStore added in v0.8.2

type CredentialStore interface {
	Get(ctx context.Context, toolName string) (*Credential, bool, error)
	Add(ctx context.Context, cred Credential) error
	Refresh(ctx context.Context, cred Credential) error
	Remove(ctx context.Context, toolName string) error
	List(ctx context.Context) ([]Credential, error)
}

func NewStore

func NewStore(cfg *config.CLIConfig, credentialBuilder CredentialBuilder, credCtxs []string, cacheDir string) (CredentialStore, error)

type CredentialType added in v0.8.0

type CredentialType string

type HelperStore

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

func (*HelperStore) Erase

func (h *HelperStore) Erase(serverAddress string) error

func (*HelperStore) Get

func (h *HelperStore) Get(serverAddress string) (types.AuthConfig, error)

func (*HelperStore) GetAll

func (h *HelperStore) GetAll() (map[string]types.AuthConfig, error)

func (*HelperStore) Store

func (h *HelperStore) Store(authConfig types.AuthConfig) error

type NoopStore added in v0.8.2

type NoopStore struct{}

func (NoopStore) Add added in v0.8.2

func (NoopStore) Get added in v0.8.2

func (NoopStore) List added in v0.8.2

func (s NoopStore) List(context.Context) ([]Credential, error)

func (NoopStore) Refresh added in v0.9.5

func (NoopStore) Remove added in v0.8.2

func (s NoopStore) Remove(context.Context, string) error

type Store

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

func (Store) Add

func (s Store) Add(ctx context.Context, cred Credential) error

Add adds a new credential to the credential store. Any context set on the credential object will be overwritten with the first context of the credential store.

func (Store) Get

func (s Store) Get(ctx context.Context, toolName string) (*Credential, bool, error)

func (Store) List

func (s Store) List(ctx context.Context) ([]Credential, error)

func (Store) Refresh added in v0.9.5

func (s Store) Refresh(ctx context.Context, cred Credential) error

Refresh updates an existing credential in the credential store.

func (Store) Remove

func (s Store) Remove(ctx context.Context, toolName string) error

Jump to

Keyboard shortcuts

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