Skip to content

Instantly share code, notes, and snippets.

@abramsymons
Created August 19, 2020 02:05
Show Gist options
  • Save abramsymons/18ae302d1c9eaeeb2acb62971b2621f6 to your computer and use it in GitHub Desktop.
Save abramsymons/18ae302d1c9eaeeb2acb62971b2621f6 to your computer and use it in GitHub Desktop.
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