ensurePrivateKey attempt to load the corresponding private key if it is not loaded already. If no private key is found, returns errNoPrivateKey
(repo repository.RepoKeyring)
| 188 | // ensurePrivateKey attempt to load the corresponding private key if it is not loaded already. |
| 189 | // If no private key is found, returns errNoPrivateKey |
| 190 | func (k *Key) ensurePrivateKey(repo repository.RepoKeyring) error { |
| 191 | if k.private != nil { |
| 192 | return nil |
| 193 | } |
| 194 | |
| 195 | return k.loadPrivate(repo) |
| 196 | } |
| 197 | |
| 198 | func (k *Key) storePrivate(repo repository.RepoKeyring) error { |
| 199 | var buf bytes.Buffer |