Documentation ¶
Index ¶
- Constants
- Variables
- func IdExist(repo repository.RepoConfig, id entity.Id) bool
- func NewErrMultipleMatchCredential(matching []entity.Id) *entity.ErrMultipleMatch
- func PrefixExist(repo repository.RepoConfig, prefix string) bool
- func Remove(repo repository.RepoConfig, id entity.Id) error
- func Store(repo repository.RepoConfig, cred Credential) error
- type ById
- type Credential
- type CredentialBase
- func (cb *CredentialBase) CreateTime() time.Time
- func (cb *CredentialBase) GetMetadata(key string) (string, bool)
- func (cb *CredentialBase) Metadata() map[string]string
- func (cb *CredentialBase) Salt() []byte
- func (cb *CredentialBase) SetMetadata(key string, value string)
- func (cb *CredentialBase) Target() string
- type CredentialKind
- type Login
- type LoginPassword
- type Option
- type Token
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.RepoConfig, 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.RepoConfig, prefix string) bool
PrefixExist return whether a credential id prefix exist or not
func Remove ¶
func Remove(repo repository.RepoConfig, id entity.Id) error
Remove removes a credential from the global git config
func Store ¶
func Store(repo repository.RepoConfig, 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.RepoConfig, opts ...Option) ([]Credential, error)
List load all existing credentials
func LoadWithId ¶
func LoadWithId(repo repository.RepoConfig, id entity.Id) (Credential, error)
Load loads a credential from the repo config
func LoadWithPrefix ¶
func LoadWithPrefix(repo repository.RepoConfig, prefix string) (Credential, error)
LoadWithPrefix load a credential from the repo config with a prefix
type CredentialBase ¶
type CredentialBase struct { TargetT string `json:"target"` CreateTimeT time.Time `json:"create_time"` SaltT []byte `json:"salt"` MetaT map[string]string `json:"meta"` }
func (*CredentialBase) CreateTime ¶
func (cb *CredentialBase) CreateTime() time.Time
func (*CredentialBase) GetMetadata ¶
func (cb *CredentialBase) GetMetadata(key string) (string, bool)
func (*CredentialBase) Metadata ¶
func (cb *CredentialBase) Metadata() map[string]string
func (*CredentialBase) Salt ¶
func (cb *CredentialBase) Salt() []byte
func (*CredentialBase) SetMetadata ¶
func (cb *CredentialBase) SetMetadata(key string, value string)
func (*CredentialBase) Target ¶
func (cb *CredentialBase) Target() string
type CredentialKind ¶
type CredentialKind string
const ( KindToken CredentialKind = "token" KindLogin CredentialKind = "login" KindLoginPassword CredentialKind = "login-password" )
type Login ¶
type Login struct { *CredentialBase Login string }
func (*Login) Kind ¶
func (lp *Login) Kind() CredentialKind
type LoginPassword ¶
type LoginPassword struct { *CredentialBase Login string Password string }
func NewLoginPassword ¶
func NewLoginPassword(target, login, password string) *LoginPassword
func NewLoginPasswordFromConfig ¶
func NewLoginPasswordFromConfig(conf map[string]string) (*LoginPassword, error)
func (*LoginPassword) ID ¶
func (lp *LoginPassword) ID() entity.Id
func (*LoginPassword) Kind ¶
func (lp *LoginPassword) Kind() CredentialKind
func (*LoginPassword) Validate ¶
func (lp *LoginPassword) Validate() error
type Option ¶
type Option func(opts *options)
func WithKind ¶
func WithKind(kind CredentialKind) Option
WithKind match credentials with the given kind. Can be specified multiple times.
func WithTarget ¶
type Token ¶
type Token struct { *CredentialBase Value string }
Token holds an API access token data
func (*Token) Kind ¶
func (t *Token) Kind() CredentialKind
Click to show internal directories.
Click to hide internal directories.