-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add User Story for Computing Safe Address #463
Conversation
@@ -161,7 +161,7 @@ describe('WebAuthn Library', () => { | |||
// a large enough client data and exact gas limits to make this happen is a bit annoying, so | |||
// lets hope for no gas schedule changes :fingers_crossed:. | |||
const longClientDataFields = `"long":"${'a'.repeat(100000)}"` | |||
await expect(webAuthnLib.encodeSigningMessage(ethers.ZeroHash, '0x', longClientDataFields, { gasLimit: 1701001 })).to.be.reverted | |||
await expect(webAuthnLib.encodeSigningMessage(ethers.ZeroHash, '0x', longClientDataFields, { gasLimit: 1699001 })).to.be.reverted |
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.
Unrelated fix, caused by gas changes.
c3159a0
to
d12d35a
Compare
Pull Request Test Coverage Report for Build 9890279257Details
💛 - Coveralls |
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.
Small nit, rest LGTM.
0, | ||
ethers.ZeroAddress, | ||
]) | ||
const saltNonce = 42n |
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 have the answer to everything! 😅
Co-authored-by: Shebin John <[email protected]>
This PR partially addresses the comment #456 (comment) (cc @mmv08).
In doing some exploration around event indexing, I found that we don't really have a good developer story for it. There are two separate passkey flows, so I will address them separately.
Proxy + Factory Signer
The flow specific to using the
SafeWebAuthnSignerFactory
contract to deploy a credential-specific WebAuthn credential owner requires a service for indexing Safe owners in order to properly search Safes that are owned by a specific credential. While the WebAuthn credential signer address can be deterministically computed (seesignerFactory.getSigner(...)
function), it does not allow for us to search for all Safes that use this signer. This is because there are multiple events that affect theowners
list for a Safe (Setup
,Owner*
), and specifically owners added duringsetup
do not emit any event indexed by owner address, meaning you would have to check allSetup
events for all Safes in order to determine which Safes use the specific WebAuthn credential signer.There is, however, support for this in the transaction service API. So, right now, it should be possible to find all Safes owned by a WebAuthn credential by implementing something like:
However, this requires an API service to do this, and cannot be done alone with events.
Shared Signer
The flow specific to using the
SafeWebAuthnSharedSigner
contract suffers from the same issues as the other flow, in that finding Safes by owner is not really possible with events. Compounding on top of this, the transaction service API for listing Safes owned by addresses does not work for the shared signer at all, because it is a single address for all credentials.In the aforementioned PR, there was a proposal to add an indexed field:
This would allow for clients to search for
Configured
events for a particular Safe. Just the event is not enough, as the configuration may have changed, the shared signer may have been removed as an owner, the Safe may have never added the shared signer as an owner (and just called theconfigure
method for fun), or the shared signer may have been called by another contract that is not a Safe.This is also not a great developer story. I would recommend adding similar support to finding Safes by WebAuthn credential to the Safe transaction service as exists for finding Safes by owner. I also don't think that adding an indexed
publicKeyHash
is necessarily valuable, but it does make searching for Safes by WebAuthn credential possible, so we add it to the contracts in this PR.Conclusion
It isn't really possible to, just from indexed events, search for all Safes that are owned by a specific WebAuthn credential owner. If we do end up needing a feature for searching for Safes by WebAuthn credential public key (similar to searching for Safes by owner address), we would likely need to add support to the Safe transaction service for this.
For now, I created a user story to show how a "serverless" Dapp can use the Safe + Passkeys to "find" the Safe for the current credential. The idea is simply to compute the deterministic Safe address based on the public key credential.