diff --git a/pywidevine/pssh.py b/pywidevine/pssh.py index 229c8c8..25c1720 100644 --- a/pywidevine/pssh.py +++ b/pywidevine/pssh.py @@ -213,6 +213,21 @@ class PSSH: return cls(box) + def dump(self) -> bytes: + """Export the PSSH object as a full PSSH box in bytes form.""" + return Box.build(dict( + type=b"pssh", + version=self.version, + flags=self.flags, + system_ID=self.system_id, + key_IDs=self.key_ids, + init_data=self.init_data + )) + + def dumps(self) -> str: + """Export the PSSH object as a full PSSH box in base64 form.""" + return base64.b64encode(self.dump()).decode() + @staticmethod def get_key_ids(box: Container) -> list[UUID]: """