0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-24 09:34:05 +01:00
synapse/scripts-dev/dump_macaroon.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
532 B
Python
Raw Normal View History

#!/usr/bin/env python
2016-02-03 12:27:39 +01:00
import sys
import pymacaroons
2016-02-03 12:27:39 +01:00
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())
2016-02-03 12:27:39 +01:00
print("")
2016-02-03 12:27:39 +01:00
verifier = pymacaroons.Verifier()
verifier.satisfy_general(lambda c: True)
try:
verifier.verify(macaroon, key)
print("Signature is correct")
2016-02-03 12:27:39 +01:00
except Exception as e:
print(str(e))