-
Notifications
You must be signed in to change notification settings - Fork 775
feat: add RSA and ed22519 support #927
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
Conversation
src/node-binance-api.ts
Outdated
| unarmorKey(a:string):number[] { | ||
| // eslint-disable-next-line no-useless-escape | ||
| const m = /-----BEGIN [^-]+-----\n([A-Za-z0-9+\/=\s]+)\n-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/.exec(a); | ||
| if (m) { | ||
| if (m[1]) { | ||
| a = m[1]; | ||
| } else if (m[2]) { | ||
| a = m[2]; | ||
| } else { | ||
| throw new Error("RegExp out of sync"); | ||
| } | ||
| } | ||
| return base64.decode(a); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't use this method at all, why do we need it? it is confusing (which might scare some users), does an exec, ... all red flags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw most crypto libs already properly parse the private key headers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
about this, I've just copy-pasted that unarmor function from ccxt:
https://github.com/ccxt/ccxt/blob/master/ts/src/base/functions/crypto.ts#L110 (the source is also in ccxt: https://github.com/ccxt/ccxt/blob/master/ts/src/static_dependencies/jsencrypt/lib/asn1js/base64.ts#L74 ), i didn't even look in details of it
as it's bad, we should also remove from ccxt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ttodua if you check the latest implementation in this branch it does not use any of that
No description provided.