In your blockchain:
- Create tblUser stream and subscribe it
- Create tblGeneral stream and subscribe it
Run the command:
composer install
Change .env.example to .env
Edit .env and add your rpc credentials
Run the command:
php artisan config:cache
Register
-
Generate the key value pair for the user
-
Add the new the value pair in the tlbGeneral stream in this format:
- key: [address]
- value: md5([address])
-
Add the registered user in the tblUser stream in this format:
- key: [email]
- value: [address] <---- encrypt it with AES, the secret key is the password
-
Create a stream for the current registered user in this format then subscribe it:
-
stream id/name: md5([address])
items:
- key: name - value: <name> - key: email - value: <email>
-
Login
- Get the input email and check if it exist in tblUser
- Decrypt the value from the tblUser using AES(secret key is the input password) to get the address
- Once we get the address, we will use it as a key in the tblGeneral in order to get the stream id/name
- Use the stream id/name to get the stream of the user