mirror of
https://github.com/ijprest/keyboard-layout-editor.git
synced 2026-04-27 09:30:44 -07:00
Implemented as a POST upload to AWS/S3. -- Each layout is a separate file; identified by its MD5 hash -- No real security to protect against malicious users "erasing" layouts, but S3 offers versioning. Also: -- Added save button on the toolbar. -- Added load/save alert boxes. -- Added Ctrl+S hotkey to save.
17 lines
No EOL
557 B
Python
17 lines
No EOL
557 B
Python
import base64
|
|
import hmac, hashlib
|
|
|
|
f = open('aws-private-key.txt','rt')
|
|
AWS_SECRET_ACCESS_KEY = f.read()
|
|
f = open('upload-policy.txt','rt')
|
|
|
|
policy_document = f.read()
|
|
policy_document = policy_document.replace("\n","").replace("\r","").replace("\t","").replace(" ","");
|
|
policy = base64.b64encode(policy_document)
|
|
signature = base64.b64encode(hmac.new(AWS_SECRET_ACCESS_KEY, policy, hashlib.sha1).digest())
|
|
|
|
print "Signing Policy:", policy_document
|
|
print "Using secret key:", AWS_SECRET_ACCESS_KEY
|
|
print
|
|
print "Policy:", policy
|
|
print "Signature:", signature |