-
create database 'edge-node-auth-service'
CREATE DATABASE `edge-node-auth-service`;
-
Create a .env file
cp .env.example .env
-
If your MySQL is password-protected, add your MySQL password to DB_PASSWORD variable in .env file
-
generate random strings for following .env variables: JWT_SECRET and SECRET (you can use openssl rand -hex 64 for example)
-
Install dependencies
npm install
-
Migrate the DB
npx sequelize-cli db:migrate
-
Generate a demo user
npx sequelize-cli db:seed:all
-
Update this MySQL query (UserConfig.sql) with real values of:
- your v8 DKG Core node endpoint (run_time_node_endpoint) and port (run_time_node_port)
- your Paranet UAL (edge_node_paranet_ual) (you can do it later, but the Edge node will not work without it. Paranet should be created before, in Preparation steps)
-
Execute your MySQL query from the previous step to define Edge node config parameters
-
Add your wallet to the "user_wallets" table by executing this query (example blockchain id - base:84532):
UPDATE user_wallets SET wallet = 'YOUR_WALLET', private_key = 'WALLET_PRIVATE_KEY', blockchain = 'BLOCKCHAIN_ID' WHERE id = 1;
-
Start the auth service
npm run start
Seeder will create example user with following credentials:
- username: admin
- password: admin123
Authentication flow explained (Edge node interface already have this integrated, no need for further steps):
- POST /login - provide username and password [x-www-form], this will embed cookie in next requests
- GET /auth/check - this route will return user and his config if the cookie from previous request is correct
Test can be done in Postman, no need to manually include cookie in next requests, it will be automatically applied.