-
Notifications
You must be signed in to change notification settings - Fork 3
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
Implement login via eth wallet #52
Comments
hmm.. what do you mean by "official" - what is the entity? also i've found a bunch of articles from metamask/ethereum itself on siging messages, but not on how its used in an auth process. Are those way too different from the link that's being asked for or do they suffice? |
Whatever entity came up with the spec. If there is a web spec for it, then it's should be from W3C, if it's from ethereum, then one from them, etc.
This implies that I know the state of the crypto-based authentication, but I am not. In the best case there is a spec on how this kind of authentication suppose to work with libraries that implement it for multiply wallets. In the worst case there is nothing and we have to figure out everything ourself from scratch starting from message signing. By the fact that I've seen websites that implement requested feature I assume we wouldn't be the first to do that and that probably there are libraries/knowledge to build upon without reinventing the wheel |
well, here's a batch of links
Feel free to react to the above already. For now i will read & understand in detail what i've linked above (e.g. w3c spec and the npm package) and propose the more detailed impl flow in the next post. |
Few quick points:
|
does not look like it can work without the client id |
Impl proposal is as follows:
|
So the spec is EIP-4361 (linking it, since it wasn't mentioned above). Following the task list of the issue:
I think there is now no user-facing difference between signIn and signUp, so should be a single mutation for that. And additionally there is a new mutation for receiving the challenge. Can you please in more details describe how they would work together, when records will be created/updated? Because
Ideally, there is already a component that accepts multiply wallet providers including hardware wallets. If this functionality can be separated into a different PR, you can do that, the responsibility of the first PR is to ensure they will be compatible. |
This post is solely regarding the
the package version what has this in patchnotes is 0.2.0 and then there's an issue bytesbay/web3-token#12 that asks to follow the spec with the response "done" on the same date. No pr attached, no ground provided to the 90%. and it seems the mainainer pushes (or used to) directly to main without documenting the steps and reasoning i found this commit on the main branch on the same date as above bytesbay/web3-token@db73a52#diff-1cf10e2d963e76f47a9159a602cb2b8706c6c0f542fa653cbff205cb622720ea Unless i am blind, there's also no commit message that details the changes and their reasoning. which then means, in order to figure out the 10% of the difference, i have to get proficient in the package's code and then compare my knowledge with the spec. 😨 I am deprioritising this part of investigation now |
Here is the shorter version of the spec with the most relevant info:
I would say that there certainly are, e.g. ones listed above. But the current once seems most relevant to us.
Hard, but not that we have much choice here, do we? Given that the spec description is fairly clear and there's already a pending investigation for what is the 10% Since there can now be no trust to the existing package without documentation on how exactly it is different from the spec,
True, sorry if this was not clear from initial wording :D
after thinking about it for more, it seems that we just should first sort out the approach with the existing
👍 |
Which other specs are listed above? I can only see EIP-4361 that I've linked. My question intends to check and compare if there are better, more commonly used specs that exists/plays well with web standards, like https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API (I know it's something else, the key word is "like")
Before rewriting the package, I would properly search if there are existing packages that implements required functionality. Quickly googling reveals packages that wasn't linked above:
Why can't we use them?
I think you missed very important point here: |
this #52 (comment) contains the bunch of references to specs. I'm not sure if you're considering them as such , at least i do I could look further obviously, but i doubt it's worth it since there's the official one. Also quick googling (< 10 minutes) did not provide me with something that looks like worth mentioning
there's no reason to not use one of the ones you've linked. Moreover, it seems like Specifically relating to the backend example as here we could:
siwe does this which seems reasonable. Since it uses proper generation with alphanumeric chars under the hood. in any case, we could just use session id as nonce and additionally check that it matches the one that we expect the wallet to have. Otherwise we afai understand would have to do double work to esnure that auto-generated nonce is actually matching the one that the message has signed. i would suggest that i try out the PoC draft with the |
Agree, challenge = session id = nonce. I would say uuid is sufficient
Checking challenge against the wallet is not sufficient and is not needed, we need to ensure that challenge was used only once. Once again, attack vector is:
I would instead propose to maybe reuse session table by adding something like status column. When challenge is requested we send the complete message to be signed, and already create session record with status
Alright, but I don't want to conclude the investigation, since almost none of the tasks listed in this issue was not followed properly yet (nor ticked) |
i see a set changes that are consequences of this proposal that make data less... reliable/consitent (idk what is the proper workding here, so see the example):
so, say we add the column with the status, then:
having a memory hashmap splits the state management logic. and solves all (1) - (4). The code that is to be written for this though is not the greater amount. The downside is obviously that one has to clean it up once in a while:
|
No problem for me if you would use another table to store challenges. But please avoid in-memory hashmaps since they are not transparent, don't work well with pod restarts, scaling, etc. I don't see a reason to store something in memory in the first place since the operation doesn't require speed optimisation. |
Summary of the discussion to make it in accordance with issue checklist
initial poc as per #52 (comment) and this but with table instead of hashmap
|
EIP-4361, supported by Metamask
|
Goal
User is able to login via eth wallet
Context
Instead of using login + password implemented initially (based on the initial requirements), we should aim to support blockchain-based authentication as the primary one, based on the new input in powerhouse-inc/powerhouse#358. Therefore, login + password authentication have to be removed and instead a new authentication methods have to be introduced. On the technical level: we would ask the user to sign an off-chain message (e.g. sessionId) using their wallet (e.g. metamask), then confirm that signed message actually signed by the address that they claim to own. The result of the procedure will be (as far as I understand the procedure):
eth:0x...
format (instead of the login) stored in the databaseMy current, uneducated understanding:
Tasks
The text was updated successfully, but these errors were encountered: