migration command added, OTP creds can be read from environment variables, json output is now formated nicely

This commit is contained in:
ahmadbilalkhalid 2019-08-12 17:56:19 +05:00
commit 61d1633599
5 changed files with 59 additions and 33 deletions

View file

@ -1,4 +1,5 @@
import click
import json
from dataclasses import dataclass
from pyotp import TOTP
@ -11,6 +12,10 @@ class OTPCredentials:
seed: str
def get_json(self):
print(self.name, self.realm, self.seed)
r = {"name": self.name, "realm": self.realm, "token": TOTP(self.seed).now()}
return r
def load_dump_pretty(content):
parsed = json.loads(content)
return json.dumps(parsed, indent=4, sort_keys=True)