backend/src/utils/auth.utils.js
Fred Boniface 7d0b9f9d44 Add comments
Signed-off-by: Fred Boniface <fred@fjla.uk>
2023-04-05 01:09:50 +01:00

25 lines
680 B
JavaScript

const log = require('../utils/log.utils');
const crypto = require('crypto')
const db = require('../services/dbAccess.services')
// 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()
};
module.exports = {
isAuthed,
generateKey
}