Ed25519 signature invalid

I am trying to use websockets to control my orders. But I failed to connect on auth process.

Below is function to get the signature

def get_signature(self, private_key):
        timestamp = int(time.time() * 1000)

        params = {
            "apiKey" : self.BINANCE_SOCKET_API_KEY,
            "timestamp": timestamp
        }
        
        payload = '&'.join([f'{param}={value}' for param, value in sorted(params.items())])
        signature = base64.b64encode(private_key.sign(payload.encode('ASCII')))
        
        return signature.decode('ASCII')

And below is where the get_signature function call is made :

with open(self.BINANCE_SOCKET_API_KEY_PATH, 'rb') as f:
            private_key = load_pem_private_key(data=f.read(),password=None)
        print("private key : ", private_key)
        print("self.BINANCE_SOCKET_API_KEY_PATH : ", self.BINANCE_SOCKET_API_KEY_PATH)
        signature = self.get_signature(private_key)
        try : 
            socket = await ws.connect(ENDPOINT)

            login_params = {
                "id": rand,
                "method": "session.logon",
                "params": {
                    "apiKey": self.BINANCE_TEST_SOCKET_API_KEY,
                    "signature": signature,
                    "timestamp": int(time.time()*1000)
                    }
                } if self.is_test else {
                    "id": rand,
                    "method": "session.logon",
                    "params": {
                        "apiKey": self.BINANCE_SOCKET_API_KEY,
                        "signature": signature,
                        "timestamp": int(time.time()*1000)
                    }
                }
            param = ujson.dumps(login_params)
            try : 
                await socket.send(param)
                auth_response = await socket.recv()
                print("response from binance websocket : ", auth_response)

I got the PRIVATE_KEY.pem and PUBLIC_KEY.pem with following command on terminal.

openssl genpkey -algorithm ed25519 -out PRIVATE_KEY.pem
openssl pkey -pubout -in PRIVATE_KEY.pem -out PUBLIC_KEY.pem

What could be fixed for my problem?