import base64

from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
from py_vapid import Vapid01


private_key = Vapid01()
private_key.generate_keys()

public_key = private_key.public_key.public_bytes(Encoding.X962, PublicFormat.UncompressedPoint)
public_key_b64 = base64.urlsafe_b64encode(public_key).rstrip(b"=").decode()
private_key_env = private_key.private_pem().decode().strip().replace("\n", "\\n")

print("VAPID_PUBLIC_KEY=" + public_key_b64)
print("VAPID_PRIVATE_KEY=" + private_key_env)
