def METHOD_NAME(self) -> str:
    key_type = ""
    if isinstance(self, Ed25519Key):
        key_type = "matrix-ed25519"
    else:  # pragma: no cover
        raise NotImplementedError(f"Invalid key type {type(self.key)}")
    line = f"{self.user_id} {self.device_id} {key_type} {str(self.key)}\n"
    return line