s/ucloud/uncloud/g
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
parent
267828e85a
commit
280043659d
10 changed files with 10 additions and 10 deletions
20
uncloud_cli/commands/helper.py
Executable file
20
uncloud_cli/commands/helper.py
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
import json
|
||||
|
||||
from pyotp import TOTP
|
||||
|
||||
|
||||
class OTPCredentials:
|
||||
def __init__(self, name, realm, seed):
|
||||
self.name = name # type: str
|
||||
self.realm = realm # type: str
|
||||
self.seed = seed # type: str
|
||||
|
||||
def get_json(self):
|
||||
return {"name": self.name, "realm": self.realm, "token": TOTP(self.seed).now()}
|
||||
|
||||
|
||||
def load_dump_pretty(content):
|
||||
if isinstance(content, bytes):
|
||||
content = content.decode("utf-8")
|
||||
parsed = json.loads(content)
|
||||
return json.dumps(parsed, indent=4, sort_keys=True)
|
||||
Loading…
Add table
Add a link
Reference in a new issue