uncloud-cli/commands/helper.py

15 lines
276 B
Python

import click
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