From 65f4884ff9d7538faa08d72093a589e085e50a68 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Tue, 5 Jun 2018 14:18:16 +0200 Subject: Add test for push decrypt --- tests/test_push.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/test_push.py (limited to 'tests') diff --git a/tests/test_push.py b/tests/test_push.py new file mode 100644 index 0000000..5313a3c --- /dev/null +++ b/tests/test_push.py @@ -0,0 +1,23 @@ +import pytest + +def test_decrypt(api): + priv = { + 'auth': b'\xe7y\x0fp\xb9\x92\xe0\xa0\xc5\xd5~Qr\xd7\xaa\x16', + 'privkey': 86377660131518823691452242868806126400423244879788569019894692873283793307753 + } + + # Yes, I am aware that there is an access token in there. It's not valid anymore. + encryption_header = "salt=O14vjCdbxxhRUTkrsp98vw" + crypto_key_header = "dh=BKz_CMlF6kVURVImPDsz3bNbTv-9QTGtXpE4Fd3wQGF44fVTj32-APndoccYdjXY2U-mdTen1PDm_pHacpEmD0M;p256ecdsa=BDSAB3e_l5Qp4X50UYSSrKiZFZWDAgHlWIDhgBjXJuUzb0HrpqoCdFhMCh4o2xYHTqpvyTJ3SfFtrILLiXXWT5k" + data = b'\x10\\b<\xddi\xacd\x86\xc8J1\xb6}5\x01K\x85;\xd2\xd4WzN\xab\x0b|3D\xe9_YPcsG\x9fh\xae\xfe\xbb:z&\xc4\x8ek\x89\xde\xa2\xdbF\xdc\xdd[p\xc4\x89\xbc\xc3\x8e\xb8\x9bJ~\xc4}]\xdb\xdc\xf1wY\x16g\xf8\x91N\xee\xfd\x92\x1e\xcd\xd2~\xf2\x06\x89\xcd\xa5\xcd\x97\xb7{\xc5\xe1\xe4\xb0\x9f7\xc6\x8a5\xda\xbbm\xce\xc5\x8d\x93`&\x0e\xa9\x83\xa2|p;\xa4\x8b)\xc8\x07\rb!a\x82\xf5E\x92\x00Y{\xd4\x94\xf8\xf0\r\xb5c\x86\xfb\xd0*\xbb\xa1!\x14\xd5\x11\xc8\xafI\xb3j\xca7\xc4\x9c\xe0\x9c0\x12\xc0\xd1\x8a{\xcd\xc4~\\\xc2\x99\xf0d)\x03E\x91;m\xbe\xdb\x86\xef\xd7\xa7>\xd1a\xf1\x83!\xaeB\xaa\xf0\xda\x1b;\x86\xd8;]\x9e\xe3\xfa*!\x07,\t\xbd\xe7\xfc\xa7\xa8\xba[\xcf\x89e\xac\'\xdb\x88g\xd9\\\xe4C\x08Lb\xb6CAT\xcc!\xa4\xce\x92t3\x1c1\x01' + + decrypted = api.push_subscription_decrypt_push( + data, + priv, + encryption_header, + crypto_key_header + ) + + assert decrypted + assert decrypted.title == 'You were mentioned by fake halcy' + \ No newline at end of file -- cgit v1.2.3