@@ -965,30 +965,36 @@ def get_key(self, keyid: str) -> Key: # noqa: D102
965965
966966 def get_root_verification_result (
967967 self ,
968- other : "Root" ,
968+ previous : Optional [ "Root" ] ,
969969 payload : bytes ,
970970 signatures : Dict [str , Signature ],
971971 ) -> RootVerificationResult :
972972 """Return signature threshold verification result for two root roles.
973973
974- Verify root metadata with two roles (the root role from `self` and
975- `other`). If you have only one role (in the case of root v1) you can
976- provide the same Root as both `self` and `other`.
974+ Verify root metadata with two roles (`self` and optionally `previous`).
975+
976+ If the repository has no root role versions yet, `previous` can be left
977+ None. In all other cases, `previous` must be the previous version of
978+ the Root.
977979
978980 NOTE: Unlike `verify_delegate()` this method does not raise, if the
979981 root metadata is not fully verified.
980982
981983 Args:
982- other : The other `Root` to verify payload with
984+ previous : The previous `Root` to verify payload with, or None
983985 payload: Signed payload bytes for root
984986 signatures: Signatures over payload bytes
985987
986988 Raises:
987989 ValueError: no delegation was found for ``delegated_role``.
988990 """
991+
992+ if previous is None :
993+ previous = self
994+
989995 return RootVerificationResult (
990996 self .get_verification_result (Root .type , payload , signatures ),
991- other .get_verification_result (Root .type , payload , signatures ),
997+ previous .get_verification_result (Root .type , payload , signatures ),
992998 )
993999
9941000
0 commit comments