Download the PHP package karhal/web3-connect without Composer
On this page you can find all versions of the php package karhal/web3-connect. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download karhal/web3-connect
More information about karhal/web3-connect
Files in karhal/web3-connect
Package web3-connect
Short Description Allows login on symfony application via ethereum wallet
License MIT
Informations about the package web3-connect
Web3 Wallet Connect Bundle
Description
This Symfony bundle lets your users authenticate with their ethereum wallet. To do this you only need them to sign a message with their wallet.
This bundle uses the EIP-4361, it is meant to work with the spruceid/siwe library
Why ?
Your wallet lets you connect to any decentralized application using your Ethereum account. It's like a login you can use across many dapps. This bundle is here to bring this feature to every Symfony website.
Getting started
Installation
Configuration
config/packages/web3_connect.yaml
config/packages/security.yaml
config/routes.yaml
Update the model of the class representing the user by implementing the Web3UserInterface
Then update your storage
`
Now you're good to go
Usage
The bundle provides a signature route to generate the message to sign. Once the message signed, send it back with the address which signed it.
Step 1: Get the nonce
Before each signature, get the nonce from the backend
Step 2: Generate the message
Step 3: Send the message with his signature
Full example with the spruceid/siwe-quickstart example
The bundle will verify the signed message is owned by the address. If true, the owner of the address from your storage will be loaded as a JWT token.
Response:
`
Step 4: Access authorized routes
You can now make requests to authorized routes by adding the http_header
to the headers of your requests with the value of the just generated token.
Step 5: Customize the bundle Response
Just before returning the Response the bundle dispatch a DataInitializedEvent
event providing a data array you can fill to provide some extra information to your front.
You can add any data you want by listening to this event and call his setData
method.
Response:
Resources
- Fast Elliptic Curve Cryptography in PHP
- Ethereum-PHP
- https://medium.com/fabric-ventures/what-is-web-3-0-why-it-matters-934eb07f3d2b
- https://medium.com/mycrypto/the-magic-of-digital-signatures-on-ethereum-98fe184dc9c7
- https://eips.ethereum.org/EIPS/eip-4361#message-field-descriptions
What's an Ethereum wallet?
Ethereum wallets are applications that let you interact with your Ethereum account. Think of it like an internet banking app – without the bank. Your wallet lets you read your balance, send transactions and connect to applications.
“No more remembering unique passwords for separate sites. No more creating unique email addresses for different services. No more having to worry about the site you are interacting with having your data stolen from them. Pure, self-sovereign control of your accounts across the Internet. No usernames, passwords, or identifying information other than the public key that is derived upon sign up.”
Tests
License
The MIT License (MIT). Please see License File for more information.
All versions of web3-connect with dependencies
illuminate/support Version ^10.0
kornrunner/keccak Version ^1.1
simplito/elliptic-php Version ^1.0
symfony/validator Version 6.4.*
symfony/security-bundle Version 6.4.*
symfony/dependency-injection Version >=5.4
ext-json Version *
doctrine/doctrine-bundle Version ^2.7
firebase/php-jwt Version ^6.0.0
symfony/event-dispatcher Version >=5.4
symfony/cache Version >=6.0
doctrine/orm Version *