@lunora/auth 1.0.0-alpha.73 → 1.0.0-alpha.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/email-guard.d.mts +3 -0
- package/dist/email-guard.d.ts +3 -0
- package/dist/email-guard.mjs +1 -1
- package/package.json +2 -2
package/dist/email-guard.d.mts
CHANGED
|
@@ -91,6 +91,9 @@ declare const loadEmailDomainLists: () => Promise<void>;
|
|
|
91
91
|
* The lookup relies on the built-in domain lists being loaded. On Node they
|
|
92
92
|
* auto-load from disk; on workerd, `await loadEmailDomainLists()` first (or use
|
|
93
93
|
* {@link assertEmailAllowed} / {@link emailGateMiddleware}, which await it).
|
|
94
|
+
*
|
|
95
|
+
* The returned/compared domain is IDNA-normalized (see {@link toAsciiDomain}) so
|
|
96
|
+
* a Unicode-form internationalized domain matches its `xn--` blocklist entry.
|
|
94
97
|
*/
|
|
95
98
|
declare const classifyEmail: (email: string, config?: EmailGateConfig) => EmailClassification;
|
|
96
99
|
/**
|
package/dist/email-guard.d.ts
CHANGED
|
@@ -91,6 +91,9 @@ declare const loadEmailDomainLists: () => Promise<void>;
|
|
|
91
91
|
* The lookup relies on the built-in domain lists being loaded. On Node they
|
|
92
92
|
* auto-load from disk; on workerd, `await loadEmailDomainLists()` first (or use
|
|
93
93
|
* {@link assertEmailAllowed} / {@link emailGateMiddleware}, which await it).
|
|
94
|
+
*
|
|
95
|
+
* The returned/compared domain is IDNA-normalized (see {@link toAsciiDomain}) so
|
|
96
|
+
* a Unicode-form internationalized domain matches its `xn--` blocklist entry.
|
|
94
97
|
*/
|
|
95
98
|
declare const classifyEmail: (email: string, config?: EmailGateConfig) => EmailClassification;
|
|
96
99
|
/**
|
package/dist/email-guard.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LunoraError as
|
|
1
|
+
import{LunoraError as t}from"@lunora/errors";import{isDisposableDomain as d,setDomains as c}from"@visulima/disposable-email-domains";import{extractDomain as w,isFreeDomain as u,setDomains as D}from"@visulima/free-email-domains";const n=a=>{const i=a.default??a;return Array.isArray(i)?i:[]};let r;const h=async()=>(r??=(async()=>{const[a,i]=await Promise.all([import("@visulima/disposable-email-domains/domains"),import("@visulima/free-email-domains/domains")]);c(n(a)),D(n(i))})(),r),m=a=>{try{return new URL(`https://${a}`).hostname}catch{return a.toLowerCase()}},l=a=>a&&a.length>0?new Set(a.map(i=>m(i))):void 0,p=(a,i={})=>{const o=w(a);if(o===void 0)return{domain:void 0,emailClass:"business"};const s=m(o),e=l(i.allowDomains);return d(s,{allowDomains:e,customDomains:l(i.denyDomains)})?{domain:s,emailClass:"disposable"}:u(s,{allowDomains:e})?{domain:s,emailClass:"free"}:{domain:s,emailClass:"business"}},f=async a=>{const{checkMxRecords:i}=await import("@visulima/email-verifier/checks/mx");return(await i(a)).valid},y=async(a,i={})=>{if(i.requireValidSyntax!==!1){const{validateSyntax:s}=await import("@visulima/email-verifier/checks/syntax");if(!s(a))throw new t("VALIDATION_ERROR",`@lunora/auth: "${a}" is not a valid email address.`)}await h();const o=p(a,i);if(o.emailClass==="disposable"&&i.blockDisposable!==!1)throw new t("EMAIL_DOMAIN_BLOCKED",`@lunora/auth: signups from the disposable/throwaway domain "${o.domain??a}" are not allowed.`);if(i.mx===!0&&o.domain!==void 0&&!await f(o.domain))throw new t("EMAIL_UNDELIVERABLE",`@lunora/auth: the domain "${o.domain}" publishes no MX records, so mail to it cannot be delivered.`);return o},b=a=>async({ctx:i,next:o})=>{const s=a.email(i);if(s===void 0||s==="")throw new t("VALIDATION_ERROR","@lunora/auth: emailGateMiddleware received no email to check.");const e=await y(s,a);return a.onClassify?.(e,i),o()};export{y as assertEmailAllowed,p as classifyEmail,b as emailGateMiddleware,h as loadEmailDomainLists};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/auth",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.74",
|
|
4
4
|
"description": "Auth for Lunora — a thin better-auth wrapper: email/password, OAuth, plugins, D1-backed",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auth",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"@better-auth/passkey": "1.7.0-rc.2",
|
|
104
104
|
"@better-auth/scim": "1.7.0-rc.2",
|
|
105
105
|
"@lunora/errors": "1.0.0-alpha.16",
|
|
106
|
-
"@lunora/server": "1.0.0-alpha.
|
|
106
|
+
"@lunora/server": "1.0.0-alpha.65",
|
|
107
107
|
"@lunora/values": "1.0.0-alpha.21",
|
|
108
108
|
"@visulima/disposable-email-domains": "1.0.1",
|
|
109
109
|
"@visulima/email-verifier": "1.0.1",
|