authhero 0.75.0 → 0.76.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/authhero.cjs +23 -23
- package/dist/authhero.mjs +246 -234
- package/package.json +1 -1
package/dist/authhero.mjs
CHANGED
|
@@ -361,8 +361,8 @@ class ts extends zs {
|
|
|
361
361
|
}
|
|
362
362
|
const h = this.resolve(e, n);
|
|
363
363
|
let m = h == null ? void 0 : h.res;
|
|
364
|
-
const v = (h == null ? void 0 : h.usedKey) || o, f = (h == null ? void 0 : h.exactUsedKey) || o, _ = Object.prototype.toString.apply(m), w = ["[object Number]", "[object Function]", "[object RegExp]"], S = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays,
|
|
365
|
-
if (
|
|
364
|
+
const v = (h == null ? void 0 : h.usedKey) || o, f = (h == null ? void 0 : h.exactUsedKey) || o, _ = Object.prototype.toString.apply(m), w = ["[object Number]", "[object Function]", "[object RegExp]"], S = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, $ = !this.i18nFormat || this.i18nFormat.handleAsObject, T = !re(m) && typeof m != "boolean" && typeof m != "number";
|
|
365
|
+
if ($ && m && T && w.indexOf(_) < 0 && !(re(S) && Array.isArray(m))) {
|
|
366
366
|
if (!n.returnObjects && !this.options.returnObjects) {
|
|
367
367
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
368
368
|
const L = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(v, m, {
|
|
@@ -384,7 +384,7 @@ class ts extends zs {
|
|
|
384
384
|
}
|
|
385
385
|
m = ne;
|
|
386
386
|
}
|
|
387
|
-
} else if (
|
|
387
|
+
} else if ($ && re(S) && Array.isArray(m))
|
|
388
388
|
m = m.join(S), m && (m = this.extendTranslation(m, e, n, r));
|
|
389
389
|
else {
|
|
390
390
|
let L = !1, ne = !1;
|
|
@@ -480,8 +480,8 @@ class ts extends zs {
|
|
|
480
480
|
this.options.fallbackNS && (h = h.concat(this.options.fallbackNS));
|
|
481
481
|
const m = n.count !== void 0 && !re(n.count), v = m && !n.ordinal && n.count === 0, f = n.context !== void 0 && (re(n.context) || typeof n.context == "number") && n.context !== "", _ = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng);
|
|
482
482
|
h.forEach((w) => {
|
|
483
|
-
var S,
|
|
484
|
-
this.isValidLookup(r) || (c = w, !ku[`${_[0]}-${w}`] && ((S = this.utils) != null && S.hasLoadedNamespace) && !((
|
|
483
|
+
var S, $;
|
|
484
|
+
this.isValidLookup(r) || (c = w, !ku[`${_[0]}-${w}`] && ((S = this.utils) != null && S.hasLoadedNamespace) && !(($ = this.utils) != null && $.hasLoadedNamespace(c)) && (ku[`${_[0]}-${w}`] = !0, this.logger.warn(`key "${i}" for languages "${_.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), _.forEach((T) => {
|
|
485
485
|
var ge;
|
|
486
486
|
if (this.isValidLookup(r)) return;
|
|
487
487
|
o = T;
|
|
@@ -700,9 +700,9 @@ class vm {
|
|
|
700
700
|
nestingSuffixEscaped: _,
|
|
701
701
|
nestingOptionsSeparator: w,
|
|
702
702
|
maxReplaces: S,
|
|
703
|
-
alwaysFormat:
|
|
703
|
+
alwaysFormat: $
|
|
704
704
|
} = e.interpolation;
|
|
705
|
-
this.escape = n !== void 0 ? n : pm, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = s ? Un(s) : o || "{{", this.suffix = c ? Un(c) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = p ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : p || "", this.nestingPrefix = m ? Un(m) : v || Un("$t("), this.nestingSuffix = f ? Un(f) : _ || Un(")"), this.nestingOptionsSeparator = w || ",", this.maxReplaces = S || 1e3, this.alwaysFormat =
|
|
705
|
+
this.escape = n !== void 0 ? n : pm, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = s ? Un(s) : o || "{{", this.suffix = c ? Un(c) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = p ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : p || "", this.nestingPrefix = m ? Un(m) : v || Un("$t("), this.nestingSuffix = f ? Un(f) : _ || Un(")"), this.nestingOptionsSeparator = w || ",", this.maxReplaces = S || 1e3, this.alwaysFormat = $ !== void 0 ? $ : !1, this.resetRegExp();
|
|
706
706
|
}
|
|
707
707
|
reset() {
|
|
708
708
|
this.options && this.init(this.options);
|
|
@@ -716,12 +716,12 @@ class vm {
|
|
|
716
716
|
let s, o, c;
|
|
717
717
|
const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (f) => {
|
|
718
718
|
if (f.indexOf(this.formatSeparator) < 0) {
|
|
719
|
-
const
|
|
720
|
-
return this.alwaysFormat ? this.format(
|
|
719
|
+
const $ = Eu(n, l, f, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
720
|
+
return this.alwaysFormat ? this.format($, void 0, r, {
|
|
721
721
|
...i,
|
|
722
722
|
...n,
|
|
723
723
|
interpolationkey: f
|
|
724
|
-
}) :
|
|
724
|
+
}) : $;
|
|
725
725
|
}
|
|
726
726
|
const _ = f.split(this.formatSeparator), w = _.shift().trim(), S = _.join(this.formatSeparator).trim();
|
|
727
727
|
return this.format(Eu(n, l, w, this.options.keySeparator, this.options.ignoreJSONStructure), S, r, {
|
|
@@ -2064,7 +2064,7 @@ const Km = new le().openapi(
|
|
|
2064
2064
|
return await t.env.data.branding.set(e, n), t.text("OK");
|
|
2065
2065
|
}
|
|
2066
2066
|
);
|
|
2067
|
-
var
|
|
2067
|
+
var N = class extends Error {
|
|
2068
2068
|
constructor(e = 500, n) {
|
|
2069
2069
|
super(n == null ? void 0 : n.message, { cause: n == null ? void 0 : n.cause });
|
|
2070
2070
|
te(this, "res");
|
|
@@ -2478,7 +2478,7 @@ const Jm = {}, Zm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
2478
2478
|
Date.now = Date.now || function() {
|
|
2479
2479
|
return +/* @__PURE__ */ new Date();
|
|
2480
2480
|
};
|
|
2481
|
-
var f = 16, _ = 10, w = 16, S = 100,
|
|
2481
|
+
var f = 16, _ = 10, w = 16, S = 100, $ = [
|
|
2482
2482
|
608135816,
|
|
2483
2483
|
2242054355,
|
|
2484
2484
|
320440878,
|
|
@@ -3571,7 +3571,7 @@ const Jm = {}, Zm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
3571
3571
|
throw Q;
|
|
3572
3572
|
E = 1 << E >>> 0;
|
|
3573
3573
|
var J, se, ue = 0, H;
|
|
3574
|
-
Int32Array ? (J = new Int32Array(
|
|
3574
|
+
Int32Array ? (J = new Int32Array($), se = new Int32Array(T)) : (J = $.slice(), se = T.slice()), ze(C, j, J, se);
|
|
3575
3575
|
function Ne() {
|
|
3576
3576
|
if (k && k(ue / E), ue < E)
|
|
3577
3577
|
for (var me = Date.now(); ue < E && (ue = ue + 1, de(j, J, se), de(C, J, se), !(Date.now() - me > S)); )
|
|
@@ -3865,7 +3865,7 @@ const Bu = jn.extend({
|
|
|
3865
3865
|
v.linked_to
|
|
3866
3866
|
);
|
|
3867
3867
|
if (!f)
|
|
3868
|
-
throw new
|
|
3868
|
+
throw new N(500, {
|
|
3869
3869
|
message: "Primary account not found"
|
|
3870
3870
|
});
|
|
3871
3871
|
return t.json([Ot.parse(f)]);
|
|
@@ -3920,9 +3920,9 @@ const Bu = jn.extend({
|
|
|
3920
3920
|
async (t) => {
|
|
3921
3921
|
const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), r = await t.env.data.users.get(n, e);
|
|
3922
3922
|
if (!r)
|
|
3923
|
-
throw new
|
|
3923
|
+
throw new N(404);
|
|
3924
3924
|
if (r.linked_to)
|
|
3925
|
-
throw new
|
|
3925
|
+
throw new N(404, {
|
|
3926
3926
|
message: "User is linked to another user"
|
|
3927
3927
|
});
|
|
3928
3928
|
return t.json(r);
|
|
@@ -3954,7 +3954,7 @@ const Bu = jn.extend({
|
|
|
3954
3954
|
async (t) => {
|
|
3955
3955
|
const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header");
|
|
3956
3956
|
if (!await t.env.data.users.remove(n, e))
|
|
3957
|
-
throw new
|
|
3957
|
+
throw new N(404);
|
|
3958
3958
|
return t.text("OK");
|
|
3959
3959
|
}
|
|
3960
3960
|
).openapi(
|
|
@@ -3995,7 +3995,7 @@ const Bu = jn.extend({
|
|
|
3995
3995
|
t.set("body", n);
|
|
3996
3996
|
const { email: r } = n;
|
|
3997
3997
|
if (!r)
|
|
3998
|
-
throw new
|
|
3998
|
+
throw new N(400, { message: "Email is required" });
|
|
3999
3999
|
const i = r.toLowerCase(), s = `${n.provider}|${n.user_id || ci()}`;
|
|
4000
4000
|
try {
|
|
4001
4001
|
const o = await t.env.data.users.create(e, {
|
|
@@ -4032,7 +4032,7 @@ const Bu = jn.extend({
|
|
|
4032
4032
|
status: 201
|
|
4033
4033
|
});
|
|
4034
4034
|
} catch (o) {
|
|
4035
|
-
throw o.message === "User already exists" ? new
|
|
4035
|
+
throw o.message === "User already exists" ? new N(409, {
|
|
4036
4036
|
message: "User already exists"
|
|
4037
4037
|
}) : o;
|
|
4038
4038
|
}
|
|
@@ -4076,7 +4076,7 @@ const Bu = jn.extend({
|
|
|
4076
4076
|
var u;
|
|
4077
4077
|
const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json"), { user_id: r } = t.req.valid("param"), { verify_email: i, password: s, ...o } = n, c = await t.env.data.users.get(e, r);
|
|
4078
4078
|
if (!c)
|
|
4079
|
-
throw new
|
|
4079
|
+
throw new N(404);
|
|
4080
4080
|
if (o.email && o.email !== c.email) {
|
|
4081
4081
|
const p = await Ds(
|
|
4082
4082
|
t.env.data.users,
|
|
@@ -4084,12 +4084,12 @@ const Bu = jn.extend({
|
|
|
4084
4084
|
o.email
|
|
4085
4085
|
);
|
|
4086
4086
|
if (p.length && p.some((h) => h.user_id !== r))
|
|
4087
|
-
throw new
|
|
4087
|
+
throw new N(409, {
|
|
4088
4088
|
message: "Another user with the same email address already exists."
|
|
4089
4089
|
});
|
|
4090
4090
|
}
|
|
4091
4091
|
if (c.linked_to)
|
|
4092
|
-
throw new
|
|
4092
|
+
throw new N(404, {
|
|
4093
4093
|
// not the auth0 error message but I'd rather deviate here
|
|
4094
4094
|
message: "User is linked to another user"
|
|
4095
4095
|
});
|
|
@@ -4098,7 +4098,7 @@ const Bu = jn.extend({
|
|
|
4098
4098
|
(h) => h.connection === "Username-Password-Authentication"
|
|
4099
4099
|
);
|
|
4100
4100
|
if (!p)
|
|
4101
|
-
throw new
|
|
4101
|
+
throw new N(400, {
|
|
4102
4102
|
message: "User does not have a password identity"
|
|
4103
4103
|
});
|
|
4104
4104
|
await t.env.data.passwords.update(e, {
|
|
@@ -4109,7 +4109,7 @@ const Bu = jn.extend({
|
|
|
4109
4109
|
}
|
|
4110
4110
|
const l = await t.env.data.users.get(e, r);
|
|
4111
4111
|
if (!l)
|
|
4112
|
-
throw new
|
|
4112
|
+
throw new N(500);
|
|
4113
4113
|
return t.json(l);
|
|
4114
4114
|
}
|
|
4115
4115
|
).openapi(
|
|
@@ -4165,7 +4165,7 @@ const Bu = jn.extend({
|
|
|
4165
4165
|
async (t) => {
|
|
4166
4166
|
const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json"), { user_id: r } = t.req.valid("param"), i = "link_with" in n ? n.link_with : n.user_id, s = await t.env.data.users.get(e, r);
|
|
4167
4167
|
if (!s)
|
|
4168
|
-
throw new
|
|
4168
|
+
throw new N(400, {
|
|
4169
4169
|
message: "Linking an inexistent identity is not allowed."
|
|
4170
4170
|
});
|
|
4171
4171
|
await t.env.data.users.update(e, i, {
|
|
@@ -4225,7 +4225,7 @@ const Bu = jn.extend({
|
|
|
4225
4225
|
);
|
|
4226
4226
|
const s = await t.env.data.users.get(e, n);
|
|
4227
4227
|
if (!s)
|
|
4228
|
-
throw new
|
|
4228
|
+
throw new N(404);
|
|
4229
4229
|
return t.json([Ot.parse(s)]);
|
|
4230
4230
|
}
|
|
4231
4231
|
).openapi(
|
|
@@ -4331,7 +4331,7 @@ var Tu;
|
|
|
4331
4331
|
return A[I];
|
|
4332
4332
|
}
|
|
4333
4333
|
}, h = Object.getPrototypeOf(Function), m = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : em(), v = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : tm(), f = typeof WeakMap == "function" ? WeakMap : nm(), _ = i ? Symbol.for("@reflect-metadata:registry") : void 0, w = Yg(), S = Xg(w);
|
|
4334
|
-
function
|
|
4334
|
+
function $(A, I, B, q) {
|
|
4335
4335
|
if (H(B)) {
|
|
4336
4336
|
if (!lu(A))
|
|
4337
4337
|
throw new TypeError();
|
|
@@ -4348,7 +4348,7 @@ var Tu;
|
|
|
4348
4348
|
return Ne(q) && (q = void 0), B = wt(B), E(A, I, B, q);
|
|
4349
4349
|
}
|
|
4350
4350
|
}
|
|
4351
|
-
e("decorate",
|
|
4351
|
+
e("decorate", $);
|
|
4352
4352
|
function T(A, I) {
|
|
4353
4353
|
function B(q, ee) {
|
|
4354
4354
|
if (!me(q))
|
|
@@ -8158,8 +8158,8 @@ var lh = { exports: {} };
|
|
|
8158
8158
|
function u(f, _) {
|
|
8159
8159
|
if (f.indexOf("::") !== f.lastIndexOf("::"))
|
|
8160
8160
|
return null;
|
|
8161
|
-
let w = 0, S = -1,
|
|
8162
|
-
for (
|
|
8161
|
+
let w = 0, S = -1, $ = (f.match(l.zoneIndex) || [])[0], T, L;
|
|
8162
|
+
for ($ && ($ = $.substring(1), f = f.replace(/%.+$/, "")); (S = f.indexOf(":", S + 1)) >= 0; )
|
|
8163
8163
|
w++;
|
|
8164
8164
|
if (f.substr(0, 2) === "::" && w--, f.substr(-2, 2) === "::" && w--, w > _)
|
|
8165
8165
|
return null;
|
|
@@ -8172,17 +8172,17 @@ var lh = { exports: {} };
|
|
|
8172
8172
|
return ge;
|
|
8173
8173
|
}(), {
|
|
8174
8174
|
parts: _,
|
|
8175
|
-
zoneId:
|
|
8175
|
+
zoneId: $
|
|
8176
8176
|
};
|
|
8177
8177
|
}
|
|
8178
8178
|
function p(f, _, w, S) {
|
|
8179
8179
|
if (f.length !== _.length)
|
|
8180
8180
|
throw new Error("ipaddr: cannot match CIDR for objects with different lengths");
|
|
8181
|
-
let
|
|
8181
|
+
let $ = 0, T;
|
|
8182
8182
|
for (; S > 0; ) {
|
|
8183
|
-
if (T = w - S, T < 0 && (T = 0), f[
|
|
8183
|
+
if (T = w - S, T < 0 && (T = 0), f[$] >> T !== _[$] >> T)
|
|
8184
8184
|
return !1;
|
|
8185
|
-
S -= w,
|
|
8185
|
+
S -= w, $ += 1;
|
|
8186
8186
|
}
|
|
8187
8187
|
return !0;
|
|
8188
8188
|
}
|
|
@@ -8268,9 +8268,9 @@ var lh = { exports: {} };
|
|
|
8268
8268
|
254: 1,
|
|
8269
8269
|
255: 0
|
|
8270
8270
|
};
|
|
8271
|
-
let
|
|
8272
|
-
for (
|
|
8273
|
-
if (T = this.octets[
|
|
8271
|
+
let $, T, L;
|
|
8272
|
+
for ($ = 3; $ >= 0; $ -= 1)
|
|
8273
|
+
if (T = this.octets[$], T in S) {
|
|
8274
8274
|
if (L = S[T], w && L !== 0)
|
|
8275
8275
|
return null;
|
|
8276
8276
|
L !== 8 && (w = !0), _ += L;
|
|
@@ -8290,11 +8290,11 @@ var lh = { exports: {} };
|
|
|
8290
8290
|
}, f;
|
|
8291
8291
|
}(), v.IPv4.broadcastAddressFromCIDR = function(f) {
|
|
8292
8292
|
try {
|
|
8293
|
-
const _ = this.parseCIDR(f), w = _[0].toByteArray(), S = this.subnetMaskFromPrefixLength(_[1]).toByteArray(),
|
|
8293
|
+
const _ = this.parseCIDR(f), w = _[0].toByteArray(), S = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), $ = [];
|
|
8294
8294
|
let T = 0;
|
|
8295
8295
|
for (; T < 4; )
|
|
8296
|
-
|
|
8297
|
-
return new this(
|
|
8296
|
+
$.push(parseInt(w[T], 10) | parseInt(S[T], 10) ^ 255), T++;
|
|
8297
|
+
return new this($);
|
|
8298
8298
|
} catch {
|
|
8299
8299
|
throw new Error("ipaddr: the address does not have IPv4 CIDR format");
|
|
8300
8300
|
}
|
|
@@ -8315,11 +8315,11 @@ var lh = { exports: {} };
|
|
|
8315
8315
|
}, v.IPv4.isValidFourPartDecimal = function(f) {
|
|
8316
8316
|
return !!(v.IPv4.isValid(f) && f.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/));
|
|
8317
8317
|
}, v.IPv4.networkAddressFromCIDR = function(f) {
|
|
8318
|
-
let _, w, S,
|
|
8318
|
+
let _, w, S, $, T;
|
|
8319
8319
|
try {
|
|
8320
|
-
for (_ = this.parseCIDR(f), S = _[0].toByteArray(), T = this.subnetMaskFromPrefixLength(_[1]).toByteArray(),
|
|
8321
|
-
|
|
8322
|
-
return new this(
|
|
8320
|
+
for (_ = this.parseCIDR(f), S = _[0].toByteArray(), T = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), $ = [], w = 0; w < 4; )
|
|
8321
|
+
$.push(parseInt(S[w], 10) & parseInt(T[w], 10)), w++;
|
|
8322
|
+
return new this($);
|
|
8323
8323
|
} catch {
|
|
8324
8324
|
throw new Error("ipaddr: the address does not have IPv4 CIDR format");
|
|
8325
8325
|
}
|
|
@@ -8346,31 +8346,31 @@ var lh = { exports: {} };
|
|
|
8346
8346
|
let _, w, S;
|
|
8347
8347
|
if (_ = f.match(r.fourOctet))
|
|
8348
8348
|
return function() {
|
|
8349
|
-
const
|
|
8350
|
-
for (let L = 0; L <
|
|
8351
|
-
w =
|
|
8349
|
+
const $ = _.slice(1, 6), T = [];
|
|
8350
|
+
for (let L = 0; L < $.length; L++)
|
|
8351
|
+
w = $[L], T.push(h(w));
|
|
8352
8352
|
return T;
|
|
8353
8353
|
}();
|
|
8354
8354
|
if (_ = f.match(r.longValue)) {
|
|
8355
8355
|
if (S = h(_[1]), S > 4294967295 || S < 0)
|
|
8356
8356
|
throw new Error("ipaddr: address outside defined range");
|
|
8357
8357
|
return function() {
|
|
8358
|
-
const
|
|
8358
|
+
const $ = [];
|
|
8359
8359
|
let T;
|
|
8360
8360
|
for (T = 0; T <= 24; T += 8)
|
|
8361
|
-
|
|
8362
|
-
return
|
|
8361
|
+
$.push(S >> T & 255);
|
|
8362
|
+
return $;
|
|
8363
8363
|
}().reverse();
|
|
8364
8364
|
} else return (_ = f.match(r.twoOctet)) ? function() {
|
|
8365
|
-
const
|
|
8366
|
-
if (S = h(
|
|
8365
|
+
const $ = _.slice(1, 4), T = [];
|
|
8366
|
+
if (S = h($[1]), S > 16777215 || S < 0)
|
|
8367
8367
|
throw new Error("ipaddr: address outside defined range");
|
|
8368
|
-
return T.push(h(
|
|
8368
|
+
return T.push(h($[0])), T.push(S >> 16 & 255), T.push(S >> 8 & 255), T.push(S & 255), T;
|
|
8369
8369
|
}() : (_ = f.match(r.threeOctet)) ? function() {
|
|
8370
|
-
const
|
|
8371
|
-
if (S = h(
|
|
8370
|
+
const $ = _.slice(1, 5), T = [];
|
|
8371
|
+
if (S = h($[2]), S > 65535 || S < 0)
|
|
8372
8372
|
throw new Error("ipaddr: address outside defined range");
|
|
8373
|
-
return T.push(h(
|
|
8373
|
+
return T.push(h($[0])), T.push(h($[1])), T.push(S >> 8 & 255), T.push(S & 255), T;
|
|
8374
8374
|
}() : null;
|
|
8375
8375
|
}, v.IPv4.subnetMaskFromPrefixLength = function(f) {
|
|
8376
8376
|
if (f = parseInt(f), f < 0 || f > 32)
|
|
@@ -8383,7 +8383,7 @@ var lh = { exports: {} };
|
|
|
8383
8383
|
return S < 4 && (_[S] = Math.pow(2, f % 8) - 1 << 8 - f % 8), new this(_);
|
|
8384
8384
|
}, v.IPv6 = function() {
|
|
8385
8385
|
function f(_, w) {
|
|
8386
|
-
let S,
|
|
8386
|
+
let S, $;
|
|
8387
8387
|
if (_.length === 16)
|
|
8388
8388
|
for (this.parts = [], S = 0; S <= 14; S += 2)
|
|
8389
8389
|
this.parts.push(_[S] << 8 | _[S + 1]);
|
|
@@ -8392,7 +8392,7 @@ var lh = { exports: {} };
|
|
|
8392
8392
|
else
|
|
8393
8393
|
throw new Error("ipaddr: ipv6 part count should be 8 or 16");
|
|
8394
8394
|
for (S = 0; S < this.parts.length; S++)
|
|
8395
|
-
if (
|
|
8395
|
+
if ($ = this.parts[S], !(0 <= $ && $ <= 65535))
|
|
8396
8396
|
throw new Error("ipaddr: ipv6 part should fit in 16 bits");
|
|
8397
8397
|
w && (this.zoneId = w);
|
|
8398
8398
|
}
|
|
@@ -8461,10 +8461,10 @@ var lh = { exports: {} };
|
|
|
8461
8461
|
65534: 1,
|
|
8462
8462
|
65535: 0
|
|
8463
8463
|
};
|
|
8464
|
-
let
|
|
8464
|
+
let $, T;
|
|
8465
8465
|
for (let L = 7; L >= 0; L -= 1)
|
|
8466
|
-
if (
|
|
8467
|
-
if (T = S[
|
|
8466
|
+
if ($ = this.parts[L], $ in S) {
|
|
8467
|
+
if (T = S[$], w && T !== 0)
|
|
8468
8468
|
return null;
|
|
8469
8469
|
T !== 16 && (w = !0), _ += T;
|
|
8470
8470
|
} else
|
|
@@ -8475,14 +8475,14 @@ var lh = { exports: {} };
|
|
|
8475
8475
|
}, f.prototype.toByteArray = function() {
|
|
8476
8476
|
let _;
|
|
8477
8477
|
const w = [], S = this.parts;
|
|
8478
|
-
for (let
|
|
8479
|
-
_ = S[
|
|
8478
|
+
for (let $ = 0; $ < S.length; $++)
|
|
8479
|
+
_ = S[$], w.push(_ >> 8), w.push(_ & 255);
|
|
8480
8480
|
return w;
|
|
8481
8481
|
}, f.prototype.toFixedLengthString = function() {
|
|
8482
8482
|
const _ = (function() {
|
|
8483
8483
|
const S = [];
|
|
8484
|
-
for (let
|
|
8485
|
-
S.push(m(this.parts[
|
|
8484
|
+
for (let $ = 0; $ < this.parts.length; $++)
|
|
8485
|
+
S.push(m(this.parts[$].toString(16), 4));
|
|
8486
8486
|
return S;
|
|
8487
8487
|
}).call(this).join(":");
|
|
8488
8488
|
let w = "";
|
|
@@ -8495,28 +8495,28 @@ var lh = { exports: {} };
|
|
|
8495
8495
|
}, f.prototype.toNormalizedString = function() {
|
|
8496
8496
|
const _ = (function() {
|
|
8497
8497
|
const S = [];
|
|
8498
|
-
for (let
|
|
8499
|
-
S.push(this.parts[
|
|
8498
|
+
for (let $ = 0; $ < this.parts.length; $++)
|
|
8499
|
+
S.push(this.parts[$].toString(16));
|
|
8500
8500
|
return S;
|
|
8501
8501
|
}).call(this).join(":");
|
|
8502
8502
|
let w = "";
|
|
8503
8503
|
return this.zoneId && (w = `%${this.zoneId}`), _ + w;
|
|
8504
8504
|
}, f.prototype.toRFC5952String = function() {
|
|
8505
8505
|
const _ = /((^|:)(0(:|$)){2,})/g, w = this.toNormalizedString();
|
|
8506
|
-
let S = 0,
|
|
8506
|
+
let S = 0, $ = -1, T;
|
|
8507
8507
|
for (; T = _.exec(w); )
|
|
8508
|
-
T[0].length >
|
|
8509
|
-
return
|
|
8508
|
+
T[0].length > $ && (S = T.index, $ = T[0].length);
|
|
8509
|
+
return $ < 0 ? w : `${w.substring(0, S)}::${w.substring(S + $)}`;
|
|
8510
8510
|
}, f.prototype.toString = function() {
|
|
8511
8511
|
return this.toRFC5952String();
|
|
8512
8512
|
}, f;
|
|
8513
8513
|
}(), v.IPv6.broadcastAddressFromCIDR = function(f) {
|
|
8514
8514
|
try {
|
|
8515
|
-
const _ = this.parseCIDR(f), w = _[0].toByteArray(), S = this.subnetMaskFromPrefixLength(_[1]).toByteArray(),
|
|
8515
|
+
const _ = this.parseCIDR(f), w = _[0].toByteArray(), S = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), $ = [];
|
|
8516
8516
|
let T = 0;
|
|
8517
8517
|
for (; T < 16; )
|
|
8518
|
-
|
|
8519
|
-
return new this(
|
|
8518
|
+
$.push(parseInt(w[T], 10) | parseInt(S[T], 10) ^ 255), T++;
|
|
8519
|
+
return new this($);
|
|
8520
8520
|
} catch (_) {
|
|
8521
8521
|
throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${_})`);
|
|
8522
8522
|
}
|
|
@@ -8540,11 +8540,11 @@ var lh = { exports: {} };
|
|
|
8540
8540
|
return !1;
|
|
8541
8541
|
}
|
|
8542
8542
|
}, v.IPv6.networkAddressFromCIDR = function(f) {
|
|
8543
|
-
let _, w, S,
|
|
8543
|
+
let _, w, S, $, T;
|
|
8544
8544
|
try {
|
|
8545
|
-
for (_ = this.parseCIDR(f), S = _[0].toByteArray(), T = this.subnetMaskFromPrefixLength(_[1]).toByteArray(),
|
|
8546
|
-
|
|
8547
|
-
return new this(
|
|
8545
|
+
for (_ = this.parseCIDR(f), S = _[0].toByteArray(), T = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), $ = [], w = 0; w < 16; )
|
|
8546
|
+
$.push(parseInt(S[w], 10) & parseInt(T[w], 10)), w++;
|
|
8547
|
+
return new this($);
|
|
8548
8548
|
} catch (L) {
|
|
8549
8549
|
throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${L})`);
|
|
8550
8550
|
}
|
|
@@ -8563,7 +8563,7 @@ var lh = { exports: {} };
|
|
|
8563
8563
|
}), S;
|
|
8564
8564
|
throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range");
|
|
8565
8565
|
}, v.IPv6.parser = function(f) {
|
|
8566
|
-
let _, w, S,
|
|
8566
|
+
let _, w, S, $, T, L;
|
|
8567
8567
|
if (S = f.match(l.deprecatedTransitional))
|
|
8568
8568
|
return this.parser(`::ffff:${S[1]}`);
|
|
8569
8569
|
if (l.native.test(f))
|
|
@@ -8575,7 +8575,7 @@ var lh = { exports: {} };
|
|
|
8575
8575
|
parseInt(S[4]),
|
|
8576
8576
|
parseInt(S[5])
|
|
8577
8577
|
], w = 0; w < T.length; w++)
|
|
8578
|
-
if (
|
|
8578
|
+
if ($ = T[w], !(0 <= $ && $ <= 255))
|
|
8579
8579
|
return null;
|
|
8580
8580
|
return _.parts.push(T[0] << 8 | T[1]), _.parts.push(T[2] << 8 | T[3]), {
|
|
8581
8581
|
parts: _.parts,
|
|
@@ -8623,13 +8623,13 @@ var lh = { exports: {} };
|
|
|
8623
8623
|
const _ = this.parse(f);
|
|
8624
8624
|
return _.kind() === "ipv6" && _.isIPv4MappedAddress() ? _.toIPv4Address() : _;
|
|
8625
8625
|
}, v.subnetMatch = function(f, _, w) {
|
|
8626
|
-
let S,
|
|
8626
|
+
let S, $, T, L;
|
|
8627
8627
|
w == null && (w = "unicast");
|
|
8628
|
-
for (
|
|
8629
|
-
if (Object.prototype.hasOwnProperty.call(_,
|
|
8630
|
-
for (T = _[
|
|
8628
|
+
for ($ in _)
|
|
8629
|
+
if (Object.prototype.hasOwnProperty.call(_, $)) {
|
|
8630
|
+
for (T = _[$], T[0] && !(T[0] instanceof Array) && (T = [T]), S = 0; S < T.length; S++)
|
|
8631
8631
|
if (L = T[S], f.kind() === L[0].kind() && f.match.apply(f, L))
|
|
8632
|
-
return
|
|
8632
|
+
return $;
|
|
8633
8633
|
}
|
|
8634
8634
|
return w;
|
|
8635
8635
|
}, t.exports ? t.exports = v : e.ipaddr = v;
|
|
@@ -13597,7 +13597,7 @@ const ay = 1e3 * 60 * 60 * 24, cy = new le().openapi(
|
|
|
13597
13597
|
async (t) => {
|
|
13598
13598
|
const { kid: e } = t.req.valid("param"), r = (await t.env.data.keys.list()).find((i) => i.kid === e);
|
|
13599
13599
|
if (!r)
|
|
13600
|
-
throw new
|
|
13600
|
+
throw new N(404, { message: "Key not found" });
|
|
13601
13601
|
return t.json(r);
|
|
13602
13602
|
}
|
|
13603
13603
|
).openapi(
|
|
@@ -13661,7 +13661,7 @@ const ay = 1e3 * 60 * 60 * 24, cy = new le().openapi(
|
|
|
13661
13661
|
if (!await t.env.data.keys.update(e, {
|
|
13662
13662
|
revoked_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
13663
13663
|
}))
|
|
13664
|
-
throw new
|
|
13664
|
+
throw new N(404, { message: "Key not found" });
|
|
13665
13665
|
const r = await qc({
|
|
13666
13666
|
name: `CN=${t.env.ORGANIZATION_NAME}`
|
|
13667
13667
|
});
|
|
@@ -13783,7 +13783,7 @@ const ay = 1e3 * 60 * 60 * 24, cy = new le().openapi(
|
|
|
13783
13783
|
include_totals: !1
|
|
13784
13784
|
})).applications.find((s) => s.id === n);
|
|
13785
13785
|
if (!i)
|
|
13786
|
-
throw new
|
|
13786
|
+
throw new N(404);
|
|
13787
13787
|
return t.json(i);
|
|
13788
13788
|
}
|
|
13789
13789
|
).openapi(
|
|
@@ -13813,7 +13813,7 @@ const ay = 1e3 * 60 * 60 * 24, cy = new le().openapi(
|
|
|
13813
13813
|
async (t) => {
|
|
13814
13814
|
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
|
|
13815
13815
|
if (!await t.env.data.applications.remove(e, n))
|
|
13816
|
-
throw new
|
|
13816
|
+
throw new N(404, { message: "Application not found" });
|
|
13817
13817
|
return t.text("OK");
|
|
13818
13818
|
}
|
|
13819
13819
|
).openapi(
|
|
@@ -13857,7 +13857,7 @@ const ay = 1e3 * 60 * 60 * 24, cy = new le().openapi(
|
|
|
13857
13857
|
await t.env.data.applications.update(e, n, i);
|
|
13858
13858
|
const s = await t.env.data.applications.get(e, n);
|
|
13859
13859
|
if (!s)
|
|
13860
|
-
throw new
|
|
13860
|
+
throw new N(404, { message: "Application not found" });
|
|
13861
13861
|
return t.json(s);
|
|
13862
13862
|
}
|
|
13863
13863
|
).openapi(
|
|
@@ -13983,7 +13983,7 @@ const py = jn.extend({
|
|
|
13983
13983
|
async (t) => {
|
|
13984
13984
|
const { id: e } = t.req.valid("param"), n = await t.env.data.tenants.get(e);
|
|
13985
13985
|
if (!n)
|
|
13986
|
-
throw new
|
|
13986
|
+
throw new N(404);
|
|
13987
13987
|
return t.json(n);
|
|
13988
13988
|
}
|
|
13989
13989
|
).openapi(
|
|
@@ -14148,7 +14148,7 @@ const py = jn.extend({
|
|
|
14148
14148
|
async (t) => {
|
|
14149
14149
|
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.logs.get(e, n);
|
|
14150
14150
|
if (!r)
|
|
14151
|
-
throw new
|
|
14151
|
+
throw new N(404);
|
|
14152
14152
|
return t.json(r);
|
|
14153
14153
|
}
|
|
14154
14154
|
), my = jn.extend({
|
|
@@ -14271,7 +14271,7 @@ const py = jn.extend({
|
|
|
14271
14271
|
await t.env.data.hooks.update(e, n, r);
|
|
14272
14272
|
const i = await t.env.data.hooks.get(e, n);
|
|
14273
14273
|
if (!i)
|
|
14274
|
-
throw new
|
|
14274
|
+
throw new N(404, { message: "Hook not found" });
|
|
14275
14275
|
return t.json(i);
|
|
14276
14276
|
}
|
|
14277
14277
|
).openapi(
|
|
@@ -14309,7 +14309,7 @@ const py = jn.extend({
|
|
|
14309
14309
|
async (t) => {
|
|
14310
14310
|
const { "tenant-id": e } = t.req.valid("header"), { hook_id: n } = t.req.valid("param"), r = await t.env.data.hooks.get(e, n);
|
|
14311
14311
|
if (!r)
|
|
14312
|
-
throw new
|
|
14312
|
+
throw new N(404, { message: "Hook not found" });
|
|
14313
14313
|
return t.json(r);
|
|
14314
14314
|
}
|
|
14315
14315
|
).openapi(
|
|
@@ -14339,7 +14339,7 @@ const py = jn.extend({
|
|
|
14339
14339
|
async (t) => {
|
|
14340
14340
|
const { "tenant-id": e } = t.req.valid("header"), { hook_id: n } = t.req.valid("param");
|
|
14341
14341
|
if (!await t.env.data.hooks.remove(e, n))
|
|
14342
|
-
throw new
|
|
14342
|
+
throw new N(404, { message: "Hook not found" });
|
|
14343
14343
|
return t.text("OK");
|
|
14344
14344
|
}
|
|
14345
14345
|
), yy = jn.extend({
|
|
@@ -14422,7 +14422,7 @@ const py = jn.extend({
|
|
|
14422
14422
|
async (t) => {
|
|
14423
14423
|
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.connections.get(e, n);
|
|
14424
14424
|
if (!r)
|
|
14425
|
-
throw new
|
|
14425
|
+
throw new N(404);
|
|
14426
14426
|
return t.json(r);
|
|
14427
14427
|
}
|
|
14428
14428
|
).openapi(
|
|
@@ -14452,7 +14452,7 @@ const py = jn.extend({
|
|
|
14452
14452
|
async (t) => {
|
|
14453
14453
|
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
|
|
14454
14454
|
if (!await t.env.data.connections.remove(e, n))
|
|
14455
|
-
throw new
|
|
14455
|
+
throw new N(404, {
|
|
14456
14456
|
message: "Connection not found"
|
|
14457
14457
|
});
|
|
14458
14458
|
return t.text("OK");
|
|
@@ -14496,12 +14496,12 @@ const py = jn.extend({
|
|
|
14496
14496
|
async (t) => {
|
|
14497
14497
|
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = t.req.valid("json");
|
|
14498
14498
|
if (!await t.env.data.connections.update(e, n, r))
|
|
14499
|
-
throw new
|
|
14499
|
+
throw new N(404, {
|
|
14500
14500
|
message: "Connection not found"
|
|
14501
14501
|
});
|
|
14502
14502
|
const s = await t.env.data.connections.get(e, n);
|
|
14503
14503
|
if (!s)
|
|
14504
|
-
throw new
|
|
14504
|
+
throw new N(404, {
|
|
14505
14505
|
message: "Connection not found"
|
|
14506
14506
|
});
|
|
14507
14507
|
return t.json(s);
|
|
@@ -14640,7 +14640,7 @@ async function by(t) {
|
|
|
14640
14640
|
throw new Error("Failed to fetch jwks");
|
|
14641
14641
|
return (await e.json()).keys;
|
|
14642
14642
|
} catch (e) {
|
|
14643
|
-
throw new
|
|
14643
|
+
throw new N(500, {
|
|
14644
14644
|
message: `Failed to fetch jwks: ${e.message}`
|
|
14645
14645
|
});
|
|
14646
14646
|
}
|
|
@@ -14684,17 +14684,17 @@ function tg(t) {
|
|
|
14684
14684
|
return await n();
|
|
14685
14685
|
const l = e.req.header("authorization") || "", [u, p] = l.split(" ");
|
|
14686
14686
|
if ((u == null ? void 0 : u.toLowerCase()) !== "bearer" || !p)
|
|
14687
|
-
throw new
|
|
14687
|
+
throw new N(401, {
|
|
14688
14688
|
message: "Missing bearer token"
|
|
14689
14689
|
});
|
|
14690
14690
|
const h = xy(p);
|
|
14691
14691
|
if (!h || !await ky(e, h))
|
|
14692
|
-
throw new
|
|
14692
|
+
throw new N(403, { message: "Invalid JWT signature" });
|
|
14693
14693
|
e.set("user_id", h.payload.sub), e.set("user", h.payload);
|
|
14694
14694
|
const m = h.payload.permissions || [], v = ((o = h.payload.scope) == null ? void 0 : o.split(" ")) || [];
|
|
14695
14695
|
if (c.length && !// Should we check both?
|
|
14696
14696
|
(c.some((f) => m.includes(f)) || c.some((f) => v.includes(f))))
|
|
14697
|
-
throw new
|
|
14697
|
+
throw new N(403, { message: "Unauthorized" });
|
|
14698
14698
|
}
|
|
14699
14699
|
return await n();
|
|
14700
14700
|
};
|
|
@@ -14728,7 +14728,7 @@ const Sy = new le().openapi(
|
|
|
14728
14728
|
async (t) => {
|
|
14729
14729
|
const { "tenant-id": e } = t.req.valid("header"), n = await t.env.data.emailProviders.get(e);
|
|
14730
14730
|
if (!n)
|
|
14731
|
-
throw new
|
|
14731
|
+
throw new N(404, { message: "Email provider not found" });
|
|
14732
14732
|
return t.json(n);
|
|
14733
14733
|
}
|
|
14734
14734
|
).openapi(
|
|
@@ -14827,7 +14827,7 @@ const Sy = new le().openapi(
|
|
|
14827
14827
|
async (t) => {
|
|
14828
14828
|
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.sessions.get(e, n);
|
|
14829
14829
|
if (!r)
|
|
14830
|
-
throw new
|
|
14830
|
+
throw new N(404);
|
|
14831
14831
|
return t.json(r);
|
|
14832
14832
|
}
|
|
14833
14833
|
).openapi(
|
|
@@ -14857,7 +14857,7 @@ const Sy = new le().openapi(
|
|
|
14857
14857
|
async (t) => {
|
|
14858
14858
|
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
|
|
14859
14859
|
if (!await t.env.data.sessions.remove(e, n))
|
|
14860
|
-
throw new
|
|
14860
|
+
throw new N(404, {
|
|
14861
14861
|
message: "Session not found"
|
|
14862
14862
|
});
|
|
14863
14863
|
return t.text("OK");
|
|
@@ -14891,7 +14891,7 @@ const Sy = new le().openapi(
|
|
|
14891
14891
|
if (!await t.env.data.sessions.update(e, n, {
|
|
14892
14892
|
revoked_at: (/* @__PURE__ */ new Date()).toDateString()
|
|
14893
14893
|
}))
|
|
14894
|
-
throw new
|
|
14894
|
+
throw new N(404, {
|
|
14895
14895
|
message: "Session not found"
|
|
14896
14896
|
});
|
|
14897
14897
|
return t.text("Session deletion request accepted.", { status: 202 });
|
|
@@ -14928,7 +14928,7 @@ const Sy = new le().openapi(
|
|
|
14928
14928
|
async (t) => {
|
|
14929
14929
|
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.refreshTokens.get(e, n);
|
|
14930
14930
|
if (!r)
|
|
14931
|
-
throw new
|
|
14931
|
+
throw new N(404);
|
|
14932
14932
|
return t.json(r);
|
|
14933
14933
|
}
|
|
14934
14934
|
).openapi(
|
|
@@ -14958,7 +14958,7 @@ const Sy = new le().openapi(
|
|
|
14958
14958
|
async (t) => {
|
|
14959
14959
|
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
|
|
14960
14960
|
if (!await t.env.data.refreshTokens.remove(e, n))
|
|
14961
|
-
throw new
|
|
14961
|
+
throw new N(404, {
|
|
14962
14962
|
message: "Session not found"
|
|
14963
14963
|
});
|
|
14964
14964
|
return t.text("OK");
|
|
@@ -15026,7 +15026,7 @@ const Sy = new le().openapi(
|
|
|
15026
15026
|
async (t) => {
|
|
15027
15027
|
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.customDomains.get(e, n);
|
|
15028
15028
|
if (!r)
|
|
15029
|
-
throw new
|
|
15029
|
+
throw new N(404);
|
|
15030
15030
|
return t.json(r);
|
|
15031
15031
|
}
|
|
15032
15032
|
).openapi(
|
|
@@ -15056,7 +15056,7 @@ const Sy = new le().openapi(
|
|
|
15056
15056
|
async (t) => {
|
|
15057
15057
|
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
|
|
15058
15058
|
if (!await t.env.data.customDomains.remove(e, n))
|
|
15059
|
-
throw new
|
|
15059
|
+
throw new N(404, {
|
|
15060
15060
|
message: "Custom domain not found"
|
|
15061
15061
|
});
|
|
15062
15062
|
return t.text("OK");
|
|
@@ -15104,10 +15104,10 @@ const Sy = new le().openapi(
|
|
|
15104
15104
|
n,
|
|
15105
15105
|
r
|
|
15106
15106
|
))
|
|
15107
|
-
throw new
|
|
15107
|
+
throw new N(404);
|
|
15108
15108
|
const s = await t.env.data.customDomains.get(e, n);
|
|
15109
15109
|
if (!s)
|
|
15110
|
-
throw new
|
|
15110
|
+
throw new N(404);
|
|
15111
15111
|
return t.json(s);
|
|
15112
15112
|
}
|
|
15113
15113
|
).openapi(
|
|
@@ -15153,14 +15153,19 @@ const Sy = new le().openapi(
|
|
|
15153
15153
|
);
|
|
15154
15154
|
function Cy() {
|
|
15155
15155
|
const t = new le();
|
|
15156
|
-
t.use(tg(t));
|
|
15156
|
+
eg(t), t.use(tg(t));
|
|
15157
15157
|
const e = t.route("/branding", Km).route("/custom-domains", Iy).route("/email/providers", Sy).route("/users", c_).route("/keys", cy).route("/users-by-email", ly).route("/clients", dy).route("/tenants", fy).route("/logs", gy).route("/hooks", _y).route("/connections", vy).route("/prompts", wy).route("/sessions", Ay).route("/refresh_tokens", Ey);
|
|
15158
|
-
return
|
|
15158
|
+
return e.doc("/spec", {
|
|
15159
15159
|
openapi: "3.0.0",
|
|
15160
15160
|
info: {
|
|
15161
15161
|
version: "1.0.0",
|
|
15162
15162
|
title: "Management api"
|
|
15163
|
-
}
|
|
15163
|
+
},
|
|
15164
|
+
security: [
|
|
15165
|
+
{
|
|
15166
|
+
oauth2: ["openid", "email", "profile"]
|
|
15167
|
+
}
|
|
15168
|
+
]
|
|
15164
15169
|
}), e;
|
|
15165
15170
|
}
|
|
15166
15171
|
function Ny(t, e) {
|
|
@@ -16233,7 +16238,7 @@ async function vv(t, e, n) {
|
|
|
16233
16238
|
}
|
|
16234
16239
|
);
|
|
16235
16240
|
if (!l.ok)
|
|
16236
|
-
throw new
|
|
16241
|
+
throw new N(400, { message: "Failed to get user from vipps" });
|
|
16237
16242
|
return await l.json();
|
|
16238
16243
|
}
|
|
16239
16244
|
const wv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -16256,7 +16261,7 @@ function ug(t, e) {
|
|
|
16256
16261
|
async function Lo(t, e) {
|
|
16257
16262
|
const n = await t.data.clients.get(e);
|
|
16258
16263
|
if (!n)
|
|
16259
|
-
throw new
|
|
16264
|
+
throw new N(403, { message: "Client not found" });
|
|
16260
16265
|
const r = t.DEFAULT_CLIENT_ID ? await t.data.clients.get(t.DEFAULT_CLIENT_ID) : void 0, i = await t.data.connections.list(n.tenant.id), s = t.DEFAULT_TENANT_ID ? await t.data.connections.list(t.DEFAULT_TENANT_ID) : { connections: [] }, o = i.connections.map((c) => {
|
|
16261
16266
|
var p;
|
|
16262
16267
|
const l = (p = s.connections) == null ? void 0 : p.find(
|
|
@@ -17443,21 +17448,21 @@ function Hw(t, e, n) {
|
|
|
17443
17448
|
async function Kw(t, e, n, r, i) {
|
|
17444
17449
|
var m, v, f;
|
|
17445
17450
|
if (!n.redirect_uri)
|
|
17446
|
-
throw new
|
|
17451
|
+
throw new N(400, {
|
|
17447
17452
|
message: "Missing redirect_uri in authParams"
|
|
17448
17453
|
});
|
|
17449
17454
|
const [s] = await t.env.data.keys.list();
|
|
17450
17455
|
if (!s)
|
|
17451
|
-
throw new
|
|
17456
|
+
throw new N(500, {
|
|
17452
17457
|
message: "No signing key found"
|
|
17453
17458
|
});
|
|
17454
17459
|
if (!((m = e.addons) != null && m.samlp))
|
|
17455
|
-
throw new
|
|
17460
|
+
throw new N(400, {
|
|
17456
17461
|
message: `SAML Addon is not enabled for client ${e.id}`
|
|
17457
17462
|
});
|
|
17458
17463
|
const { recipient: o, audience: c } = e.addons.samlp, l = n.state || "";
|
|
17459
17464
|
if (!o || !l || !r || !n.state)
|
|
17460
|
-
throw new
|
|
17465
|
+
throw new N(400, {
|
|
17461
17466
|
message: "Missing recipient or inResponseTo"
|
|
17462
17467
|
});
|
|
17463
17468
|
const u = JSON.parse(n.state), p = new URL(n.redirect_uri), h = await Ww(t, {
|
|
@@ -17836,7 +17841,7 @@ async function Mo(t, e) {
|
|
|
17836
17841
|
(S) => !S.revoked_at || new Date(S.revoked_at) > /* @__PURE__ */ new Date()
|
|
17837
17842
|
), l = c[c.length - 1];
|
|
17838
17843
|
if (!(l != null && l.pkcs7))
|
|
17839
|
-
throw new
|
|
17844
|
+
throw new N(500, { message: "No signing key available" });
|
|
17840
17845
|
const u = xv(l.pkcs7), p = {
|
|
17841
17846
|
// TODO: consider if the dafault should be removed
|
|
17842
17847
|
aud: n.audience || "default",
|
|
@@ -17870,22 +17875,22 @@ async function Mo(t, e) {
|
|
|
17870
17875
|
},
|
|
17871
17876
|
{
|
|
17872
17877
|
accessToken: {
|
|
17873
|
-
setCustomClaim: (S,
|
|
17878
|
+
setCustomClaim: (S, $) => {
|
|
17874
17879
|
if (Ap.includes(S))
|
|
17875
17880
|
throw new Error(`Cannot overwrite reserved claim '${S}'`);
|
|
17876
|
-
p[S] =
|
|
17881
|
+
p[S] = $;
|
|
17877
17882
|
}
|
|
17878
17883
|
},
|
|
17879
17884
|
idToken: {
|
|
17880
|
-
setCustomClaim: (S,
|
|
17885
|
+
setCustomClaim: (S, $) => {
|
|
17881
17886
|
if (Ap.includes(S))
|
|
17882
17887
|
throw new Error(`Cannot overwrite reserved claim '${S}'`);
|
|
17883
|
-
h && (h[S] =
|
|
17888
|
+
h && (h[S] = $);
|
|
17884
17889
|
}
|
|
17885
17890
|
},
|
|
17886
17891
|
access: {
|
|
17887
17892
|
deny: (S) => {
|
|
17888
|
-
throw new
|
|
17893
|
+
throw new N(400, {
|
|
17889
17894
|
message: `Access denied: ${S}`
|
|
17890
17895
|
});
|
|
17891
17896
|
}
|
|
@@ -17990,7 +17995,7 @@ async function on(t, e) {
|
|
|
17990
17995
|
})
|
|
17991
17996
|
), s) {
|
|
17992
17997
|
if (!e.loginSession)
|
|
17993
|
-
throw new
|
|
17998
|
+
throw new N(500, {
|
|
17994
17999
|
message: "Login session not found"
|
|
17995
18000
|
});
|
|
17996
18001
|
const f = kv(), _ = Ve(12), w = await t.env.data.codes.create(i.tenant.id, {
|
|
@@ -18044,7 +18049,7 @@ async function on(t, e) {
|
|
|
18044
18049
|
});
|
|
18045
18050
|
if ((n.response_type || mn.CODE) === mn.CODE) {
|
|
18046
18051
|
if (!e.loginSession)
|
|
18047
|
-
throw new
|
|
18052
|
+
throw new N(500, {
|
|
18048
18053
|
message: "Login session not found"
|
|
18049
18054
|
});
|
|
18050
18055
|
const f = await t.env.data.codes.create(i.tenant.id, {
|
|
@@ -18056,10 +18061,12 @@ async function on(t, e) {
|
|
|
18056
18061
|
Date.now() + jy * 1e3
|
|
18057
18062
|
).toISOString()
|
|
18058
18063
|
});
|
|
18059
|
-
|
|
18060
|
-
|
|
18061
|
-
|
|
18062
|
-
|
|
18064
|
+
if (!n.redirect_uri)
|
|
18065
|
+
throw new N(400, {
|
|
18066
|
+
message: "Redirect uri not found"
|
|
18067
|
+
});
|
|
18068
|
+
const _ = new URL(n.redirect_uri);
|
|
18069
|
+
_.searchParams.set("code", f.code_id), n.state && _.searchParams.set("state", n.state), h.set("location", _.toString());
|
|
18063
18070
|
}
|
|
18064
18071
|
return new Response("Redirecting", {
|
|
18065
18072
|
status: 302,
|
|
@@ -18097,7 +18104,7 @@ async function bg(t, e, n, r) {
|
|
|
18097
18104
|
type: ve.FAILED_SIGNUP,
|
|
18098
18105
|
description: "Public signup is disabled"
|
|
18099
18106
|
});
|
|
18100
|
-
throw await t.env.data.logs.create(e.tenant.id, s), new
|
|
18107
|
+
throw await t.env.data.logs.create(e.tenant.id, s), new N(400, {
|
|
18101
18108
|
message: "Signups are disabled for this client"
|
|
18102
18109
|
});
|
|
18103
18110
|
}
|
|
@@ -18111,7 +18118,7 @@ function tb(t, e) {
|
|
|
18111
18118
|
}
|
|
18112
18119
|
async function nb(t, e, n, r) {
|
|
18113
18120
|
if (!r.state)
|
|
18114
|
-
throw new
|
|
18121
|
+
throw new N(400, { message: "State not found" });
|
|
18115
18122
|
const i = e.connections.find((l) => l.name === n);
|
|
18116
18123
|
if (!i) {
|
|
18117
18124
|
t.set("client_id", e.id);
|
|
@@ -18119,7 +18126,7 @@ async function nb(t, e, n, r) {
|
|
|
18119
18126
|
type: ve.FAILED_LOGIN,
|
|
18120
18127
|
description: "Connection not found"
|
|
18121
18128
|
});
|
|
18122
|
-
throw await t.env.data.logs.create(e.tenant.id, l), new
|
|
18129
|
+
throw await t.env.data.logs.create(e.tenant.id, l), new N(403, { message: "Connection Not Found" });
|
|
18123
18130
|
}
|
|
18124
18131
|
let s = await t.env.data.logins.get(
|
|
18125
18132
|
e.tenant.id,
|
|
@@ -18152,13 +18159,13 @@ async function Ep(t, { code: e, state: n }) {
|
|
|
18152
18159
|
"oauth2_state"
|
|
18153
18160
|
);
|
|
18154
18161
|
if (!i || !i.connection_id)
|
|
18155
|
-
throw new
|
|
18162
|
+
throw new N(403, { message: "State not found" });
|
|
18156
18163
|
const s = await r.data.logins.get(
|
|
18157
18164
|
t.var.tenant_id || "",
|
|
18158
18165
|
i.login_id
|
|
18159
18166
|
);
|
|
18160
18167
|
if (!s)
|
|
18161
|
-
throw new
|
|
18168
|
+
throw new N(403, { message: "Session not found" });
|
|
18162
18169
|
const o = await Lo(
|
|
18163
18170
|
r,
|
|
18164
18171
|
s.authParams.client_id
|
|
@@ -18172,14 +18179,14 @@ async function Ep(t, { code: e, state: n }) {
|
|
|
18172
18179
|
type: ve.FAILED_LOGIN,
|
|
18173
18180
|
description: "Connection not found"
|
|
18174
18181
|
});
|
|
18175
|
-
throw await r.data.logs.create(o.tenant.id, _), new
|
|
18182
|
+
throw await r.data.logs.create(o.tenant.id, _), new N(403, { message: "Connection not found" });
|
|
18176
18183
|
}
|
|
18177
18184
|
if (t.set("connection", c.name), !s.authParams.redirect_uri) {
|
|
18178
18185
|
const _ = xe(t, {
|
|
18179
18186
|
type: ve.FAILED_LOGIN,
|
|
18180
18187
|
description: "Redirect URI not defined"
|
|
18181
18188
|
});
|
|
18182
|
-
throw await r.data.logs.create(o.tenant.id, _), new
|
|
18189
|
+
throw await r.data.logs.create(o.tenant.id, _), new N(403, { message: "Redirect URI not defined" });
|
|
18183
18190
|
}
|
|
18184
18191
|
if (!Uo(
|
|
18185
18192
|
s.authParams.redirect_uri,
|
|
@@ -18190,7 +18197,7 @@ async function Ep(t, { code: e, state: n }) {
|
|
|
18190
18197
|
type: ve.FAILED_LOGIN,
|
|
18191
18198
|
description: _
|
|
18192
18199
|
});
|
|
18193
|
-
throw await r.data.logs.create(o.tenant.id, w), new
|
|
18200
|
+
throw await r.data.logs.create(o.tenant.id, w), new N(403, {
|
|
18194
18201
|
message: _
|
|
18195
18202
|
});
|
|
18196
18203
|
}
|
|
@@ -18214,7 +18221,7 @@ async function Ep(t, { code: e, state: n }) {
|
|
|
18214
18221
|
await bg(t, o, t.env.data, m);
|
|
18215
18222
|
} catch (_) {
|
|
18216
18223
|
const w = _;
|
|
18217
|
-
throw new
|
|
18224
|
+
throw new N(500, {
|
|
18218
18225
|
message: `Failed to run preUserSignupHook: ${w.message}`
|
|
18219
18226
|
});
|
|
18220
18227
|
}
|
|
@@ -18246,16 +18253,16 @@ async function Ip(t, e, n, r, i, s) {
|
|
|
18246
18253
|
"oauth2_state"
|
|
18247
18254
|
);
|
|
18248
18255
|
if (!o)
|
|
18249
|
-
throw new
|
|
18256
|
+
throw new N(400, { message: "State not found" });
|
|
18250
18257
|
const c = await t.env.data.logins.get(
|
|
18251
18258
|
t.var.tenant_id,
|
|
18252
18259
|
o.login_id
|
|
18253
18260
|
);
|
|
18254
18261
|
if (!c)
|
|
18255
|
-
throw new
|
|
18262
|
+
throw new N(400, { message: "Login not found" });
|
|
18256
18263
|
const { redirect_uri: l } = c.authParams;
|
|
18257
18264
|
if (!l)
|
|
18258
|
-
throw new
|
|
18265
|
+
throw new N(400, { message: "Redirect uri not found" });
|
|
18259
18266
|
const u = xe(t, {
|
|
18260
18267
|
type: ve.FAILED_LOGIN,
|
|
18261
18268
|
description: `Failed connection login: ${i} ${n}, ${r}`
|
|
@@ -18314,7 +18321,7 @@ const rb = new le().openapi(
|
|
|
18314
18321
|
o
|
|
18315
18322
|
);
|
|
18316
18323
|
if (!n)
|
|
18317
|
-
throw new
|
|
18324
|
+
throw new N(400, { message: "Code is required" });
|
|
18318
18325
|
return Ep(t, {
|
|
18319
18326
|
code: n,
|
|
18320
18327
|
state: e
|
|
@@ -18368,7 +18375,7 @@ const rb = new le().openapi(
|
|
|
18368
18375
|
o
|
|
18369
18376
|
);
|
|
18370
18377
|
if (!n)
|
|
18371
|
-
throw new
|
|
18378
|
+
throw new N(400, { message: "Code is required" });
|
|
18372
18379
|
return Ep(t, {
|
|
18373
18380
|
code: n,
|
|
18374
18381
|
state: e
|
|
@@ -18411,7 +18418,7 @@ const rb = new le().openapi(
|
|
|
18411
18418
|
],
|
|
18412
18419
|
{ allowPathWildcards: !0 }
|
|
18413
18420
|
))
|
|
18414
|
-
throw new
|
|
18421
|
+
throw new N(400, {
|
|
18415
18422
|
message: "Invalid redirect uri"
|
|
18416
18423
|
});
|
|
18417
18424
|
const o = t.req.header("cookie");
|
|
@@ -18474,13 +18481,13 @@ const rb = new le().openapi(
|
|
|
18474
18481
|
}),
|
|
18475
18482
|
async (t) => {
|
|
18476
18483
|
if (!t.var.user)
|
|
18477
|
-
throw new
|
|
18484
|
+
throw new N(404, { message: "User not found" });
|
|
18478
18485
|
const e = await t.env.data.users.get(
|
|
18479
18486
|
t.var.user.tenant_id,
|
|
18480
18487
|
t.var.user.sub
|
|
18481
18488
|
);
|
|
18482
18489
|
if (!e)
|
|
18483
|
-
throw new
|
|
18490
|
+
throw new N(404, {
|
|
18484
18491
|
message: "User not found"
|
|
18485
18492
|
});
|
|
18486
18493
|
return t.json(Cp.parse({ ...e, sub: e.user_id }));
|
|
@@ -18639,9 +18646,9 @@ const kg = a.object({
|
|
|
18639
18646
|
async function ab(t, e) {
|
|
18640
18647
|
const n = await t.env.data.clients.get(e.client_id);
|
|
18641
18648
|
if (!n)
|
|
18642
|
-
throw new
|
|
18649
|
+
throw new N(403, { message: "Invalid client credentials" });
|
|
18643
18650
|
if (n.client_secret && !Ki(n.client_secret, e.client_secret))
|
|
18644
|
-
throw new
|
|
18651
|
+
throw new N(403, { message: "Invalid client credentials" });
|
|
18645
18652
|
const r = {
|
|
18646
18653
|
client_id: n.id,
|
|
18647
18654
|
scope: e.scope,
|
|
@@ -18665,41 +18672,41 @@ const cb = a.object({
|
|
|
18665
18672
|
async function lb(t, e) {
|
|
18666
18673
|
const n = await t.env.data.clients.get(e.client_id);
|
|
18667
18674
|
if (!n)
|
|
18668
|
-
throw new
|
|
18675
|
+
throw new N(403, { message: "Client not found" });
|
|
18669
18676
|
const r = await t.env.data.codes.get(
|
|
18670
18677
|
n.tenant.id,
|
|
18671
18678
|
e.code,
|
|
18672
18679
|
"authorization_code"
|
|
18673
18680
|
);
|
|
18674
18681
|
if (!r || !r.user_id)
|
|
18675
|
-
throw new
|
|
18682
|
+
throw new N(403, { message: "Invalid client credentials" });
|
|
18676
18683
|
if (new Date(r.expires_at) < /* @__PURE__ */ new Date())
|
|
18677
|
-
throw new
|
|
18684
|
+
throw new N(403, { message: "Code expired" });
|
|
18678
18685
|
if (r.used_at)
|
|
18679
|
-
throw new
|
|
18686
|
+
throw new N(403, { message: "Code already used" });
|
|
18680
18687
|
const i = await t.env.data.logins.get(
|
|
18681
18688
|
n.tenant.id,
|
|
18682
18689
|
r.login_id
|
|
18683
18690
|
);
|
|
18684
18691
|
if (!i)
|
|
18685
|
-
throw new
|
|
18692
|
+
throw new N(403, { message: "Invalid login" });
|
|
18686
18693
|
if ("client_secret" in e) {
|
|
18687
18694
|
const o = await t.env.data.clients.get("DEFAULT_CLIENT");
|
|
18688
18695
|
if (!Ki(n.client_secret, e.client_secret) && !Ki(o == null ? void 0 : o.client_secret, e.client_secret))
|
|
18689
|
-
throw new
|
|
18696
|
+
throw new N(403, { message: "Invalid client credentials" });
|
|
18690
18697
|
} else if ("code_verifier" in e && typeof e.code_verifier == "string" && "code_challenge_method" in i.authParams && typeof i.authParams.code_challenge_method == "string") {
|
|
18691
18698
|
const o = await Sv(
|
|
18692
18699
|
e.code_verifier,
|
|
18693
18700
|
i.authParams.code_challenge_method
|
|
18694
18701
|
);
|
|
18695
18702
|
if (!Ki(o, i.authParams.code_challenge || ""))
|
|
18696
|
-
throw new
|
|
18703
|
+
throw new N(403, { message: "Invalid client credentials" });
|
|
18697
18704
|
}
|
|
18698
18705
|
if (i.authParams.redirect_uri && i.authParams.redirect_uri !== e.redirect_uri)
|
|
18699
|
-
throw new
|
|
18706
|
+
throw new N(403, { message: "Invalid redirect uri" });
|
|
18700
18707
|
const s = await t.env.data.users.get(n.tenant.id, r.user_id);
|
|
18701
18708
|
if (!s)
|
|
18702
|
-
throw new
|
|
18709
|
+
throw new N(403, { message: "User not found" });
|
|
18703
18710
|
return await t.env.data.codes.used(n.tenant.id, e.code), on(t, {
|
|
18704
18711
|
user: s,
|
|
18705
18712
|
client: n,
|
|
@@ -18719,20 +18726,20 @@ const ub = a.object({
|
|
|
18719
18726
|
async function db(t, e) {
|
|
18720
18727
|
const n = await t.env.data.clients.get(e.client_id);
|
|
18721
18728
|
if (!n)
|
|
18722
|
-
throw new
|
|
18729
|
+
throw new N(403, { message: "Client not found" });
|
|
18723
18730
|
const r = await t.env.data.refreshTokens.get(
|
|
18724
18731
|
n.tenant.id,
|
|
18725
18732
|
e.refresh_token
|
|
18726
18733
|
);
|
|
18727
18734
|
if (r) {
|
|
18728
18735
|
if (r.expires_at && new Date(r.expires_at) < /* @__PURE__ */ new Date() || r.idle_expires_at && new Date(r.idle_expires_at) < /* @__PURE__ */ new Date())
|
|
18729
|
-
throw new
|
|
18736
|
+
throw new N(403, {
|
|
18730
18737
|
message: JSON.stringify({
|
|
18731
18738
|
error: "invalid_grant",
|
|
18732
18739
|
error_description: "Refresh token has expired"
|
|
18733
18740
|
})
|
|
18734
18741
|
});
|
|
18735
|
-
} else throw new
|
|
18742
|
+
} else throw new N(403, {
|
|
18736
18743
|
message: JSON.stringify({
|
|
18737
18744
|
error: "invalid_grant",
|
|
18738
18745
|
error_description: "Invalid refresh token"
|
|
@@ -18743,7 +18750,7 @@ async function db(t, e) {
|
|
|
18743
18750
|
r.user_id
|
|
18744
18751
|
);
|
|
18745
18752
|
if (!i)
|
|
18746
|
-
throw new
|
|
18753
|
+
throw new N(403, { message: "User not found" });
|
|
18747
18754
|
const s = r.resource_servers[0];
|
|
18748
18755
|
if (r.idle_expires_at) {
|
|
18749
18756
|
const o = new Date(
|
|
@@ -18841,7 +18848,7 @@ const hb = new le().openapi(
|
|
|
18841
18848
|
async (t) => {
|
|
18842
18849
|
const e = t.req.valid("form"), n = fb(t.req.header("Authorization")), r = { ...e, ...n };
|
|
18843
18850
|
if (!r.client_id)
|
|
18844
|
-
throw new
|
|
18851
|
+
throw new N(400, { message: "client_id is required" });
|
|
18845
18852
|
switch (e.grant_type) {
|
|
18846
18853
|
case Mi.AuthorizationCode:
|
|
18847
18854
|
return lb(
|
|
@@ -18856,7 +18863,7 @@ const hb = new le().openapi(
|
|
|
18856
18863
|
case Mi.RefreshToken:
|
|
18857
18864
|
return db(t, ub.parse(r));
|
|
18858
18865
|
default:
|
|
18859
|
-
throw new
|
|
18866
|
+
throw new N(400, { message: "Not implemented" });
|
|
18860
18867
|
}
|
|
18861
18868
|
}
|
|
18862
18869
|
);
|
|
@@ -18927,10 +18934,10 @@ async function qo(t, e) {
|
|
|
18927
18934
|
const n = await t.env.data.emailProviders.get(t.var.tenant_id) || // Fallback to default tenant
|
|
18928
18935
|
(t.env.DEFAULT_TENANT_ID ? await t.env.data.emailProviders.get(t.env.DEFAULT_TENANT_ID) : null);
|
|
18929
18936
|
if (!n)
|
|
18930
|
-
throw new
|
|
18937
|
+
throw new N(500, { message: "Email provider not found" });
|
|
18931
18938
|
const r = (i = t.env.emailProviders) == null ? void 0 : i[n.name];
|
|
18932
18939
|
if (!r)
|
|
18933
|
-
throw new
|
|
18940
|
+
throw new N(500, { message: "Email provider not found" });
|
|
18934
18941
|
await r({
|
|
18935
18942
|
emailProvider: n,
|
|
18936
18943
|
...e,
|
|
@@ -18940,7 +18947,7 @@ async function qo(t, e) {
|
|
|
18940
18947
|
async function Sg(t, e, n, r) {
|
|
18941
18948
|
const i = await t.env.data.tenants.get(t.var.tenant_id);
|
|
18942
18949
|
if (!i)
|
|
18943
|
-
throw new
|
|
18950
|
+
throw new N(500, { message: "Tenant not found" });
|
|
18944
18951
|
const s = `${Et(t.env)}reset-password?state=${r}&code=${n}`, o = {
|
|
18945
18952
|
vendorName: i.name,
|
|
18946
18953
|
lng: i.language || "en"
|
|
@@ -18971,7 +18978,7 @@ async function Sg(t, e, n, r) {
|
|
|
18971
18978
|
async function Ag(t, e, n) {
|
|
18972
18979
|
const r = await t.env.data.tenants.get(t.var.tenant_id);
|
|
18973
18980
|
if (!r)
|
|
18974
|
-
throw new
|
|
18981
|
+
throw new N(500, { message: "Tenant not found" });
|
|
18975
18982
|
const i = {
|
|
18976
18983
|
vendorName: r.name,
|
|
18977
18984
|
code: n,
|
|
@@ -19008,9 +19015,9 @@ async function Ag(t, e, n) {
|
|
|
19008
19015
|
async function Xl(t, e, n, r) {
|
|
19009
19016
|
const i = await t.env.data.tenants.get(t.var.tenant_id);
|
|
19010
19017
|
if (!i)
|
|
19011
|
-
throw new
|
|
19018
|
+
throw new N(500, { message: "Tenant not found" });
|
|
19012
19019
|
if (!r.redirect_uri)
|
|
19013
|
-
throw new
|
|
19020
|
+
throw new N(400, { message: "redirect_uri is required" });
|
|
19014
19021
|
const s = new URL(je(t.env));
|
|
19015
19022
|
s.pathname = "passwordless/verify_redirect", s.searchParams.set("verification_code", n), s.searchParams.set("connection", "email"), s.searchParams.set("client_id", r.client_id), s.searchParams.set("redirect_uri", r.redirect_uri), s.searchParams.set("email", e), r.response_type && s.searchParams.set("response_type", r.response_type), r.scope && s.searchParams.set("scope", r.scope), r.state && s.searchParams.set("state", r.state), r.nonce && s.searchParams.set("nonce", r.nonce), r.code_challenge && s.searchParams.set("code_challenge", r.code_challenge), r.code_challenge_method && s.searchParams.set(
|
|
19016
19023
|
"code_challenge_method",
|
|
@@ -19052,7 +19059,7 @@ async function Xl(t, e, n, r) {
|
|
|
19052
19059
|
async function Ql(t, e) {
|
|
19053
19060
|
const n = await t.env.data.tenants.get(t.var.tenant_id);
|
|
19054
19061
|
if (!n)
|
|
19055
|
-
throw new
|
|
19062
|
+
throw new N(500, { message: "Tenant not found" });
|
|
19056
19063
|
const r = {
|
|
19057
19064
|
vendorName: n.name,
|
|
19058
19065
|
lng: n.language || "en"
|
|
@@ -19115,11 +19122,11 @@ const mb = new le().openapi(
|
|
|
19115
19122
|
async (t) => {
|
|
19116
19123
|
const { email: e, password: n, client_id: r } = t.req.valid("json"), i = await t.env.data.clients.get(r);
|
|
19117
19124
|
if (!i)
|
|
19118
|
-
throw new
|
|
19125
|
+
throw new N(400, {
|
|
19119
19126
|
message: "Client not found"
|
|
19120
19127
|
});
|
|
19121
19128
|
if (t.set("client_id", i.id), t.set("tenant_id", i.tenant.id), !Yl(n))
|
|
19122
|
-
throw new
|
|
19129
|
+
throw new N(400, {
|
|
19123
19130
|
message: "Password does not meet the requirements"
|
|
19124
19131
|
});
|
|
19125
19132
|
if (await yn({
|
|
@@ -19128,7 +19135,7 @@ const mb = new le().openapi(
|
|
|
19128
19135
|
email: e,
|
|
19129
19136
|
provider: "auth2"
|
|
19130
19137
|
}))
|
|
19131
|
-
throw new
|
|
19138
|
+
throw new N(400, { message: "Invalid sign up" });
|
|
19132
19139
|
const o = await t.env.data.users.create(i.tenant.id, {
|
|
19133
19140
|
user_id: `auth2|${ci()}`,
|
|
19134
19141
|
email: e,
|
|
@@ -19183,7 +19190,7 @@ const mb = new le().openapi(
|
|
|
19183
19190
|
async (t) => {
|
|
19184
19191
|
const { email: e, client_id: n } = t.req.valid("json"), r = await t.env.data.clients.get(n);
|
|
19185
19192
|
if (!r)
|
|
19186
|
-
throw new
|
|
19193
|
+
throw new N(400, {
|
|
19187
19194
|
message: "Client not found"
|
|
19188
19195
|
});
|
|
19189
19196
|
if (t.set("client_id", r.id), t.set("tenant_id", r.tenant.id), !await Gn({
|
|
@@ -19229,15 +19236,15 @@ async function eu(t, e, n, r, i, s) {
|
|
|
19229
19236
|
"otp"
|
|
19230
19237
|
);
|
|
19231
19238
|
if (!c)
|
|
19232
|
-
throw new
|
|
19239
|
+
throw new N(400, {
|
|
19233
19240
|
message: "Code not found or expired"
|
|
19234
19241
|
});
|
|
19235
19242
|
if (c.expires_at < (/* @__PURE__ */ new Date()).toISOString())
|
|
19236
|
-
throw new
|
|
19243
|
+
throw new N(400, {
|
|
19237
19244
|
message: "Code expired"
|
|
19238
19245
|
});
|
|
19239
19246
|
if (c.used_at)
|
|
19240
|
-
throw new
|
|
19247
|
+
throw new N(400, {
|
|
19241
19248
|
message: "Code already used"
|
|
19242
19249
|
});
|
|
19243
19250
|
const l = await o.data.logins.get(
|
|
@@ -19245,7 +19252,7 @@ async function eu(t, e, n, r, i, s) {
|
|
|
19245
19252
|
c.login_id
|
|
19246
19253
|
);
|
|
19247
19254
|
if (!l || l.authParams.username !== r)
|
|
19248
|
-
throw new
|
|
19255
|
+
throw new N(400, {
|
|
19249
19256
|
message: "Code not found or expired"
|
|
19250
19257
|
});
|
|
19251
19258
|
const u = Pn(t.req);
|
|
@@ -19256,7 +19263,7 @@ async function eu(t, e, n, r, i, s) {
|
|
|
19256
19263
|
if (n.redirect_uri && !Uo(n.redirect_uri, e.callbacks, {
|
|
19257
19264
|
allowPathWildcards: !0
|
|
19258
19265
|
}))
|
|
19259
|
-
throw new
|
|
19266
|
+
throw new N(400, {
|
|
19260
19267
|
message: `Invalid redirect URI - ${n.redirect_uri}`
|
|
19261
19268
|
});
|
|
19262
19269
|
let p = await yn({
|
|
@@ -19271,7 +19278,7 @@ async function eu(t, e, n, r, i, s) {
|
|
|
19271
19278
|
e.tenant.id,
|
|
19272
19279
|
r
|
|
19273
19280
|
)).length)
|
|
19274
|
-
throw new
|
|
19281
|
+
throw new N(400, {
|
|
19275
19282
|
message: "User not found"
|
|
19276
19283
|
});
|
|
19277
19284
|
p = await o.data.users.create(e.tenant.id, {
|
|
@@ -19320,7 +19327,7 @@ const _b = new le().openapi(
|
|
|
19320
19327
|
async (t) => {
|
|
19321
19328
|
const e = t.req.valid("json"), { env: n } = t, { client_id: r, email: i, send: s, authParams: o } = e, c = await t.env.data.clients.get(r);
|
|
19322
19329
|
if (!c)
|
|
19323
|
-
throw new
|
|
19330
|
+
throw new N(400, {
|
|
19324
19331
|
message: "Client not found"
|
|
19325
19332
|
});
|
|
19326
19333
|
t.set("client_id", c.id), t.set("tenant_id", c.tenant.id);
|
|
@@ -19390,7 +19397,7 @@ const _b = new le().openapi(
|
|
|
19390
19397
|
);
|
|
19391
19398
|
}
|
|
19392
19399
|
);
|
|
19393
|
-
class Cr extends
|
|
19400
|
+
class Cr extends N {
|
|
19394
19401
|
constructor(n, r) {
|
|
19395
19402
|
super(n, r);
|
|
19396
19403
|
te(this, "_code");
|
|
@@ -19403,7 +19410,7 @@ class Cr extends $ {
|
|
|
19403
19410
|
async function tu(t, e, n, r, i) {
|
|
19404
19411
|
const { env: s } = t, o = n.username;
|
|
19405
19412
|
if (t.set("username", o), !o)
|
|
19406
|
-
throw new
|
|
19413
|
+
throw new N(400, { message: "Username is required" });
|
|
19407
19414
|
const c = await Gn({
|
|
19408
19415
|
userAdapter: t.env.data.users,
|
|
19409
19416
|
tenant_id: e.tenant.id,
|
|
@@ -19584,7 +19591,7 @@ const vb = new le().openapi(
|
|
|
19584
19591
|
t.set("username", r);
|
|
19585
19592
|
const i = await t.env.data.clients.get(n);
|
|
19586
19593
|
if (!i)
|
|
19587
|
-
throw new
|
|
19594
|
+
throw new N(400, {
|
|
19588
19595
|
message: "Client not found"
|
|
19589
19596
|
});
|
|
19590
19597
|
t.set("client_id", n), t.set("tenant_id", i.tenant.id);
|
|
@@ -19624,7 +19631,7 @@ const vb = new le().openapi(
|
|
|
19624
19631
|
!0
|
|
19625
19632
|
);
|
|
19626
19633
|
} else
|
|
19627
|
-
throw new
|
|
19634
|
+
throw new N(400, { message: "Code or password required" });
|
|
19628
19635
|
}
|
|
19629
19636
|
);
|
|
19630
19637
|
function wb(t, e) {
|
|
@@ -19695,7 +19702,7 @@ function kb(t) {
|
|
|
19695
19702
|
return "auth2";
|
|
19696
19703
|
if (t === "email")
|
|
19697
19704
|
return "email";
|
|
19698
|
-
throw new
|
|
19705
|
+
throw new N(403, { message: "Invalid realm" });
|
|
19699
19706
|
}
|
|
19700
19707
|
async function xb(t, e, n, r, i) {
|
|
19701
19708
|
var m;
|
|
@@ -19703,13 +19710,13 @@ async function xb(t, e, n, r, i) {
|
|
|
19703
19710
|
t.set("connection", i);
|
|
19704
19711
|
const o = await s.data.codes.get(e, n, "ticket");
|
|
19705
19712
|
if (!o || o.used_at)
|
|
19706
|
-
throw new
|
|
19713
|
+
throw new N(403, { message: "Ticket not found" });
|
|
19707
19714
|
const c = await s.data.logins.get(e, o.login_id);
|
|
19708
19715
|
if (!c || !c.authParams.username)
|
|
19709
|
-
throw new
|
|
19716
|
+
throw new N(403, { message: "Session not found" });
|
|
19710
19717
|
const l = await s.data.clients.get(c.authParams.client_id);
|
|
19711
19718
|
if (!l)
|
|
19712
|
-
throw new
|
|
19719
|
+
throw new N(403, { message: "Client not found" });
|
|
19713
19720
|
t.set("client_id", c.authParams.client_id), await s.data.codes.used(e, n);
|
|
19714
19721
|
const u = kb(i);
|
|
19715
19722
|
let p = await yn({
|
|
@@ -19834,11 +19841,11 @@ async function Sb({
|
|
|
19834
19841
|
Date.now() + Po * 1e3
|
|
19835
19842
|
).toISOString()
|
|
19836
19843
|
});
|
|
19837
|
-
const
|
|
19844
|
+
const $ = xe(t, {
|
|
19838
19845
|
type: ve.SUCCESS_SILENT_AUTH,
|
|
19839
19846
|
description: "Successful silent authentication"
|
|
19840
19847
|
});
|
|
19841
|
-
return await t.env.data.logs.create(e.tenant.id,
|
|
19848
|
+
return await t.env.data.logs.create(e.tenant.id, $), t.html(
|
|
19842
19849
|
$p(
|
|
19843
19850
|
`${m.protocol}//${m.host}`,
|
|
19844
19851
|
JSON.stringify(S)
|
|
@@ -19919,7 +19926,7 @@ const Ab = new le().openapi(
|
|
|
19919
19926
|
login_ticket: _,
|
|
19920
19927
|
realm: w,
|
|
19921
19928
|
auth0Client: S,
|
|
19922
|
-
login_hint:
|
|
19929
|
+
login_hint: $,
|
|
19923
19930
|
ui_locales: T
|
|
19924
19931
|
} = t.req.valid("query");
|
|
19925
19932
|
t.set("log", "authorize");
|
|
@@ -19938,17 +19945,17 @@ const Ab = new le().openapi(
|
|
|
19938
19945
|
response_mode: h,
|
|
19939
19946
|
code_challenge: m,
|
|
19940
19947
|
code_challenge_method: v,
|
|
19941
|
-
username:
|
|
19948
|
+
username: $,
|
|
19942
19949
|
ui_locales: T
|
|
19943
19950
|
}, ge = t.req.header("origin");
|
|
19944
19951
|
if (ge && !wb(ge, L.web_origins || []))
|
|
19945
|
-
throw new
|
|
19952
|
+
throw new N(403, {
|
|
19946
19953
|
message: `Origin ${ge} not allowed`
|
|
19947
19954
|
});
|
|
19948
19955
|
if (ne.redirect_uri && !Uo(ne.redirect_uri, L.callbacks || [], {
|
|
19949
19956
|
allowPathWildcards: !0
|
|
19950
19957
|
}))
|
|
19951
|
-
throw new
|
|
19958
|
+
throw new N(400, {
|
|
19952
19959
|
message: `Invalid redirect URI - ${ne.redirect_uri}`
|
|
19953
19960
|
});
|
|
19954
19961
|
const de = Vs(
|
|
@@ -19957,7 +19964,7 @@ const Ab = new le().openapi(
|
|
|
19957
19964
|
), ze = de ? await e.data.sessions.get(L.tenant.id, de) : void 0;
|
|
19958
19965
|
if (f == "none") {
|
|
19959
19966
|
if (!p)
|
|
19960
|
-
throw new
|
|
19967
|
+
throw new N(400, {
|
|
19961
19968
|
message: "Missing response_type"
|
|
19962
19969
|
});
|
|
19963
19970
|
return Sb({
|
|
@@ -19987,7 +19994,7 @@ const Ab = new le().openapi(
|
|
|
19987
19994
|
authParams: ne,
|
|
19988
19995
|
session: ze || void 0,
|
|
19989
19996
|
connection: u,
|
|
19990
|
-
login_hint:
|
|
19997
|
+
login_hint: $
|
|
19991
19998
|
});
|
|
19992
19999
|
}
|
|
19993
20000
|
);
|
|
@@ -20000,7 +20007,12 @@ function Eb() {
|
|
|
20000
20007
|
info: {
|
|
20001
20008
|
version: "1.0.0",
|
|
20002
20009
|
title: "Oauth API"
|
|
20003
|
-
}
|
|
20010
|
+
},
|
|
20011
|
+
security: [
|
|
20012
|
+
{
|
|
20013
|
+
oauth2: ["openid", "email", "profile"]
|
|
20014
|
+
}
|
|
20015
|
+
]
|
|
20004
20016
|
}), eg(e), e;
|
|
20005
20017
|
}
|
|
20006
20018
|
var Ib = {
|
|
@@ -20461,13 +20473,13 @@ async function We(t, e) {
|
|
|
20461
20473
|
var l;
|
|
20462
20474
|
const { env: n } = t, r = await n.data.logins.get(t.var.tenant_id || "", e);
|
|
20463
20475
|
if (!r)
|
|
20464
|
-
throw new
|
|
20476
|
+
throw new N(400, { message: "Session not found" });
|
|
20465
20477
|
t.set("login", r);
|
|
20466
20478
|
const i = await Lo(n, r.authParams.client_id);
|
|
20467
20479
|
t.set("client_id", i.id), t.set("tenant_id", i.tenant.id);
|
|
20468
20480
|
const s = await n.data.tenants.get(i.tenant.id);
|
|
20469
20481
|
if (!s)
|
|
20470
|
-
throw new
|
|
20482
|
+
throw new N(400, { message: "Tenant not found" });
|
|
20471
20483
|
const o = await Pg(
|
|
20472
20484
|
n,
|
|
20473
20485
|
i.id,
|
|
@@ -21322,7 +21334,7 @@ var si = "_hp", c1 = {
|
|
|
21322
21334
|
let w;
|
|
21323
21335
|
if (h && h.length) {
|
|
21324
21336
|
const S = h.findIndex(
|
|
21325
|
-
Bt(_) ? (
|
|
21337
|
+
Bt(_) ? ($) => Bt($) : _.key !== void 0 ? ($) => $.key === _.key && $.tag === _.tag : ($) => $.tag === _.tag
|
|
21326
21338
|
);
|
|
21327
21339
|
S !== -1 && (w = h[S], h.splice(S, 1));
|
|
21328
21340
|
}
|
|
@@ -21355,11 +21367,11 @@ var si = "_hp", c1 = {
|
|
|
21355
21367
|
const _ = () => Yi([0, !1, t[2]], f), w = Zi.get(f) || [];
|
|
21356
21368
|
w.push(_), Zi.set(f, w);
|
|
21357
21369
|
const S = v(h, () => {
|
|
21358
|
-
const
|
|
21359
|
-
if (
|
|
21360
|
-
const T =
|
|
21370
|
+
const $ = Zi.get(f);
|
|
21371
|
+
if ($) {
|
|
21372
|
+
const T = $.indexOf(_);
|
|
21361
21373
|
if (T !== -1)
|
|
21362
|
-
return
|
|
21374
|
+
return $.splice(T, 1), _();
|
|
21363
21375
|
}
|
|
21364
21376
|
});
|
|
21365
21377
|
if (S) {
|
|
@@ -21540,9 +21552,9 @@ var si = "_hp", c1 = {
|
|
|
21540
21552
|
const v = Wi[t];
|
|
21541
21553
|
let f;
|
|
21542
21554
|
if (v.length > 0) {
|
|
21543
|
-
const
|
|
21555
|
+
const $ = s.querySelectorAll(t);
|
|
21544
21556
|
e:
|
|
21545
|
-
for (const T of
|
|
21557
|
+
for (const T of $)
|
|
21546
21558
|
for (const L of Wi[t])
|
|
21547
21559
|
if (T.getAttribute(L) === e[L]) {
|
|
21548
21560
|
h = T;
|
|
@@ -21564,48 +21576,48 @@ var si = "_hp", c1 = {
|
|
|
21564
21576
|
f = s.querySelectorAll(t);
|
|
21565
21577
|
l = r ? l ?? "" : void 0, r && (p[Gi] = l);
|
|
21566
21578
|
const _ = ou(
|
|
21567
|
-
(
|
|
21579
|
+
($) => {
|
|
21568
21580
|
if (v.length > 0) {
|
|
21569
21581
|
let T = !1;
|
|
21570
21582
|
for (const L of s.querySelectorAll(t)) {
|
|
21571
21583
|
if (T && L.getAttribute(Gi) !== l) {
|
|
21572
|
-
s.insertBefore(
|
|
21584
|
+
s.insertBefore($, L);
|
|
21573
21585
|
return;
|
|
21574
21586
|
}
|
|
21575
21587
|
L.getAttribute(Gi) === l && (T = !0);
|
|
21576
21588
|
}
|
|
21577
|
-
s.appendChild(
|
|
21589
|
+
s.appendChild($);
|
|
21578
21590
|
} else if (f) {
|
|
21579
21591
|
let T = !1;
|
|
21580
21592
|
for (const L of f)
|
|
21581
|
-
if (L ===
|
|
21593
|
+
if (L === $) {
|
|
21582
21594
|
T = !0;
|
|
21583
21595
|
break;
|
|
21584
21596
|
}
|
|
21585
21597
|
T || s.insertBefore(
|
|
21586
|
-
|
|
21598
|
+
$,
|
|
21587
21599
|
s.contains(f[0]) ? f[0] : s.querySelector(t)
|
|
21588
21600
|
), f = void 0;
|
|
21589
21601
|
}
|
|
21590
21602
|
},
|
|
21591
21603
|
[l]
|
|
21592
|
-
), w = au(e.ref, (
|
|
21604
|
+
), w = au(e.ref, ($) => {
|
|
21593
21605
|
var ne;
|
|
21594
21606
|
const T = v[0];
|
|
21595
|
-
if (n === 2 && (
|
|
21607
|
+
if (n === 2 && ($.innerHTML = ""), (m || f) && _($), !c && !o)
|
|
21596
21608
|
return;
|
|
21597
|
-
let L = zn[ne =
|
|
21609
|
+
let L = zn[ne = $.getAttribute(T)] || (zn[ne] = new Promise(
|
|
21598
21610
|
(ge, de) => {
|
|
21599
|
-
|
|
21611
|
+
$.addEventListener("load", ge), $.addEventListener("error", de);
|
|
21600
21612
|
}
|
|
21601
21613
|
));
|
|
21602
21614
|
o && (L = L.then(o)), c && (L = L.catch(c)), L.catch(() => {
|
|
21603
21615
|
});
|
|
21604
21616
|
});
|
|
21605
21617
|
if (i && u === "render") {
|
|
21606
|
-
const
|
|
21607
|
-
if (e[
|
|
21608
|
-
const T = e[
|
|
21618
|
+
const $ = Wi[t][0];
|
|
21619
|
+
if (e[$]) {
|
|
21620
|
+
const T = e[$], L = zn[T] || (zn[T] = new Promise((ne, ge) => {
|
|
21609
21621
|
_(h), h.addEventListener("load", ne), h.addEventListener("error", ge);
|
|
21610
21622
|
}));
|
|
21611
21623
|
y1(L);
|
|
@@ -21835,7 +21847,7 @@ const Hg = (t) => {
|
|
|
21835
21847
|
e
|
|
21836
21848
|
);
|
|
21837
21849
|
if (!r.authParams.username)
|
|
21838
|
-
throw new
|
|
21850
|
+
throw new N(400, {
|
|
21839
21851
|
message: "Username not found in state"
|
|
21840
21852
|
});
|
|
21841
21853
|
const s = await yn({
|
|
@@ -21890,7 +21902,7 @@ const Hg = (t) => {
|
|
|
21890
21902
|
e
|
|
21891
21903
|
);
|
|
21892
21904
|
if (t.set("client_id", i.id), !r.authParams.username)
|
|
21893
|
-
throw new
|
|
21905
|
+
throw new N(400, {
|
|
21894
21906
|
message: "Username not found in state"
|
|
21895
21907
|
});
|
|
21896
21908
|
try {
|
|
@@ -22032,7 +22044,7 @@ const Hg = (t) => {
|
|
|
22032
22044
|
e
|
|
22033
22045
|
);
|
|
22034
22046
|
if (!i.authParams.username)
|
|
22035
|
-
throw new
|
|
22047
|
+
throw new N(400, { message: "Username required" });
|
|
22036
22048
|
return t.html(
|
|
22037
22049
|
/* @__PURE__ */ y(
|
|
22038
22050
|
ga,
|
|
@@ -22078,7 +22090,7 @@ const Hg = (t) => {
|
|
|
22078
22090
|
e
|
|
22079
22091
|
), { username: c } = o.authParams;
|
|
22080
22092
|
if (!c)
|
|
22081
|
-
throw new
|
|
22093
|
+
throw new N(400, { message: "Username required" });
|
|
22082
22094
|
try {
|
|
22083
22095
|
return await tu(
|
|
22084
22096
|
t,
|
|
@@ -22209,7 +22221,7 @@ const Hg = (t) => {
|
|
|
22209
22221
|
async (t) => {
|
|
22210
22222
|
const { state: e, code: n } = t.req.valid("query"), { vendorSettings: r, session: i } = await We(t, e), { username: s } = i.authParams;
|
|
22211
22223
|
if (!s)
|
|
22212
|
-
throw new
|
|
22224
|
+
throw new N(400, { message: "Username required" });
|
|
22213
22225
|
return n ? t.html(
|
|
22214
22226
|
/* @__PURE__ */ y(
|
|
22215
22227
|
Nr,
|
|
@@ -22269,7 +22281,7 @@ const Hg = (t) => {
|
|
|
22269
22281
|
t.set("client_id", s.id), t.set("connection", c);
|
|
22270
22282
|
const l = o.authParams.username;
|
|
22271
22283
|
if (!l)
|
|
22272
|
-
throw new
|
|
22284
|
+
throw new N(400, { message: "Username required" });
|
|
22273
22285
|
if (n.password !== n["re-enter-password"])
|
|
22274
22286
|
return t.html(
|
|
22275
22287
|
/* @__PURE__ */ y(
|
|
@@ -22313,7 +22325,7 @@ const Hg = (t) => {
|
|
|
22313
22325
|
email: l,
|
|
22314
22326
|
provider: "auth2"
|
|
22315
22327
|
}))
|
|
22316
|
-
throw new
|
|
22328
|
+
throw new N(400, { message: "Invalid sign up" });
|
|
22317
22329
|
const m = (p == null ? void 0 : p.authParams.username) === l, v = await t.env.data.users.create(s.tenant.id, {
|
|
22318
22330
|
user_id: `auth2|${ci()}`,
|
|
22319
22331
|
email: l,
|
|
@@ -22328,7 +22340,7 @@ const Hg = (t) => {
|
|
|
22328
22340
|
provider: "auth2"
|
|
22329
22341
|
});
|
|
22330
22342
|
if (!f)
|
|
22331
|
-
throw new
|
|
22343
|
+
throw new N(400, { message: "Invalid sign up" });
|
|
22332
22344
|
return await r.data.passwords.create(s.tenant.id, {
|
|
22333
22345
|
user_id: f.user_id,
|
|
22334
22346
|
password: await ai.hash(n.password, 10),
|
|
@@ -22431,7 +22443,7 @@ const Hg = (t) => {
|
|
|
22431
22443
|
async (t) => {
|
|
22432
22444
|
const { state: e } = t.req.valid("query"), { vendorSettings: n, session: r } = await We(t, e);
|
|
22433
22445
|
if (!r.authParams.username)
|
|
22434
|
-
throw new
|
|
22446
|
+
throw new N(400, { message: "Username required" });
|
|
22435
22447
|
return t.html(
|
|
22436
22448
|
/* @__PURE__ */ y(
|
|
22437
22449
|
$r,
|
|
@@ -22479,7 +22491,7 @@ const Hg = (t) => {
|
|
|
22479
22491
|
e
|
|
22480
22492
|
);
|
|
22481
22493
|
if (!l.authParams.username)
|
|
22482
|
-
throw new
|
|
22494
|
+
throw new N(400, { message: "Username required" });
|
|
22483
22495
|
if (r !== i)
|
|
22484
22496
|
return t.html(
|
|
22485
22497
|
/* @__PURE__ */ y(
|
|
@@ -22511,7 +22523,7 @@ const Hg = (t) => {
|
|
|
22511
22523
|
provider: "auth2"
|
|
22512
22524
|
});
|
|
22513
22525
|
if (!u)
|
|
22514
|
-
throw new
|
|
22526
|
+
throw new N(400, { message: "User not found" });
|
|
22515
22527
|
try {
|
|
22516
22528
|
if (!await s.data.codes.get(
|
|
22517
22529
|
c.tenant.id,
|