Skip to content

Commit

Permalink
Merge pull request #1442 from jku/fix-sign-return-value
Browse files Browse the repository at this point in the history
Metadata API: Fix Metadata.sign() return value annotation
  • Loading branch information
joshuagl authored Jun 29, 2021
2 parents f458e92 + 505b82a commit ef9a008
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,14 @@ def test_sign_verify(self):

sslib_signer = SSlibSigner(self.keystore['snapshot'])
# Append a new signature with the unrelated key and assert that ...
metadata_obj.sign(sslib_signer, append=True)
sig = metadata_obj.sign(sslib_signer, append=True)
# ... there are now two signatures, and
self.assertEqual(len(metadata_obj.signatures), 2)
# ... both are valid for the corresponding keys.
targets_key.verify_signature(metadata_obj)
snapshot_key.verify_signature(metadata_obj)
# ... the returned (appended) signature is for snapshot key
self.assertEqual(sig.keyid, snapshot_keyid)

sslib_signer = SSlibSigner(self.keystore['timestamp'])
# Create and assign (don't append) a new signature and assert that ...
Expand Down
4 changes: 2 additions & 2 deletions tuf/api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def sign(
signer: Signer,
append: bool = False,
signed_serializer: Optional[SignedSerializer] = None,
) -> Dict[str, Any]:
) -> Signature:
"""Creates signature over 'signed' and assigns it to 'signatures'.
Arguments:
Expand All @@ -247,7 +247,7 @@ def sign(
Signing errors.
Returns:
A securesystemslib-style signature object.
Securesystemslib Signature object that was added into signatures.
"""

if signed_serializer is None:
Expand Down

0 comments on commit ef9a008

Please sign in to comment.