Skip to content

Instantly share code, notes, and snippets.

@abramsymons
Last active August 19, 2022 15:23
Show Gist options
  • Save abramsymons/0103ccc7d3f49129e351cba722031d49 to your computer and use it in GitHub Desktop.
Save abramsymons/0103ccc7d3f49129e351cba722031d49 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/v6/operations'
PRIVATE = ''
op = {
'name': 'Sponsor',
'app': 'Manna',
'appUserId': '0xe8fb09228d1373f931007ca7894a08344b809013',
'timestamp': int(time.time()*1000),
'v': 6
}
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