Support basic
auth when forking
#418
Comments
This seems to be an issue when using Chainstack as well, as they use HTTP Basic Auth. |
@aintabb, The basic auth check/parsing would happen here: https://github.com/trufflesuite/ganache-core/blob/685b1d9600f01d64faa96f46b0bd2197748d5682/lib/forking/forked_blockchain.js#L39-L61 To test, you'll need a free Infura account from: https://infura.io/. Then create a new Ethereum project and set it so it requires a Project Secret. The Project Secret is the part that goes into the URL: Tests need to be written which would go here: https://github.com/trufflesuite/ganache-core/blob/develop/test/smoke/forking/infura/simple.js (you should NOT commit your Infura url or project secret here! I can test this locally). To get started developing, checkout the develop branch, run Let me know if you are up for the task or not! Thanks! |
@davidmurdoch Thanks for the detailed explanation. I am gonna start to working on it. |
Awesome. I've assigned you just so no one else starts on it. Let me know if you no longer want to work on it and I'll remove the assignment. Thanks!!! |
@davidmurdoch Sure, you're welcome! |
Hi @davidmurdoch , |
I use VS Code's integrated debugger via the following configuration:
Don't forget to replace You can then set breakpoints in the margin in VS Code: And when you run the Mocha All debug config: VSCode will pause once the application reaches your breakpoints. You can then inspect the runtime variables and stack, as well as step through/over code. See https://code.visualstudio.com/docs/nodejs/nodejs-debugging for detailed info. And this looks like a decent short video walk-through of using and configuring the debugger (disclaimer: I haven't watched the whole thing): https://www.youtube.com/watch?v=2oFKNL7vYV8 |
Thank you, I appreciate that. |
@davidmurdoch During "Basic Auth", do the urls still get block height value delimited by @? If so, I don't there will be an issue during parsing. |
@aintabb You should still be able to parse To get the the "project secret": https://nodejs.org/api/url.html#url_url_password That said... I'm now thinking we don't even need to grab the password/secret itself, since the basic auth format (i.e., Hopefully that made sense? Let me know if you have more questions! |
@davidmurdoch Thanks for the response and the explanation. Still when we receive basic auth format url; let's say |
@aintabb, that sounds right; you'll have to tweak things a bit to get it working. Just FYI, I'm on holiday now (in the US) and likely won't be able to get back to my desktop to help out until until Monday. |
@davidmurdoch No worries! I am in US too. Enjoy your holiday! |
Infura uses HTTP Basic Auth now: https://infura.io/docs/gettingStarted/authentication
We'll need to add support for this.
Initial thoughts are to use url-based basic auth, via
wss://:YOUR-PROJECT-SECRET@example.com/v3/YOUR-PROJECT-ID
The text was updated successfully, but these errors were encountered: