def ed25519_public_key_to_string(key):
    """Convert an ed25519 public key to a base64-encoded string.

    Args:
        key (Ed25519PublicKey): the key to write to the file.

    Returns:
        str: the key representation as a str

    """
    return base64.b64encode(key.public_bytes(
        encoding=serialization.Encoding.Raw,
        format=serialization.PublicFormat.Raw,
    ), None).decode('utf-8')