diff --git a/tests/test_api.py b/tests/test_api.py index 7d00a85720..40afc9a17f 100755 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -183,12 +183,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.assertTrue(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 ... diff --git a/tuf/api/metadata.py b/tuf/api/metadata.py index 5f6a210e45..25b24cc8ba 100644 --- a/tuf/api/metadata.py +++ b/tuf/api/metadata.py @@ -211,7 +211,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: @@ -232,7 +232,7 @@ def sign( Signing errors. Returns: - A securesystemslib-style signature object. + Securesystemslib Signature object that was added into signatures. """ if signed_serializer is None: