backend/src/utils/auth.utils.js

21 lines
514 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) {
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() {
return crypto.randomUUID()
};
module.export = {
checkUser,
generateKey
}