cloudflare-auth
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -13,2 +13,4 @@ import { AuthConfig } from 'cloudflare-auth'; | ||
salt: 'sdf82dwlWs>.s.akuidnnSwDESDh88wkk$adn@@hjk1u89pp=89b', | ||
adminEmail: 'info@continuata.com', | ||
adminName: 'Continuata', | ||
}; |
{ | ||
"name": "cloudflare-auth", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "JWT implementation for Cloudflare using D1", | ||
@@ -5,0 +5,0 @@ "main": "src/index.ts", |
@@ -0,1 +1,4 @@ | ||
import { Env } from './interfaces'; | ||
import type { AuthConfig } from './interfaces'; | ||
export const sendEmail = async (urlOrigin: string, payload: any) => { | ||
@@ -34,3 +37,5 @@ // Mailchannels not supported on localhost so just log the email | ||
to: string, | ||
link: string | ||
link: string, | ||
env: Env, | ||
config: AuthConfig | ||
) => { | ||
@@ -41,7 +46,10 @@ return await sendEmail(urlOrigin, { | ||
to: [{ email: to }], | ||
dkim_domain: env.DKIM_DOMAIN, | ||
dkim_selector: env.DKIM_SELECTOR, | ||
dkim_private_key: env.DKIM_PRIVATE_KEY, | ||
}, | ||
], | ||
from: { | ||
email: 'info@continuata.co.uk', | ||
name: 'Continuata', | ||
email: config.adminEmail, | ||
name: config.adminName, | ||
}, | ||
@@ -61,3 +69,5 @@ subject: 'Verify your email address', | ||
to: string, | ||
link: string | ||
link: string, | ||
env: Env, | ||
config: AuthConfig | ||
) => { | ||
@@ -68,7 +78,10 @@ return await sendEmail(urlOrigin, { | ||
to: [{ email: to }], | ||
dkim_domain: env.DKIM_DOMAIN, | ||
dkim_selector: env.DKIM_SELECTOR, | ||
dkim_private_key: env.DKIM_PRIVATE_KEY, | ||
}, | ||
], | ||
from: { | ||
email: 'info@continuata.co.uk', | ||
name: 'Continuata', | ||
email: config.adminEmail, | ||
name: config.adminName, | ||
}, | ||
@@ -75,0 +88,0 @@ subject: 'Confirm login', |
@@ -5,2 +5,5 @@ import * as jose from 'jose'; | ||
DB: D1Database; | ||
DKIM_DOMAIN: string; | ||
DKIM_SELECTOR: string; | ||
DKIM_PRIVATE_KEY: string; | ||
} | ||
@@ -40,2 +43,4 @@ | ||
salt: string; | ||
adminEmail: string; | ||
adminName: string; | ||
} | ||
@@ -42,0 +47,0 @@ |
@@ -51,3 +51,3 @@ import { Kysely } from 'kysely'; | ||
const magicLink = `${urlOrigin}/verify?token=${token}`; | ||
await sendLoginMagicLinkEmail(urlOrigin, email, magicLink); | ||
await sendLoginMagicLinkEmail(urlOrigin, email, magicLink, env, config); | ||
return magicLink; | ||
@@ -54,0 +54,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
353665
10355