import click import json from dataclasses import dataclass from pyotp import TOTP @dataclass class OTPCredentials: name: str realm: str seed: str def get_json(self): 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)