Created
August 19, 2020 02:05
-
-
Save abramsymons/18ae302d1c9eaeeb2acb62971b2621f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import time | |
import requests | |
import base64 | |
import ed25519 | |
URL = 'http://test.brightid.org/brightid/v5/operations' | |
PRIVATE = '' | |
op = { | |
'name': 'Sponsor', | |
'app': 'idchain', | |
'contextId': '0xe8fb09228d1373f931007ca7894a08344b809013', | |
'timestamp': int(time.time()*1000), | |
'v': 5 | |
} | |
signing_key = ed25519.SigningKey(base64.b64decode(PRIVATE)) | |
message = json.dumps(op, sort_keys=True, separators=(',', ':')).encode('ascii') | |
sig = signing_key.sign(message) | |
op['sig'] = base64.b64encode(sig).decode('ascii') | |
r = requests.post(URL, json.dumps(op)) | |
print(r.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment