const { faker } = require('@faker-js/faker'); function createIdentity() { const firstName = faker.name.firstName(); const lastName = faker.name.lastName(); const birthDate = faker.date.between('1960-01-01', '2004-12-31'); const email = firstName + '.' + lastName + '@aostia.org'; const password = generatePassword(12); return { first_name: firstName, last_name: lastName, birth_date: birthDate, email: email, password: password }; } function generatePassword(length) { const charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~'; let password = ''; for (let i = 0; i < length; i++) { password += charset.charAt(Math.floor(Math.random() * charset.length)); } return password; } module.exports = { createIdentity };