معرفی شرکت ها


django-web3-auth-0.1.6


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

django-web3-auth is a pluggable Django app that enables login/signup via an Ethereum wallet (a la CryptoKitties). The user authenticates themselves by digitally signing the session key with their wallet's private key.
ویژگی مقدار
سیستم عامل -
نام فایل django-web3-auth-0.1.6
نام django-web3-auth
نسخه کتابخانه 0.1.6
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Bearle
ایمیل نویسنده tech@bearle.ru
آدرس صفحه اصلی https://github.com/Bearle/django-web3-auth
آدرس اینترنتی https://pypi.org/project/django-web3-auth/
مجوز MIT
============================= Django-Web3-Auth ============================= .. image:: https://badge.fury.io/py/django-web3-auth.svg :target: https://badge.fury.io/py/django-web3-auth .. image:: https://travis-ci.org/Bearle/django-web3-auth.svg?branch=master :target: https://travis-ci.org/Bearle/django-web3-auth .. image:: https://codecov.io/gh/Bearle/django-web3-auth/branch/master/graph/badge.svg :target: https://codecov.io/gh/Bearle/django-web3-auth django-web3-auth is a pluggable Django app that enables login/signup via an Ethereum wallet (a la CryptoKitties). The user authenticates themselves by digitally signing the session key with their wallet's private key. .. image:: https://github.com/Bearle/django-web3-auth/blob/master/docs/_static/web3_auth_test.gif?raw=true Documentation ------------- The full documentation is at https://django-web3-auth.readthedocs.io. Example project --------------- https://github.com/Bearle/django-web3-auth/tree/master/example You can check out our example project by cloning the repo and heading into example/ directory. There is a README file for you to check, also. Features -------- * Web3 API login, signup * Web3 Django forms for signup, login * Checks ethereum address validity * Uses random token signing as proof of private key posession * Easy to set up and use (just one click) * Custom auth backend * VERY customizable - uses Django settings, allows for custom User model * Vanilla Javascript helpers included Quickstart ---------- Install Django-Web3-Auth with pip:: pip install django-web3-auth Add it to your `INSTALLED_APPS`: .. code-block:: python INSTALLED_APPS = ( ... 'web3auth.apps.Web3AuthConfig', ... ) Set `'web3auth.backend.Web3Backend'` as your authentication backend: .. code-block:: python AUTHENTICATION_BACKENDS = [ 'django.contrib.auth.backends.ModelBackend', 'web3auth.backend.Web3Backend' ] Set your User model's field to use as ETH address provider: .. code-block:: python WEB3AUTH_USER_ADDRESS_FIELD = 'username' And if you have some other fields you want to be in the SignupForm, add them too: .. code-block:: python WEB3AUTH_USER_SIGNUP_FIELDS = ['email',] Add Django-Web3-Auth's URL patterns: .. code-block:: python from web3auth import urls as web3auth_urls urlpatterns = [ ... url(r'^', include(web3auth_urls)), ... ] Add some javascript to handle login: .. code-block:: html <script src="{% static 'web3auth/js/web3auth.js' %}"></script> .. code-block:: javascript function startLogin() { if (typeof web3 !== 'undefined') { checkWeb3(function (loggedIn) { if (!loggedIn) { alert("Please unlock your web3 provider (probably, Metamask)") } else { var login_url = '{% url 'web3auth:web3auth_login_api' %}'; web3Login(login_url, console.log, console.log, console.log, console.log, console.log, function (resp) { console.log(resp); window.location.replace(resp.redirect_url); }); } }); } else { alert('web3 missing'); } } You can access signup using {% url 'web3auth:web3auth_signup' %}. If you have any questions left, head to the example app https://github.com/Bearle/django-web3-auth/tree/master/example Important details and FAQ ------------------------- 1. *If you set a custom address field (WEB3AUTH_USER_ADDRESS_FIELD), it MUST be unique (unique=True).* This is needed because if it's not, the user can register a new account with the same address as the other one, meaning that the user can now login as any of those accounts (sometimes being the wrong one). 2. *How do i deal with user passwords or Password is not set* There should be some code in your project that generates a password using ``User.objects.make_random_password`` and sends it to a user email. Or, even better, sends them a 'restore password' link. Also, it's possible to copy signup_view to your project, assign it a url, and add the corresponding lines to set some password for a user. 3. *Why do i have to sign a message? It's not needed in MyEtherWallet or other DApps!* The main reason is that when using a DApp, you most likely don't have an account on the website, it's accessible only with web3 (Metamask). When using web3 only to sign into user account, it is necessary to prove your identity with a private key (e.g. sign a random message), because when we have backend we can't trust any user just by his knowledge of the public address. Signed message proves that user possesses the private key, associated with the address. Running Tests ------------- Does the code actually work? :: source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install tox (myenv) $ tox Credits ------- Tools used in rendering this package: * Cookiecutter_ * `cookiecutter-djangopackage`_ .. _Cookiecutter: https://github.com/audreyr/cookiecutter .. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage 0.1.6 (2021-09-06) ++++++++++++++++++ * Update from PR#6 by @hiporox * Resolve's issue #4 - Example app has missing url configuration 0.1.5 (2021-09-06) ++++++++++++++++++ * Update from PR#5 by @hiporox * Updated .gitignore to include missing file types * Added script tag to the base.html that imports web3 since MetaMask no longer auto imports (https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3) History ------- 0.1.4 (2021-05-06) ++++++++++++++++++ * Try fix rlp 0.1.3 (2021-03-23) ++++++++++++++++++ * Try fix ethereum 0.1.2 (2021-03-16) ++++++++++++++++++ * Flake8, tox fixes in PR#2 by SukiCZ 0.1.1 (2021-03-16) ++++++++++++++++++ * Bump 'rlp' - PR#1 by SukiCZ 0.1.0 (2018-06-29) ++++++++++++++++++ * First release on PyPi


نحوه نصب


نصب پکیج whl django-web3-auth-0.1.6:

    pip install django-web3-auth-0.1.6.whl


نصب پکیج tar.gz django-web3-auth-0.1.6:

    pip install django-web3-auth-0.1.6.tar.gz