-
Notifications
You must be signed in to change notification settings - Fork 22
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
EIP1271 Support #617
base: epic-v0.6.x
Are you sure you want to change the base?
EIP1271 Support #617
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## epic-v0.6.x #617 +/- ##
==============================================
Coverage ? 89.34%
==============================================
Files ? 76
Lines ? 6671
Branches ? 367
==============================================
Hits ? 5960
Misses ? 675
Partials ? 36 ☔ View full report in Codecov by Sentry. |
3e9afe8
to
7ad1a6c
Compare
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.
Very complete tests, great! 🙌
I just left a small question.
public readonly signature: string, | ||
) {} | ||
|
||
public async getOrCreateAuthSignature(): Promise<EIP1271AuthSignature> { |
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.
Maybe I'm missing something, but the function name (getOrCREATEAuthSignature()
) makes me think that the function is able to create a new EIP1271AuthProvider
object, but this is not correct, right? This function will be called only for already created objects. Should we rename it?
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.
makes me think that the function is able to create a new EIP1271AuthProvider object
It's the flip. AuthProviders implement the function getOrCreateAuthSignature()
. The AuthProvider is specified as a parameter to the ConditionContext, which then uses it to generate an AuthSignature via the getOrCreateAuthSignature()
function.
So for EIP1271 as an example the code looks like the following:
const authProvider = new EIP1271AuthProvider(...);
conditionContext.addAuthProvider(':userAddressEIP1271', authProvider)
...
const decryptedMessage = await decrypt(
...
messageKit,
conditionContext,
);
This conditionContext can then provide the auth signature data needed for proving ownership using the auth provider - see https://github.com/derekpierre/taco-web/blob/eip1271-support/packages/taco/src/conditions/context/context.ts#L116.
This function will be called only for already created objects. Should we rename it?
The getOrCreateAuthSignature()
was named (perhaps incorrectly so) as such because it may not actually create the object because the auth signature object could be cached. For example, EIP4361 caches the auth signature after first creating it for 2 hours and doesn't need to create it again within that 2 hours i.e. subsequet calls to getOrCreateAuthSignature
simply uses the cached object if called again within that 2-hour window. That being said, perhaps the name is too tied to implementation. we can always rename it to getAuthSignature()
or something else ... although let's do that in a different PR ...?
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.
Got it!
|
Yes, something to consider, but in a different PR.
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.
Filed #621
Found a separate issue. Moving to draft. |
Expand existing AuthSignature type and schema to accomodate new type. Update LocalStorage to be type-specific via generics.
…better organized. Add condition context tests for EIP1271 reserved context param.
7ad1a6c
to
b507f29
Compare
Updates AuthProviderType to handle multiple provider types for USER_ADDRESS_PARAM_DEFAULT while maintaining single type for external EIP4361. Updates related tests to properly map auth provider keys.
Adds fakeBogusProvider export with proper ExternalProvider implementation to enable testing of authentication failure cases.
b5ec704
to
b84e8eb
Compare
Issue resolved. |
Will be resolved in separate PR
Need to re-review updated changes
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.
Great! LGTM 🙌
Type of PR:
Required reviews:
Co-authored by @theref
What this does:
Based over #616 .
:userAddress
to be EIP4361, EIP4361 Single Sign On, EIP1271 (Smart contract wallet). Before we only allowed EIP4361 (non-single sign-on but this was too restrictive)Issues fixed/closed:
Related to nucypher/nucypher#3576.
Follow-up issue: #620
Why it's needed:
Notes for reviewers: