Set email using eth address
All checks were successful
Lint / lint (20.x) (pull_request) Successful in 4m54s

This commit is contained in:
Nabarun 2024-10-19 17:36:41 +05:30
parent 59a164f3f8
commit 794d6f51e9
3 changed files with 9 additions and 3 deletions

View File

@ -4,8 +4,11 @@
gqlPath = "/graphql"
[server.session]
secret = ""
# Frontend webapp URL origin
appOriginUrl = "http://localhost:3000"
# Set to true if server running behind proxy
trustProxy = false
# Backend URL hostname
domain = "localhost"
[database]

View File

@ -46,6 +46,9 @@ router.post('/authenticate', async (req, res) => {
}
});
//
// SIWE Auth
//
router.post('/validate', async (req, res) => {
const { message, signature } = req.body;
const { success, data } = await new SiweMessage(message).verify({
@ -61,11 +64,11 @@ router.post('/validate', async (req, res) => {
if (!user) {
const newUser = await service.createUser({
ethAddress: data.address,
email: '',
name: '',
email: `${data.address}@example.com`,
subOrgId: '',
turnkeyWalletId: '',
});
// SIWESession from the web3modal library requires both address and chain ID
req.session.address = newUser.id;
req.session.chainId = data.chainId;

View File

@ -378,7 +378,7 @@ export class Service {
}
async createUser(params: {
name: string;
name?: string;
email: string;
subOrgId: string;
ethAddress: string;