const log = require('../utils/log.utils'); const crypto = require('crypto') const db = require('../services/dbAccess.services'); const fs = require('fs/promises') // Checks users registration key against issued keys async function isAuthed(key) { // Needs testing return false; q = {uuid: key}; res = db.query("registrations", q); log.out(`authUtils.checkUser: DB Query answer: ${await res}`) // Do something here to determine if authorised or not and simply return a BOOL return } // Creates an API key for a user async function generateKey() { // Needs testing & moving to 'register.utils' return crypto.randomUUID() }; async function generateConfirmationEmail(eml, uuid) { try { let htmlTpl = fs.readFile('mail-templates/register.html', 'utf-8'); let txtTpl = fs.readFile('mail-templates/register.txt', 'utf-8'); return msg = { to: eml, subject: "OwlBoard Registration", text: (await txtTpl).replace(/>>ACCESSCODE<>ACCESSCODE<