backend/src/utils/auth.utils.js

25 lines
680 B
JavaScript
Raw Normal View History

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
}