Skip to content

Commit 314e8de

Browse files
[Delegations prereq] Support delegated targets in DefaultExpires and fix GenKey expiration
Splitting up #175
1 parent 5097960 commit 314e8de

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

data/types.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ func DefaultExpires(role string) time.Time {
8282
switch role {
8383
case "root":
8484
t = time.Now().AddDate(1, 0, 0)
85-
case "targets":
86-
t = time.Now().AddDate(0, 3, 0)
8785
case "snapshot":
8886
t = time.Now().AddDate(0, 0, 7)
8987
case "timestamp":
9088
t = time.Now().AddDate(0, 0, 1)
89+
default:
90+
// targets and delegated targets
91+
t = time.Now().AddDate(0, 3, 0)
9192
}
9293
return t.UTC().Round(time.Second)
9394
}

repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ func (r *Repo) ChangePassphrase(keyRole string) error {
332332
}
333333

334334
func (r *Repo) GenKey(role string) ([]string, error) {
335-
return r.GenKeyWithExpires(role, data.DefaultExpires("root"))
335+
return r.GenKeyWithExpires(role, data.DefaultExpires(role))
336336
}
337337

338338
func (r *Repo) GenKeyWithExpires(keyRole string, expires time.Time) (keyids []string, err error) {

0 commit comments

Comments
 (0)