authhero 9.36.0 → 9.38.0
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/assets/u/widget/authhero-widget.esm.js +1 -1
- package/dist/assets/u/widget/index.esm.js +1 -1
- package/dist/assets/u/widget/{p-ce8560f6.entry.js → p-32247347.entry.js} +1 -1
- package/dist/assets/u/widget/p-3f908508.entry.js +1 -0
- package/dist/assets/u/widget/p-Wx4M-olY.js +2 -0
- package/dist/authhero.cjs +165 -141
- package/dist/authhero.d.ts +633 -331
- package/dist/authhero.mjs +19149 -16716
- package/dist/{mfa-DPwn1ajo.js → mfa-DBhvi2B5.js} +1 -1
- package/dist/{mfa-B044FRjD.mjs → mfa-DnCary4g.mjs} +19 -19
- package/dist/{mfa-attempts-DGOLb2oh.mjs → mfa-attempts-BK-gWrgJ.mjs} +5161 -5045
- package/dist/mfa-attempts-C5kobAHS.js +275 -0
- package/dist/{passkey-enrollment-BDboqoaP.js → passkey-enrollment-CmKahPq7.js} +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/email-verification.d.ts +1 -1
- package/dist/types/authentication-flows/passwordless.d.ts +2 -2
- package/dist/types/generated/locale-types.d.ts +87 -0
- package/dist/types/helpers/anchor-client.d.ts +16 -0
- package/dist/types/helpers/database-connection-scope.d.ts +48 -18
- package/dist/types/helpers/dcr/audience-policy.d.ts +13 -0
- package/dist/types/helpers/dcr/client-registration.d.ts +81 -0
- package/dist/types/helpers/dcr/constraint-enforcement.d.ts +1 -0
- package/dist/types/helpers/dcr/metadata-mapping.d.ts +18 -1
- package/dist/types/helpers/dcr/mint-iat.d.ts +4 -1
- package/dist/types/helpers/dcr/mint-token.d.ts +4 -0
- package/dist/types/helpers/dcr/presets.d.ts +34 -0
- package/dist/types/helpers/dcr/uri-policy.d.ts +34 -0
- package/dist/types/helpers/default-destinations.d.ts +14 -0
- package/dist/types/helpers/firehose-client.d.ts +29 -0
- package/dist/types/helpers/outbox-destinations/log-streams.d.ts +21 -1
- package/dist/types/helpers/password-connection.d.ts +3 -1
- package/dist/types/helpers/prompt-partials.d.ts +1 -1
- package/dist/types/helpers/reserved-claims.d.ts +2 -2
- package/dist/types/helpers/run-outbox-relay.d.ts +9 -2
- package/dist/types/helpers/self-service-tickets.d.ts +34 -0
- package/dist/types/helpers/users.d.ts +17 -2
- package/dist/types/index.d.ts +565 -271
- package/dist/types/routes/auth-api/authenticate.d.ts +1 -1
- package/dist/types/routes/auth-api/dbconnections.d.ts +2 -2
- package/dist/types/routes/auth-api/index.d.ts +38 -23
- package/dist/types/routes/auth-api/passwordless.d.ts +10 -10
- package/dist/types/routes/auth-api/register/index.d.ts +15 -0
- package/dist/types/routes/auth-api/token.d.ts +10 -10
- package/dist/types/routes/management-api/action-executions.d.ts +2 -2
- package/dist/types/routes/management-api/actions.d.ts +9 -9
- package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
- package/dist/types/routes/management-api/branding-preview.d.ts +9 -1
- package/dist/types/routes/management-api/branding.d.ts +105 -1
- package/dist/types/routes/management-api/client-registration-tokens.d.ts +149 -0
- package/dist/types/routes/management-api/clients.d.ts +8 -8
- package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
- package/dist/types/routes/management-api/email-templates.d.ts +20 -20
- package/dist/types/routes/management-api/emails.d.ts +2 -2
- package/dist/types/routes/management-api/failed-events.d.ts +4 -4
- package/dist/types/routes/management-api/guardian.d.ts +5 -5
- package/dist/types/routes/management-api/helpers.d.ts +1 -1
- package/dist/types/routes/management-api/hook-code.d.ts +2 -2
- package/dist/types/routes/management-api/hooks.d.ts +4 -4
- package/dist/types/routes/management-api/index.d.ts +482 -233
- package/dist/types/routes/management-api/keys.d.ts +4 -4
- package/dist/types/routes/management-api/log-streams.d.ts +12 -12
- package/dist/types/routes/management-api/logs.d.ts +4 -4
- package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
- package/dist/types/routes/management-api/organizations.d.ts +7 -7
- package/dist/types/routes/management-api/prompts.d.ts +8 -8
- package/dist/types/routes/management-api/roles.d.ts +1 -1
- package/dist/types/routes/management-api/self-service-profiles.d.ts +7 -7
- package/dist/types/routes/management-api/tenant-operations.d.ts +10 -10
- package/dist/types/routes/management-api/tenants.d.ts +29 -29
- package/dist/types/routes/management-api/themes.d.ts +69 -0
- package/dist/types/routes/management-api/users.d.ts +16 -16
- package/dist/types/routes/universal-login/common.d.ts +52 -0
- package/dist/types/routes/universal-login/dark-theme.d.ts +25 -0
- package/dist/types/routes/universal-login/flow-api.d.ts +4 -4
- package/dist/types/routes/universal-login/form-node.d.ts +4 -4
- package/dist/types/routes/universal-login/index.d.ts +4 -4
- package/dist/types/routes/universal-login/legal-links.d.ts +18 -0
- package/dist/types/routes/universal-login/screen-prompt-map.d.ts +31 -0
- package/dist/types/routes/universal-login/screens/connect-authz.d.ts +9 -0
- package/dist/types/routes/universal-login/screens/login-partials.d.ts +9 -1
- package/dist/types/routes/universal-login/screens/self-service-app.d.ts +46 -0
- package/dist/types/routes/universal-login/u2-form-node.d.ts +2 -2
- package/dist/types/routes/universal-login/u2-index.d.ts +35 -5
- package/dist/types/routes/universal-login/u2-routes.d.ts +35 -5
- package/dist/types/routes/universal-login/u2-widget-page.d.ts +6 -1
- package/dist/types/routes/universal-login/universal-login-template.d.ts +1 -0
- package/dist/types/state-machines/login-session.d.ts +19 -1
- package/dist/types/types/Bindings.d.ts +2 -0
- package/package.json +7 -6
- package/dist/assets/u/widget/p-FUW5zvoZ.js +0 -2
- package/dist/assets/u/widget/p-c6ec4c36.entry.js +0 -1
- package/dist/mfa-attempts-BiU_pMOV.js +0 -275
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./mfa-attempts-
|
|
1
|
+
const e=require("./mfa-attempts-C5kobAHS.js");let t=require("hono/http-exception");function n(){let e=new Uint8Array(6);crypto.getRandomValues(e);let t=``;for(let n=0;n<6;n+=1)t+=(e[n]%10).toString();return t}var r=30,i=6;async function a(e,t){let n=new Uint8Array(8);new DataView(n.buffer).setBigUint64(0,BigInt(t));let r=new ArrayBuffer(e.byteLength);new Uint8Array(r).set(e);let a=await crypto.subtle.importKey(`raw`,r,{name:`HMAC`,hash:`SHA-1`},!1,[`sign`]),o=new Uint8Array(await crypto.subtle.sign(`HMAC`,a,n)),s=o[o.length-1]&15;return(((o[s]&127)<<24|o[s+1]<<16|o[s+2]<<8|o[s+3])%10**i).toString().padStart(i,`0`)}async function o(e,t){let n=Math.floor(Date.now()/(r*1e3));for(let r of[0,-1,1])if(await a(t,n+r)===e)return n+r;return null}function s(t,n,r){let i=new URLSearchParams({secret:e.jo(r),issuer:t});return`otpauth://totp/${encodeURIComponent(t)}:${encodeURIComponent(n)}?${i.toString()}`}var c=e.Bd({checkMfaRequired:()=>d,createTotpUri:()=>g,generateTotpSecret:()=>h,sendMfaOtp:()=>f,tenantPolicyRequiresMfa:()=>u,verifyMfaOtp:()=>p,verifyTotpCode:()=>_}),l=600*1e3;function u(e){return e!==void 0&&e!==`never`}async function d(e,n,r,i={}){let a=await e.env.data.tenants.get(n);if(!a||!i.force&&!u(a.mfa?.policy))return{required:!1};if(!(a.mfa?.factors?.sms===!0||a.mfa?.factors?.otp===!0||a.mfa?.factors?.webauthn_roaming===!0||a.mfa?.factors?.webauthn_platform===!0))throw new t.HTTPException(500,{message:`MFA is required (by the tenant policy or a post-login action) but no supported factors are enabled. Enable at least one factor (e.g. SMS, OTP, or WebAuthn) in the tenant MFA configuration.`});let o=a.mfa?.factors,s=o?.webauthn_roaming===!0||o?.webauthn_platform===!0,c=[`passkey`,`webauthn-roaming`,`webauthn-platform`],l=(await e.env.data.authenticationMethods.list(n,r)).filter(e=>e.confirmed&&(e.type===`phone`&&o?.sms===!0||e.type===`totp`&&o?.otp===!0||c.includes(e.type)&&s));return l.length>0?{required:!0,enrolled:!0,enrollment:l[0],allEnrollments:l}:{required:!0,enrolled:!1}}async function f(r,i,a,o,s){let c=i.tenant;await e.r(r,c.id,a.id,o,s);let u=n(),d=`mfa:${a.id}`;await r.env.data.codes.remove(c.id,d),await r.env.data.codes.create(c.id,{code_id:d,code_type:`mfa_otp`,login_id:a.id,otp:u,expires_at:new Date(Date.now()+l).toISOString()});let f=i.connections.find(t=>t.strategy===e.Ru.SMS),p=r.env.data.smsService;if(!p)throw new t.HTTPException(500,{message:`SMS service not configured`});let m=f?.options||c.mfa?.twilio||{};try{await p.send({options:m,to:o,from:c.friendly_name,text:`Your verification code is: ${u}`,template:`mfa-code`,data:{code:u,tenantName:c.friendly_name||``,tenantId:c.id},createServiceToken:async t=>(await e.in(r,c.id,t,{allowControlPlaneFallback:!0})).access_token}),e._i(r,c.id,{type:e.vo.MFA_SMS_SENT,description:`MFA SMS sent`})}catch(t){throw e._i(r,c.id,{type:e.vo.ERROR_SENDING_MFA_SMS,description:`Failed to send MFA SMS: ${t instanceof Error?t.message:String(t)}`}),t}}async function p(e,t,n,r){let i=`mfa:${n}`,a=await e.env.data.codes.get(t,i,`mfa_otp`);return!a||new Date(a.expires_at)<new Date||a.otp!==r?!1:await e.env.data.codes.consume(t,i)}var m=20;function h(){let t=new Uint8Array(m);return crypto.getRandomValues(t),e.jo(t)}function g(t,n,r){return s(t,n,e.Ko(r))}async function _(t,n){return o(n,e.Ko(t))}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return d}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bd as e, Ko as t, Ru as n, _i as r, in as i, jo as a, r as o, vo as s } from "./mfa-attempts-BK-gWrgJ.mjs";
|
|
2
2
|
import { HTTPException as c } from "hono/http-exception";
|
|
3
3
|
//#region src/utils/otp.ts
|
|
4
4
|
function l() {
|
|
@@ -31,16 +31,16 @@ async function p(e, t) {
|
|
|
31
31
|
]) if (await f(t, n + r) === e) return n + r;
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
|
-
function m(t, n
|
|
35
|
-
let
|
|
36
|
-
secret:
|
|
37
|
-
issuer:
|
|
34
|
+
function m(e, t, n) {
|
|
35
|
+
let r = new URLSearchParams({
|
|
36
|
+
secret: a(n),
|
|
37
|
+
issuer: e
|
|
38
38
|
});
|
|
39
|
-
return `otpauth://totp/${encodeURIComponent(
|
|
39
|
+
return `otpauth://totp/${encodeURIComponent(e)}:${encodeURIComponent(t)}?${r.toString()}`;
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/authentication-flows/mfa.ts
|
|
43
|
-
var h = /* @__PURE__ */
|
|
43
|
+
var h = /* @__PURE__ */ e({
|
|
44
44
|
checkMfaRequired: () => v,
|
|
45
45
|
createTotpUri: () => C,
|
|
46
46
|
generateTotpSecret: () => S,
|
|
@@ -73,7 +73,7 @@ async function v(e, t, n, r = {}) {
|
|
|
73
73
|
}
|
|
74
74
|
async function y(e, t, a, u, d) {
|
|
75
75
|
let f = t.tenant;
|
|
76
|
-
await
|
|
76
|
+
await o(e, f.id, a.id, u, d);
|
|
77
77
|
let p = l(), m = `mfa:${a.id}`;
|
|
78
78
|
await e.env.data.codes.remove(f.id, m), await e.env.data.codes.create(f.id, {
|
|
79
79
|
code_id: m,
|
|
@@ -97,14 +97,14 @@ async function y(e, t, a, u, d) {
|
|
|
97
97
|
tenantName: f.friendly_name || "",
|
|
98
98
|
tenantId: f.id
|
|
99
99
|
},
|
|
100
|
-
createServiceToken: async (t) => (await
|
|
101
|
-
}),
|
|
102
|
-
type:
|
|
100
|
+
createServiceToken: async (t) => (await i(e, f.id, t, { allowControlPlaneFallback: !0 })).access_token
|
|
101
|
+
}), r(e, f.id, {
|
|
102
|
+
type: s.MFA_SMS_SENT,
|
|
103
103
|
description: "MFA SMS sent"
|
|
104
104
|
});
|
|
105
105
|
} catch (t) {
|
|
106
|
-
throw
|
|
107
|
-
type:
|
|
106
|
+
throw r(e, f.id, {
|
|
107
|
+
type: s.ERROR_SENDING_MFA_SMS,
|
|
108
108
|
description: `Failed to send MFA SMS: ${t instanceof Error ? t.message : String(t)}`
|
|
109
109
|
}), t;
|
|
110
110
|
}
|
|
@@ -115,14 +115,14 @@ async function b(e, t, n, r) {
|
|
|
115
115
|
}
|
|
116
116
|
var x = 20;
|
|
117
117
|
function S() {
|
|
118
|
-
let
|
|
119
|
-
return crypto.getRandomValues(
|
|
118
|
+
let e = new Uint8Array(x);
|
|
119
|
+
return crypto.getRandomValues(e), a(e);
|
|
120
120
|
}
|
|
121
|
-
function C(e,
|
|
122
|
-
return m(e,
|
|
121
|
+
function C(e, n, r) {
|
|
122
|
+
return m(e, n, t(r));
|
|
123
123
|
}
|
|
124
|
-
async function w(e,
|
|
125
|
-
return p(
|
|
124
|
+
async function w(e, n) {
|
|
125
|
+
return p(n, t(e));
|
|
126
126
|
}
|
|
127
127
|
//#endregion
|
|
128
128
|
export { y as a, w as c, h as i, l, C as n, _ as o, S as r, b as s, v as t };
|