diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-03-12 08:14:28 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-03-12 08:23:52 +0200 |
commit | acc07e96b0893cbd26f813bd6bd3e16c47d74c5b (patch) | |
tree | 0628b1bc5b461bc66d63f0cefb0fe55404a80906 | |
parent | f9bc38487ee38900c740be2b5b0cf07901f29ca4 (diff) | |
download | extrautils-acc07e96b0893cbd26f813bd6bd3e16c47d74c5b.tar.gz |
refactor(jwt-decode): reformat, port to Python3
-rwxr-xr-x | jwt-decode | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -1,10 +1,8 @@ -#!/usr/bin/python +#!/usr/bin/python3 import json import sys -import Crypto.PublicKey.RSA - import jwt @@ -13,7 +11,7 @@ def catf(f): def cat(filename): - with open(filename, 'r') as f: + with open(filename, "r") as f: return catf(f) @@ -26,13 +24,10 @@ elif len(sys.argv) == 2: elif len(sys.argv) == 3: token = cat(sys.argv[1]).strip() pubkey_text = cat(sys.argv[2]) - opts = { - 'verify_aud': False, - 'verify_iss': False, - } + opts = {"verify_aud": False, "verify_iss": False} obj = jwt.decode(token, verify=True, key=pubkey_text, options=opts) else: assert 0 json.dump(obj, sys.stdout, indent=4) -sys.stdout.write('\n') +sys.stdout.write("\n") |