mirror of https://github.com/watcha-fr/synapse
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
531 B
25 lines
531 B
9 years ago
|
#!/usr/bin/env python2
|
||
|
|
||
|
import pymacaroons
|
||
|
import sys
|
||
|
|
||
|
if len(sys.argv) == 1:
|
||
|
sys.stderr.write("usage: %s macaroon [key]\n" % (sys.argv[0],))
|
||
|
sys.exit(1)
|
||
|
|
||
|
macaroon_string = sys.argv[1]
|
||
|
key = sys.argv[2] if len(sys.argv) > 2 else None
|
||
|
|
||
|
macaroon = pymacaroons.Macaroon.deserialize(macaroon_string)
|
||
|
print macaroon.inspect()
|
||
|
|
||
|
print ""
|
||
|
|
||
|
verifier = pymacaroons.Verifier()
|
||
|
verifier.satisfy_general(lambda c: True)
|
||
|
try:
|
||
|
verifier.verify(macaroon, key)
|
||
|
print "Signature is correct"
|
||
|
except Exception as e:
|
||
|
print e.message
|