def main(): """The main entry point into the fernet_inspector.""" # get arguments fernet_token, key_repository = _get_args() # build key set fernet_keys = _read_keys_from_disk(key_repository) # pass required stuff to the inspector and print the result print fernet_inspector.unpack_token(fernet_token, fernet_keys)
def test_unpack_token_with_payload_as_bytes(self): first_value = uuid.uuid4().bytes second_value = uuid.uuid4().bytes payload_as_bytes = [first_value, second_value] token = self._pack_token(payload_as_bytes) actual_payload = fernet_inspector.unpack_token(token, self.fernet_keys) self.assertIn(first_value, actual_payload) self.assertIn(second_value, actual_payload)
def test_unpack_token_with_payload_as_hex(self): payload = [uuid.uuid4().hex, uuid.uuid4().hex] token = self._pack_token(payload) actual_payload = fernet_inspector.unpack_token(token, self.fernet_keys) self.assertEqual(payload, actual_payload)