Load loads a credential from the repo config
(repo repository.RepoKeyring, id entity.Id)
| 59 | |
| 60 | // Load loads a credential from the repo config |
| 61 | func LoadWithId(repo repository.RepoKeyring, id entity.Id) (Credential, error) { |
| 62 | key := fmt.Sprintf("%s%s", keyringKeyPrefix, id) |
| 63 | |
| 64 | item, err := repo.Keyring().Get(key) |
| 65 | if err == repository.ErrKeyringKeyNotFound { |
| 66 | return nil, ErrCredentialNotExist |
| 67 | } |
| 68 | if err != nil { |
| 69 | return nil, err |
| 70 | } |
| 71 | |
| 72 | return decode(item) |
| 73 | } |
| 74 | |
| 75 | // LoadWithPrefix load a credential from the repo config with a prefix |
| 76 | func LoadWithPrefix(repo repository.RepoKeyring, prefix string) (Credential, error) { |