backend/src/utils/auth.utils.js

21 lines
550 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 checkUser(key) { // Needs testing
q = {uuid: key};
res = db.query("registrations", q);
log.out(`authUtils.checkUser: DB Query answer: ${await res}`)
return await res
}
// Creates an API key for a user
async function generateKey() { // Needs testing
return crypto.randomUUID()
};
module.export = {
checkUser,
generateKey
}