-
Notifications
You must be signed in to change notification settings - Fork 143
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
Suggestion regarding siwe-parser usage of apg-js. #177
Comments
Hi @ldthomas, sry for the delay in answering this.
|
|
Hi @w4ll3, I've taken the liberty of rewriting the siwe parser. As I said, I know nothing about Etherium but I have had a lot of experience writing APG parsers. If you are interested we can figure out a way to get it incorporated into your repository. I could probably reconfigure it as a pull request. At the moment you can find it at siwe-suggestion. Its main features are:
I've added a large set of unit tests. I've included all of the RFC 3986 unit tests from
Your parser will throw an exception. The unit tests in
There are some other subtleties with the way
to Let me know if you have any interest in this and we can discuss how best to incorporate it into your repository. Best regards. |
Hey @ldthomas, would you put your work on a PR? I'm interested in the improvements you have made. |
@gilbert. Interesting. I haven't seen any activity on this repository at all since my last post 6 mo ago. I was beginning to think it was an abandoned project. I have a small project I need to finish up and then I'll need to get myself back up to speed on what I've done here. But yes, I should be able to come up with a PR in the next week or two if that works for you. |
@gilbert. BTW. Where do you fit into this project? I don't see your name anywhere as a contributor or fork owner. Do you have write access to merge PRs? |
Apologies for the lack of communication. @gilbert isn't associated with SpruceID or is a maintainer on this repo but they are right that a PR would be very welcomed. |
Hi @sbihel. I see that you are the author of many commits. Thanks for that clarification. As I said, it may take a week or two but I will put together a PR as soon as I can. |
Hi @sbihel. Before I create a fork and PR I'm doing a dry run on a simple clone of the latest version of In a nutshell, if I clone a fresh copy of
results in the error: For some reason this problem does not show up in my repository siwe-suggestion. Any suggestions? |
Hi. I just have a couple of suggestions about the
siwe-parser
usage ofapg-js
. I know nothing about Ethereum or Sign in with Ethereum and you may (even probably) have already considered these and have good reasons for doing things the way you already do. But these may make your program a little more efficient and faster and maybe even reduce some dependencies.1.) Why do you generate the grammar object each time you parse a msg? Why not generate the grammar object once and then simply import it each time you need it? Here is how that might look. Put the ABNF grammar in a separate file, say,
./dist/siwe-abnf.txt
. Then generate the grammar object withNow in
./lib/abnf.ts
replace your parsing line with the equivalent ofI don't know if speed and performance are an issue with you, but unnecessarily generating a grammar object each time processes the grammar through five phases, three of which are non-trivial.
2.) I think I know the answer to this but I will mention it anyway. I haven't figured out exactly where or how you use
uri-js
andvalid-url
but I notice that when you parse the message, you simply pull out the entire URI string and presumably parse it and verify it later with the dependency packages. Your grammar includes RFC 3986 so why not simply add a few more callback functions to the AST and pull outscheme, userinfo, host, port, path, query and fragment
in the aboveparser.parse()
statement? Why parse it twice? I'm guessing the answer is security and the special features you get with those other packages but wanted to point out the double parsing and ask anyway.The text was updated successfully, but these errors were encountered: