generate-key 774 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python3
  2. # Run example
  3. # ./scripts/generate-key
  4. # Use this to generate a signing key and verify key for use in sydent
  5. # configurations.
  6. # The signing key is generally used in "ed25519.signingkey" in the sydent config
  7. import signedjson.key
  8. signing_key = signedjson.key.generate_signing_key(0)
  9. sk_str = "%s %s %s" % (
  10. signing_key.alg,
  11. signing_key.version,
  12. signedjson.key.encode_signing_key_base64(signing_key)
  13. )
  14. pk_str = signedjson.key.encode_verify_key_base64(signing_key.verify_key)
  15. print(
  16. "# A new key has been generated. To use it, update your sydent config file with the following: \n"
  17. "\n"
  18. "[crypto]\n"
  19. f"ed25519.signingkey = {sk_str}\n"
  20. "\n"
  21. f"# For reference, the public (verificiation) key is {pk_str}\n"
  22. )