telosnetwork / api-telos-net

api.telos.net
MIT License
0 stars 1 forks source link

Account creation with jwt security check #107

Closed Viterbo closed 8 months ago

Viterbo commented 8 months ago

Fixes #106

Description

This PR incorporates a new endpoint called accounts/create4google that receives the public keys (owner and active) and the JWT obtained from authenticating the user. With this info, the endpoint checks the JWT to avoid attacks and abuses and then creates a random account for that user

This endpoint also receives an optional suggested name to try first. If that name is not provided or is already used, the endpoint will create a random account.

Viterbo commented 8 months ago

I just created two more auxiliary functions to store and recover account names created for each Google user.

My problem is that the table I'm using for storing this information is not defined in the database. I need someone to create that table with the corresponding indexes.

I defined the variable googleUsersTableName in the ecosystem.config.js file with the following names:

const envDev = {
   // ...
   googleUsersTableName: 'dev-google-users-accounts',
};
const envProd = {
   // ...
   googleUsersTableName: 'prod-google-users-accounts',
}

The fields of the tables are: