Skip to content

Commit

Permalink
Add Metadata class and method docstrings
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
  • Loading branch information
lukpueh committed Aug 19, 2020
1 parent b2cb6f9 commit 68e8c89
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tuf/api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,26 @@
# Classes.

class Metadata():
"""A container for signed TUF metadata.
Provides methods to (de-)serialize JSON metadata from and to file
storage, and to create and verify signatures.
Attributes:
signed: A subclass of Signed, which has the actual metadata payload,
i.e. one of Targets, Snapshot, Timestamp or Root.
signatures: A list of signatures over the canonical JSON representation
of the value of the signed attribute.
"""
def __init__(
self, signed: 'Signed' = None, signatures: list = None) -> None:
# TODO: How much init magic do we want?
self.signed = signed
self.signatures = signatures

def as_dict(self) -> JsonDict:
"""Returns the JSON-compatible dictionary representation. """
return {
'signatures': self.signatures,
'signed': self.signed.as_dict()
Expand Down

0 comments on commit 68e8c89

Please sign in to comment.