authhero 9.36.0 → 9.37.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/index.esm.js +1 -1
- package/dist/authhero.cjs +144 -141
- package/dist/authhero.d.ts +462 -271
- package/dist/authhero.mjs +18253 -16777
- package/dist/{mfa-B044FRjD.mjs → mfa-BpHxTir1.mjs} +22 -22
- package/dist/{mfa-DPwn1ajo.js → mfa-DuNbh_YF.js} +1 -1
- package/dist/mfa-attempts-D5U1FCSY.js +275 -0
- package/dist/{mfa-attempts-DGOLb2oh.mjs → mfa-attempts-DDgCBTDW.mjs} +5048 -4965
- package/dist/{passkey-enrollment-BDboqoaP.js → passkey-enrollment-D6ZZmelw.js} +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/email-verification.d.ts +1 -1
- 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/password-connection.d.ts +3 -1
- package/dist/types/helpers/reserved-claims.d.ts +2 -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 +402 -212
- 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/device.d.ts +8 -8
- package/dist/types/routes/auth-api/index.d.ts +36 -21
- 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/management-api/action-executions.d.ts +2 -2
- package/dist/types/routes/management-api/actions.d.ts +1 -1
- package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
- package/dist/types/routes/management-api/client-registration-tokens.d.ts +149 -0
- package/dist/types/routes/management-api/connections.d.ts +1 -1
- package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
- package/dist/types/routes/management-api/forms.d.ts +144 -144
- 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/index.d.ts +329 -184
- package/dist/types/routes/management-api/keys.d.ts +8 -8
- 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 +1 -1
- package/dist/types/routes/management-api/rollouts.d.ts +6 -6
- package/dist/types/routes/management-api/self-service-profiles.d.ts +1 -1
- package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
- package/dist/types/routes/management-api/tenants.d.ts +7 -7
- package/dist/types/routes/management-api/users.d.ts +3 -3
- package/dist/types/routes/universal-login/common.d.ts +2 -2
- package/dist/types/routes/universal-login/flow-api.d.ts +8 -8
- package/dist/types/routes/universal-login/identifier.d.ts +2 -2
- package/dist/types/routes/universal-login/index.d.ts +2 -2
- package/dist/types/routes/universal-login/screens/connect-authz.d.ts +9 -0
- package/dist/types/routes/universal-login/screens/self-service-app.d.ts +46 -0
- 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/state-machines/login-session.d.ts +19 -1
- package/dist/types/types/Bindings.d.ts +2 -0
- package/package.json +6 -6
- package/dist/mfa-attempts-BiU_pMOV.js +0 -275
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Do as e, El as t, Ld as n, _i as r, hc as i, in as a, r as o, xl as s } from "./mfa-attempts-DDgCBTDW.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(
|
|
34
|
+
function m(e, n, r) {
|
|
35
35
|
let i = new URLSearchParams({
|
|
36
|
-
secret:
|
|
37
|
-
issuer:
|
|
36
|
+
secret: t(r),
|
|
37
|
+
issuer: e
|
|
38
38
|
});
|
|
39
|
-
return `otpauth://totp/${encodeURIComponent(
|
|
39
|
+
return `otpauth://totp/${encodeURIComponent(e)}:${encodeURIComponent(n)}?${i.toString()}`;
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/authentication-flows/mfa.ts
|
|
43
|
-
var h = /* @__PURE__ */
|
|
43
|
+
var h = /* @__PURE__ */ n({
|
|
44
44
|
checkMfaRequired: () => v,
|
|
45
45
|
createTotpUri: () => C,
|
|
46
46
|
generateTotpSecret: () => S,
|
|
@@ -71,18 +71,18 @@ async function v(e, t, n, r = {}) {
|
|
|
71
71
|
enrolled: !1
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
async function y(e, t,
|
|
74
|
+
async function y(e, t, n, u, d) {
|
|
75
75
|
let f = t.tenant;
|
|
76
|
-
await
|
|
77
|
-
let p = l(), m = `mfa:${
|
|
76
|
+
await o(e, f.id, n.id, u, d);
|
|
77
|
+
let p = l(), m = `mfa:${n.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,
|
|
80
80
|
code_type: "mfa_otp",
|
|
81
|
-
login_id:
|
|
81
|
+
login_id: n.id,
|
|
82
82
|
otp: p,
|
|
83
83
|
expires_at: new Date(Date.now() + g).toISOString()
|
|
84
84
|
});
|
|
85
|
-
let h = t.connections.find((e) => e.strategy ===
|
|
85
|
+
let h = t.connections.find((e) => e.strategy === i.SMS), _ = e.env.data.smsService;
|
|
86
86
|
if (!_) throw new c(500, { message: "SMS service not configured" });
|
|
87
87
|
let v = h?.options || f.mfa?.twilio || {};
|
|
88
88
|
try {
|
|
@@ -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 a(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), t(e);
|
|
120
120
|
}
|
|
121
|
-
function C(
|
|
122
|
-
return m(
|
|
121
|
+
function C(t, n, r) {
|
|
122
|
+
return m(t, n, e(r));
|
|
123
123
|
}
|
|
124
|
-
async function w(
|
|
125
|
-
return p(
|
|
124
|
+
async function w(t, n) {
|
|
125
|
+
return p(n, e(t));
|
|
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 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./mfa-attempts-
|
|
1
|
+
const e=require("./mfa-attempts-D5U1FCSY.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.El(r),issuer:t});return`otpauth://totp/${encodeURIComponent(t)}:${encodeURIComponent(n)}?${i.toString()}`}var c=e.Ld({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.hc.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.xl.MFA_SMS_SENT,description:`MFA SMS sent`})}catch(t){throw e._i(r,c.id,{type:e.xl.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.El(t)}function g(t,n,r){return s(t,n,e.Do(r))}async function _(t,n){return o(n,e.Do(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}});
|