Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for additional Binance API key types like Ed25519, RSA #1767

Open
SimonLeiner opened this issue Jul 2, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@SimonLeiner
Copy link

Feature Request

Instead of the typical HMAC Keys, Binance also Supports Ed25519 and RSA Keys.

"It is highly recommended to use Ed25519 API keys as it should provide the best performance and security out of all supported key types."

(Definitely not the most urgent enhancement, but a nice feature)

References:

@SimonLeiner SimonLeiner added the enhancement New feature or request label Jul 2, 2024
@cjdsellers
Copy link
Member

Hi @SimonLeiner

All of these algorithms still produce strings which can be used just like the typical HMAC keys.
Did you experience any blockers to using Nautilus with these other key types?

@SimonLeiner
Copy link
Author

Hey @cjdsellers !

I couldn't make it work with RSA or Ed25519 Keys. I looked a bit into it and in https://github.com/nautechsystems/nautilus_trader/blob/develop/nautilus_trader/adapters/binance/http/client.py

def _get_sign(self, data: str) -> str:
        m = hmac.new(self._secret.encode(), data.encode(), hashlib.sha256)
        return m.hexdigest()

it handles the hmac accordingly. However there is no function that Handles for E.g RSA Keys like

def _rsa_signature(self, query_string: str):
        assert self.PRIVATE_KEY
        h = SHA256.new(query_string.encode("utf-8"))
        signature = pkcs1_15.new(self.PRIVATE_KEY).sign(h)
        return b64encode(signature).decode()

taken from: https://github.com/sammchardy/python-binance/blob/master/binance/client.py

Thanks!

@cjdsellers cjdsellers changed the title Add Binance Adapter API Key Types like Ed25519, RSA Add support for additional Binance API key types like Ed25519, RSA Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants