Add Usesend but havent tested it just yet

This commit is contained in:
2025-09-23 07:41:39 -05:00
parent 4fe32474df
commit 70924f84a9
11 changed files with 510 additions and 187 deletions

View File

@@ -10,12 +10,13 @@ import { type Id } from './_generated/dataModel';
import { action, mutation, query } from './_generated/server';
import Authentik from '@auth/core/providers/authentik';
import { Entra, Password, validatePassword } from './custom/auth';
import Resend from '@auth/core/providers/resend';
import { Resend as ResendAPI } from 'resend';
import { generateRandomString, RandomReader } from '@oslojs/crypto/random';
export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth({
providers: [Authentik, Entra, Password],
providers: [
Authentik({ allowDangerousEmailAccountLinking: true }),
Entra,
Password,
],
});
export const PASSWORD_MIN = 8;
@@ -176,31 +177,3 @@ export const updateUserPassword = action({
},
});
//export const ResendOTPPasswordReset = Resend({
//id: "resend-otp",
//apiKey: process.env.AUTH_RESEND_KEY,
//async generateVerificationToken() {
//const random: RandomReader = {
//read(bytes) {
//crypto.getRandomValues(bytes);
//},
//};
//const alphabet = "0123456789";
//const length = 8;
//return generateRandomString(random, alphabet, length);
//},
//async sendVerificationRequest({ identifier: email, provider, token }) {
//const resend = new ResendAPI(provider.apiKey);
//const { error } = await resend.emails.send({
//from: "My App <onboarding@resend.dev>",
//to: [email],
//subject: `Reset your password in My App`,
//text: "Your password reset code is " + token,
//});
//if (error) {
//throw new Error("Could not send");
//}
//},
//});