payton / django-siwe-auth

A complete Django authentication system overhall for Web3 utilizing Sign-In with Ethereum.
MIT License
26 stars 6 forks source link

Option to skip ENS lookup, so devs can use project without a `settings.PROVIDER` #19

Closed pconerly closed 2 years ago

pconerly commented 2 years ago

The feature to detect an ENS name (as well as ERC721 membership) is great, but it'd be cool to have an option for disable ENS-checking so that the settings.PROVIDER settings can be optional. After all, the authentication doesn't need it! I think this'd help speed up users playing with the library too.

payton commented 2 years ago

That's a good idea!

I've been iterating on this project in another project of mine. One thought I had is that it would be nice to instead define the role -> contract/token mapping in a model instead of statically in settings... For my use-case, I've found it necessary to branch out from an initial set of contracts/tokens.

Do you have any initial thoughts or opinions on that proposal, @pconerly ?

pconerly commented 2 years ago

I think that the way it is now (having Wallet with a many-to-many to django.contrib.auth.models.Group) is appropriate? But maybe I'm not understanding totally.

When you branch out from an initial set of contracts, is this with an existing set of Users/Wallets & Groups in production? I'm guessing the pain is that when you add a new contract in settings.CUSTOM_GROUPS you'd have to run a script to check all the wallets for membership in that new contract.

I'm going to be working on an app that keeps track of membership in one ERC721, I'll let you know if I have any thoughts from my experience using django-siwe-auth

payton commented 2 years ago

(having Wallet with a many-to-many to django.contrib.auth.models.Group) is appropriate

Ah, I do agree that having a many-to-many relationship is ideal, @pconerly. I'm more so asking if it makes sense to move the custom groups configuration into a model so it is persistent and dynamic. Currently, you would need to modify settings and restart the service for a persistent change to custom groups.

In the projects I'm using this for, I've come across some scenarios where I may need to add new collections or tokens more frequently.

You do bring up a good point about retroactively applying new groups. I think that's another very valid problem to solve.

Please do keep me updated on your experience and feedback!

payton commented 2 years ago

Resolved in #23