| 123456789101112131415161718192021222324252627 |
- import { db } from '../utils/db.js'
-
- class Authenticator {
- constructor() {
- this.curentUser = null
- }
- async sendAuthEmail(answered) {
- const emailWasSent = await db.post('/user/sendemail/', answered)
- return emailWasSent
- }
- // NOTE: these might be better suited as POST requests
- async verifyAuthEmail(hashedEmail) {
- const isVerified = await db.get(`/user/verify/${hashedEmail}`)
- return isVerified.hashesMatch
- }
- // TODO: this needs to generate the JWT with the RAW email
- async generateJwt(res) {
- const token = await db.post('/user/generatejwt', res)
- return token.jwt
- }
- async validateJwt(jwt) {
- const validateJwt = await db.get(`/user/validatejwt/${jwt}`)
- return validateJwt
- }
- }
-
- export { Authenticator }
|