diff options
| author | Andrew <saintruler@gmail.com> | 2021-04-28 20:31:16 +0400 |
|---|---|---|
| committer | Andrew <saintruler@gmail.com> | 2021-04-28 20:31:16 +0400 |
| commit | 8ebbdab5079f803567297af842c87ce012b7ea11 (patch) | |
| tree | ffe28a45797dab60b036eb05e419532cae329171 /http-tester.py | |
| parent | 7d6270f64b1dc00d91230b5c793bc49991f0fcf8 (diff) | |
Added cryptography functions and completed client and server.
Diffstat (limited to 'http-tester.py')
| -rw-r--r-- | http-tester.py | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/http-tester.py b/http-tester.py deleted file mode 100644 index 7cb5197..0000000 --- a/http-tester.py +++ /dev/null @@ -1,32 +0,0 @@ -from hashlib import sha256 -from base64 import b64encode -import json -import requests - - -URL = "http://localhost:8080/api" - - -def sign_data(data): - dump = json.dumps(data, separators=[",", ":"]) - print(dump) - payload = b64encode(dump.encode()) - print(payload.decode()) - signature = sha256(payload).hexdigest() - print(signature) - return f"{payload.decode()}.{signature}" - - -def test_get_user_key(): - data = { - "User": "ivan", - "Data": "andrew" - } - - signed_data = sign_data(data) - resp = requests.post(f"{URL}/getUserKey", data=signed_data) - print(resp.status_code) - print(resp.json()) - - -test_get_user_key()
\ No newline at end of file |