MCPcopy Create free account
hub / github.com/docker/cli / initNotaryRepoWithSigners

Function initNotaryRepoWithSigners

cmd/docker-trust/trust/sign.go:197–218  ·  view source on GitHub ↗
(notaryRepo notaryclient.Repository, newSigner data.RoleName)

Source from the content-addressed store, hash-verified

195}
196
197func initNotaryRepoWithSigners(notaryRepo notaryclient.Repository, newSigner data.RoleName) error {
198 rootKey, err := getOrGenerateNotaryKey(notaryRepo, data.CanonicalRootRole)
199 if err != nil {
200 return err
201 }
202 rootKeyID := rootKey.ID()
203
204 // Initialize the notary repository with a remotely managed snapshot key
205 if err := notaryRepo.Initialize([]string{rootKeyID}, data.CanonicalSnapshotRole); err != nil {
206 return err
207 }
208
209 signerKey, err := getOrGenerateNotaryKey(notaryRepo, newSigner)
210 if err != nil {
211 return err
212 }
213 if err := addStagedSigner(notaryRepo, newSigner, []data.PublicKey{signerKey}); err != nil {
214 return fmt.Errorf("could not add signer to repo: %s: %w", strings.TrimPrefix(newSigner.String(), "targets/"), err)
215 }
216
217 return notaryRepo.Publish()
218}
219
220// generates an ECDSA key without a GUN for the specified role
221func getOrGenerateNotaryKey(notaryRepo notaryclient.Repository, role data.RoleName) (data.PublicKey, error) {

Callers 1

runSignImageFunction · 0.85

Calls 6

getOrGenerateNotaryKeyFunction · 0.85
addStagedSignerFunction · 0.85
StringMethod · 0.65
IDMethod · 0.45
InitializeMethod · 0.45
PublishMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…