Skip to content

Commit

Permalink
revert changes in tlog package
Browse files Browse the repository at this point in the history
Signed-off-by: Asra Ali <asraa@google.com>
  • Loading branch information
asraa committed May 27, 2022
1 parent 81a86c3 commit 7d49fd8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pkg/cosign/tlog.go
Expand Up @@ -78,6 +78,15 @@ func getLogID(pub crypto.PublicKey) (string, error) {
// GetRekorPubs retrieves trusted Rekor public keys from the embedded or cached
// TUF root. If expired, makes a network call to retrieve the updated targets.
func GetRekorPubs(ctx context.Context) (map[string]RekorPubKey, error) {
tufClient, err := tuf.NewFromEnv(ctx)
if err != nil {
return nil, err
}
defer tufClient.Close()
targets, err := tufClient.GetTargetsByMeta(tuf.Rekor, []string{rekorTargetStr})
if err != nil {
return nil, err
}
publicKeys := make(map[string]RekorPubKey)
altRekorPub := os.Getenv(altRekorPublicKey)
if altRekorPub != "" {
Expand All @@ -96,15 +105,6 @@ func GetRekorPubs(ctx context.Context) (map[string]RekorPubKey, error) {
}
publicKeys[keyID] = RekorPubKey{PubKey: extra, Status: tuf.Active}
} else {
tufClient, err := tuf.NewFromEnv(ctx)
if err != nil {
return nil, err
}
defer tufClient.Close()
targets, err := tufClient.GetTargetsByMeta(tuf.Rekor, []string{rekorTargetStr})
if err != nil {
return nil, err
}
for _, t := range targets {
rekorPubKey, err := PemToECDSAKey(t.Target)
if err != nil {
Expand Down

0 comments on commit 7d49fd8

Please sign in to comment.