Skip to content

Commit

Permalink
tuf.api: add helpers to bump version and expiration
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Lock <jlock@vmware.com>
  • Loading branch information
joshuagl committed Jul 1, 2020
1 parent 2e3ceb7 commit 721def4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tuf/api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ def signable(self) -> JsonDict:
"""
raise NotImplementedError()

def bump_version(self) -> None:
self.version = self.version + 1

def bump_expiration(self, delta: relativedelta = relativedelta(days=1)) -> None:
self.expiration = self.expiration + delta

def signed(self) -> str:
return encode_canonical(self.signable['signed']).encode('utf-8')

Expand Down

0 comments on commit 721def4

Please sign in to comment.