123456789101112131415161718192021222324252627282930313233343536 |
- #!/usr/bin/env python3
- # Run example
- # ./scripts/generate-key
- # Use this to generate a signing key and verify key for use in sydent
- # configurations.
- # The signing key is generally used in "ed25519.signingkey" in the sydent config
- import sys
- import signedjson.key
- signing_key = signedjson.key.generate_signing_key(0)
- sk_str = "%s %s %s" % (
- signing_key.alg,
- signing_key.version,
- signedjson.key.encode_signing_key_base64(signing_key)
- )
- pk_str = signedjson.key.encode_verify_key_base64(signing_key.verify_key)
- if len(sys.argv) != 2 or sys.argv[1] != "--quiet":
- print(f"""
- A new key has been generated. To use it, update your sydent config file with the following:
- [crypto]
- ed25519.signingkey = {sk_str}
- For reference, the public (verification) key is {pk_str}
- """)
- else:
- print(f"""
- [crypto]
- ed25519.signingkey = {sk_str}
- """)
|