-
Notifications
You must be signed in to change notification settings - Fork 71
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
Feature: replace jsbn
with native BigInt
#169
Comments
I agree but we still use some methods of jsbn that will need to be
implemented on top of BigInt… I may not get to it for some months so PRs
would be very much appreciated :)
…On Sun, Feb 18 2024 at 20:31, Evgeny ***@***.***> wrote:
It would be nice to replace jsbn with native BigInt.
It is widely supported even in browsers https://caniuse.com/bigint
—
Reply to this email directly, view it on GitHub
<#169>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAPCX4WXNN3YYQR5XE2VWLYULBSTAVCNFSM6AAAAABDOXGCPOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2DCNBSGYYDINA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Please consider (when you are taking this step) also providing a proper implementation of toJSON that doesn't expose Thanks for the great job guys |
You can easily serialize BigInt into JSON with a JSON.stringify(obj, (_, v) => typeof v === 'bigint' ? v.toString() : v) |
Yes it can be done, but it means that you could inadvertently break something down the stream. It happened to me and I ended patching my serializer with a custom replacer, and it also happened on another project, which ended with a slightly different version of the replacer. This mean that the same class might have a different serialization in every project, which is not ideal IMHO. This is why added the recommendation, because that way you will ensure that the class gets serialized in the same way in every place, and can define your own rules for hydration, perhaps with static methods, or any other variant. ensuring consistency at the end of the day. |
It would be nice to replace
jsbn
with nativeBigInt
.It is widely supported even in browsers https://caniuse.com/bigint
The text was updated successfully, but these errors were encountered: