~sircmpwn/core.sr.ht

ref: 0.53.1 core.sr.ht/srht-webhook-keygen -rwxr-xr-x 714 bytes
53dc499eDrew DeVault Bump base font size 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python3
import base64
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from cryptography.hazmat.primitives import serialization

private_key = Ed25519PrivateKey.generate()
private_key_b = private_key.private_bytes(
        format=serialization.PrivateFormat.Raw,
        encoding=serialization.Encoding.Raw,
        encryption_algorithm=serialization.NoEncryption())
print("Private key: " + base64.b64encode(private_key_b).decode())

public_key = private_key.public_key()
public_key_b = public_key.public_bytes(
        encoding=serialization.Encoding.Raw,
        format=serialization.PublicFormat.Raw)
print("Public key: " + base64.b64encode(public_key_b).decode())