Documentation
¶
Index ¶
- Constants
- Variables
- func IdExist(repo repository.RepoKeyring, id entity.Id) bool
- func NewErrMultipleMatchCredential(matching []entity.Id) *entity.ErrMultipleMatch
- func PrefixExist(repo repository.RepoKeyring, prefix string) bool
- func Remove(repo repository.RepoKeyring, id entity.Id) error
- func Store(repo repository.RepoKeyring, cred Credential) error
- type ById
- type Credential
- type CredentialKind
- type ListOption
- type Login
- func (cb Login) CreateTime() time.Time
- func (cb Login) GetMetadata(key string) (string, bool)
- func (lp *Login) ID() entity.Id
- func (lp *Login) Kind() CredentialKind
- func (cb Login) Metadata() map[string]string
- func (cb Login) Salt() []byte
- func (cb Login) SetMetadata(key string, value string)
- func (cb Login) Target() string
- func (lp *Login) Validate() error
- type LoginPassword
- func (cb LoginPassword) CreateTime() time.Time
- func (cb LoginPassword) GetMetadata(key string) (string, bool)
- func (lp *LoginPassword) ID() entity.Id
- func (lp *LoginPassword) Kind() CredentialKind
- func (cb LoginPassword) Metadata() map[string]string
- func (cb LoginPassword) Salt() []byte
- func (cb LoginPassword) SetMetadata(key string, value string)
- func (cb LoginPassword) Target() string
- func (lp *LoginPassword) Validate() error
- type Token
- func (cb Token) CreateTime() time.Time
- func (cb Token) GetMetadata(key string) (string, bool)
- func (t *Token) ID() entity.Id
- func (t *Token) Kind() CredentialKind
- func (cb Token) Metadata() map[string]string
- func (cb Token) Salt() []byte
- func (cb Token) SetMetadata(key string, value string)
- func (cb Token) Target() string
- func (t *Token) Validate() error
Constants ¶
View Source
const ( MetaKeyLogin = "login" MetaKeyBaseURL = "base-url" )
Variables ¶
View Source
var ErrCredentialNotExist = errors.New("credential doesn't exist")
Functions ¶
func IdExist ¶
func IdExist(repo repository.RepoKeyring, id entity.Id) bool
IdExist return whether a credential id exist or not
func NewErrMultipleMatchCredential ¶
func NewErrMultipleMatchCredential(matching []entity.Id) *entity.ErrMultipleMatch
func PrefixExist ¶
func PrefixExist(repo repository.RepoKeyring, prefix string) bool
PrefixExist return whether a credential id prefix exist or not
func Remove ¶
func Remove(repo repository.RepoKeyring, id entity.Id) error
Remove removes a credential from the global git config
func Store ¶
func Store(repo repository.RepoKeyring, cred Credential) error
Store stores a credential in the global git config
Types ¶
type ById ¶
type ById []Credential
type Credential ¶
type Credential interface { ID() entity.Id Kind() CredentialKind Target() string CreateTime() time.Time Salt() []byte Validate() error Metadata() map[string]string GetMetadata(key string) (string, bool) SetMetadata(key string, value string) // contains filtered or unexported methods }
func List ¶
func List(repo repository.RepoKeyring, opts ...ListOption) ([]Credential, error)
List load all existing credentials
func LoadWithId ¶
func LoadWithId(repo repository.RepoKeyring, id entity.Id) (Credential, error)
Load loads a credential from the repo config
func LoadWithPrefix ¶
func LoadWithPrefix(repo repository.RepoKeyring, prefix string) (Credential, error)
LoadWithPrefix load a credential from the repo config with a prefix
type CredentialKind ¶
type CredentialKind string
const ( KindToken CredentialKind = "token" KindLogin CredentialKind = "login" KindLoginPassword CredentialKind = "login-password" )
type ListOption ¶ added in v0.8.0
type ListOption func(opts *listOptions)
func WithKind ¶
func WithKind(kind CredentialKind) ListOption
WithKind match credentials with the given kind. Can be specified multiple times.
func WithMeta ¶
func WithMeta(key string, val string) ListOption
func WithTarget ¶
func WithTarget(target string) ListOption
type Login ¶
type Login struct { Login string // contains filtered or unexported fields }
func (Login) CreateTime ¶
func (Login) GetMetadata ¶
func (*Login) Kind ¶
func (lp *Login) Kind() CredentialKind
func (Login) SetMetadata ¶
type LoginPassword ¶
type LoginPassword struct { Login string Password string // contains filtered or unexported fields }
func NewLoginPassword ¶
func NewLoginPassword(target, login, password string) *LoginPassword
func NewLoginPasswordFromConfig ¶
func NewLoginPasswordFromConfig(conf map[string]string) (*LoginPassword, error)
func (LoginPassword) CreateTime ¶
func (LoginPassword) GetMetadata ¶
func (*LoginPassword) ID ¶
func (lp *LoginPassword) ID() entity.Id
func (*LoginPassword) Kind ¶
func (lp *LoginPassword) Kind() CredentialKind
func (LoginPassword) SetMetadata ¶
func (*LoginPassword) Validate ¶
func (lp *LoginPassword) Validate() error
type Token ¶
type Token struct { Value string // contains filtered or unexported fields }
Token holds an API access token data
func (Token) CreateTime ¶
func (Token) GetMetadata ¶
func (*Token) Kind ¶
func (t *Token) Kind() CredentialKind
func (Token) SetMetadata ¶
Click to show internal directories.
Click to hide internal directories.