Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Install nacl:
- pip install pynacl
- """
- from base64 import b32encode
- from typing import NamedTuple
- from nacl.public import PrivateKey
- class ClientAuth(NamedTuple):
- private: str
- public: str
- def gen_keys() -> ClientAuth:
- private = PrivateKey.generate()
- private_key = b32encode(bytes(private)).decode("ascii")[:-4]
- public_key = b32encode(bytes(private.public_key)).decode("ascii")[:-4]
- return ClientAuth(private_key, public_key)
- print(gen_keys())
Add Comment
Please, Sign In to add comment