zudoku 0.3.0-dev.30 → 0.3.0-dev.32
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/app/App.d.ts +1 -0
- package/dist/app/App.js +2 -0
- package/dist/app/App.js.map +1 -0
- package/dist/app/demo.js +15 -11
- package/dist/app/demo.js.map +1 -1
- package/dist/app/entry.client.d.ts +5 -0
- package/dist/app/entry.client.js +28 -0
- package/dist/app/entry.client.js.map +1 -0
- package/dist/app/entry.server.d.ts +10 -0
- package/dist/app/entry.server.js +107 -0
- package/dist/app/entry.server.js.map +1 -0
- package/dist/app/main.d.ts +26 -2
- package/dist/app/main.js +39 -15
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.js +14 -10
- package/dist/app/standalone.js.map +1 -1
- package/dist/app/tailwind.d.ts +1 -1
- package/dist/app/tailwind.js +0 -4
- package/dist/app/tailwind.js.map +1 -1
- package/dist/app/zudoku-manifest.d.ts +1 -0
- package/dist/app/zudoku-manifest.js +20 -0
- package/dist/app/zudoku-manifest.js.map +1 -0
- package/dist/cli/cmds/dev.js +5 -0
- package/dist/cli/cmds/dev.js.map +1 -1
- package/dist/cli/dev/handler.d.ts +1 -0
- package/dist/cli/dev/handler.js +3 -1
- package/dist/cli/dev/handler.js.map +1 -1
- package/dist/config/config.d.ts +5 -0
- package/dist/lib/authentication/providers/clerk.js +2 -0
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/components/DevPortal.d.ts +5 -2
- package/dist/lib/components/DevPortal.js +11 -10
- package/dist/lib/components/DevPortal.js.map +1 -1
- package/dist/lib/components/ErrorPage.d.ts +6 -0
- package/dist/lib/components/ErrorPage.js +9 -0
- package/dist/lib/components/ErrorPage.js.map +1 -0
- package/dist/lib/components/InlineCode.d.ts +5 -0
- package/dist/lib/components/InlineCode.js +4 -0
- package/dist/lib/components/InlineCode.js.map +1 -0
- package/dist/lib/components/Layout.js +2 -1
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/NotFoundPage.d.ts +1 -0
- package/dist/lib/components/NotFoundPage.js +12 -0
- package/dist/lib/components/NotFoundPage.js.map +1 -0
- package/dist/lib/components/SyntaxHighlight.d.ts +3 -2
- package/dist/lib/components/SyntaxHighlight.js +20 -22
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/index.d.ts +4 -1
- package/dist/lib/errors/ErrorAlert.d.ts +3 -0
- package/dist/lib/errors/ErrorAlert.js +8 -0
- package/dist/lib/errors/ErrorAlert.js.map +1 -0
- package/dist/lib/errors/RouterError.d.ts +1 -0
- package/dist/lib/errors/RouterError.js +12 -0
- package/dist/lib/errors/RouterError.js.map +1 -0
- package/dist/lib/errors/ServerError.d.ts +3 -0
- package/dist/lib/errors/ServerError.js +6 -0
- package/dist/lib/errors/ServerError.js.map +1 -0
- package/dist/lib/errors/TopLevelError.d.ts +2 -0
- package/dist/lib/errors/TopLevelError.js +7 -0
- package/dist/lib/errors/TopLevelError.js.map +1 -0
- package/dist/lib/oas/parser/index.d.ts +1 -1
- package/dist/lib/oas/parser/index.js +38 -14
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/index.js +3 -8
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
- package/dist/lib/plugins/markdown/index.js +3 -7
- package/dist/lib/plugins/markdown/index.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +11 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +2 -1
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaListView.js +2 -1
- package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -1
- package/dist/lib/plugins/openapi/client/createMemoryClient.js +1 -1
- package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js +9 -1
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/redirect/index.js +2 -3
- package/dist/lib/plugins/redirect/index.js.map +1 -1
- package/dist/lib/ui/Callout.js +1 -1
- package/dist/lib/ui/Callout.js.map +1 -1
- package/dist/lib/ui/button-variants.d.ts +1 -1
- package/dist/lib/util/MdxComponents.js +2 -2
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/dist/lib/util/groupBy.d.ts +1 -6
- package/dist/lib/util/groupBy.js +10 -8
- package/dist/lib/util/groupBy.js.map +1 -1
- package/dist/vite/build.js +23 -10
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.d.ts +2 -2
- package/dist/vite/config.js +36 -8
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/dev-server.d.ts +1 -1
- package/dist/vite/dev-server.js +15 -9
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/html.js +5 -4
- package/dist/vite/html.js.map +1 -1
- package/dist/vite/plugin-custom-css.d.ts +6 -0
- package/dist/vite/plugin-custom-css.js +55 -0
- package/dist/vite/plugin-custom-css.js.map +1 -0
- package/dist/vite/plugin-docs.js +14 -5
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-openapi-worker.js +4 -1
- package/dist/vite/plugin-openapi-worker.js.map +1 -1
- package/dist/vite/plugin.js +2 -0
- package/dist/vite/plugin.js.map +1 -1
- package/dist/vite/prerender.d.ts +1 -0
- package/dist/vite/prerender.js +57 -0
- package/dist/vite/prerender.js.map +1 -0
- package/lib/{DevPortalProvider--xZTs0RJ.js → DevPortalProvider-BlxLX6GG.js} +230 -250
- package/lib/DevPortalProvider-BlxLX6GG.js.map +1 -0
- package/lib/{Markdown-oJFqm0uk.js → Markdown-CL8KPvJN.js} +8 -9
- package/lib/{Markdown-oJFqm0uk.js.map → Markdown-CL8KPvJN.js.map} +1 -1
- package/lib/MdxComponents-Ev_hBHb2.js +5885 -0
- package/lib/MdxComponents-Ev_hBHb2.js.map +1 -0
- package/lib/{MdxPage-BV_9ncEk.js → MdxPage-Z3HKNTrj.js} +92 -89
- package/lib/MdxPage-Z3HKNTrj.js.map +1 -0
- package/lib/{OperationList-DfG_E0Xa.js → OperationList-KoITgfDT.js} +1967 -1785
- package/lib/OperationList-KoITgfDT.js.map +1 -0
- package/lib/Route-Bf1_D_vC.js +13 -0
- package/lib/{Route-CHqr53jb.js.map → Route-Bf1_D_vC.js.map} +1 -1
- package/lib/Select-DSa3bN4t.js +4770 -0
- package/lib/Select-DSa3bN4t.js.map +1 -0
- package/lib/assets/{worker-BXS8hiSM.js → worker-BjPv-hjP.js} +3100 -2720
- package/lib/assets/worker-BjPv-hjP.js.map +1 -0
- package/lib/hook-CTmJ6CWq.js +35 -0
- package/lib/hook-CTmJ6CWq.js.map +1 -0
- package/lib/index-BdWBDosx.js +74 -0
- package/lib/index-BdWBDosx.js.map +1 -0
- package/lib/{index-B2qLeglF.js → index-BoWzKb_9.js} +57 -41
- package/lib/index-BoWzKb_9.js.map +1 -0
- package/lib/{AnchorLink-BtVKbEwm.js → index.esm-CPEExBJE.js} +156 -168
- package/lib/index.esm-CPEExBJE.js.map +1 -0
- package/lib/jsx-runtime-CM0TzjGp.js +866 -0
- package/lib/jsx-runtime-CM0TzjGp.js.map +1 -0
- package/lib/mutation-91kw0lHb.js +208 -0
- package/lib/mutation-91kw0lHb.js.map +1 -0
- package/lib/router-CcYTwKjf.js +183 -0
- package/lib/router-CcYTwKjf.js.map +1 -0
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-openid.js +588 -441
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +330 -543
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +18 -18
- package/lib/zudoku.plugin-api-keys.js +143 -98
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +2 -49
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +5 -3
- package/lib/zudoku.plugin-openapi.js.map +1 -1
- package/lib/zudoku.plugin-redirect.js +6 -7
- package/lib/zudoku.plugin-redirect.js.map +1 -1
- package/package.json +3 -1
- package/src/app/App.tsx +0 -0
- package/src/app/demo.tsx +18 -13
- package/src/app/entry.client.tsx +51 -0
- package/src/app/entry.server.tsx +158 -0
- package/src/app/main.tsx +65 -41
- package/src/app/standalone.tsx +15 -11
- package/src/app/tailwind.ts +2 -6
- package/src/app/zudoku-manifest.ts +22 -0
- package/src/lib/authentication/providers/clerk.tsx +1 -0
- package/src/lib/components/DevPortal.tsx +34 -33
- package/src/lib/components/ErrorPage.tsx +28 -0
- package/src/lib/components/InlineCode.tsx +19 -0
- package/src/lib/components/Layout.tsx +7 -4
- package/src/lib/components/NotFoundPage.tsx +39 -0
- package/src/lib/components/SyntaxHighlight.tsx +26 -22
- package/src/lib/errors/ErrorAlert.tsx +21 -0
- package/src/lib/errors/RouterError.tsx +13 -0
- package/src/lib/errors/ServerError.tsx +5 -0
- package/src/lib/errors/TopLevelError.tsx +8 -0
- package/src/lib/oas/parser/index.ts +41 -22
- package/src/lib/plugins/api-keys/index.tsx +4 -16
- package/src/lib/plugins/markdown/generateRoutes.tsx +1 -1
- package/src/lib/plugins/markdown/index.tsx +3 -7
- package/src/lib/plugins/openapi/OperationList.tsx +30 -0
- package/src/lib/plugins/openapi/OperationListItem.tsx +3 -1
- package/src/lib/plugins/openapi/SchemaListView.tsx +8 -10
- package/src/lib/plugins/openapi/client/createMemoryClient.ts +1 -1
- package/src/lib/plugins/openapi/index.tsx +18 -1
- package/src/lib/plugins/redirect/index.tsx +2 -2
- package/src/lib/ui/Callout.tsx +2 -2
- package/src/lib/util/MdxComponents.tsx +2 -11
- package/src/lib/util/groupBy.ts +7 -12
- package/dist/lib/components/Error.d.ts +0 -1
- package/dist/lib/components/Error.js +0 -10
- package/dist/lib/components/Error.js.map +0 -1
- package/dist/lib/components/Router.d.ts +0 -4
- package/dist/lib/components/Router.js +0 -21
- package/dist/lib/components/Router.js.map +0 -1
- package/lib/AnchorLink-BtVKbEwm.js.map +0 -1
- package/lib/DevPortalProvider--xZTs0RJ.js.map +0 -1
- package/lib/MdxComponents-CsU8yR42.js +0 -3019
- package/lib/MdxComponents-CsU8yR42.js.map +0 -1
- package/lib/MdxPage-BV_9ncEk.js.map +0 -1
- package/lib/OperationList-DfG_E0Xa.js.map +0 -1
- package/lib/Route-CHqr53jb.js +0 -14
- package/lib/Select-CNmXi4JU.js +0 -4572
- package/lib/Select-CNmXi4JU.js.map +0 -1
- package/lib/Spinner-By5opWs5.js +0 -182
- package/lib/Spinner-By5opWs5.js.map +0 -1
- package/lib/assets/worker-BXS8hiSM.js.map +0 -1
- package/lib/cn-DpqTslo9.js +0 -2342
- package/lib/cn-DpqTslo9.js.map +0 -1
- package/lib/hook-kVJ4gpk5.js +0 -25
- package/lib/hook-kVJ4gpk5.js.map +0 -1
- package/lib/index-B2qLeglF.js.map +0 -1
- package/lib/index-CUIxJAeE.js +0 -713
- package/lib/index-CUIxJAeE.js.map +0 -1
- package/lib/index-Cr3hgaqt.js +0 -412
- package/lib/index-Cr3hgaqt.js.map +0 -1
- package/lib/index-fXFJf9Ua.js +0 -464
- package/lib/index-fXFJf9Ua.js.map +0 -1
- package/lib/jsx-runtime-D7DwziLW.js +0 -3009
- package/lib/jsx-runtime-D7DwziLW.js.map +0 -1
- package/lib/loglevel-CA34MiFn.js +0 -153
- package/lib/loglevel-CA34MiFn.js.map +0 -1
- package/lib/util-DnDPBx_j.js +0 -41
- package/lib/util-DnDPBx_j.js.map +0 -1
- package/src/lib/components/Error.tsx +0 -15
- package/src/lib/components/Router.tsx +0 -23
|
@@ -1,15 +1,162 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { j as
|
|
5
|
-
import {
|
|
6
|
-
import { useRef as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
var Re = Object.defineProperty;
|
|
2
|
+
var xe = (e, t, n) => t in e ? Re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var S = (e, t, n) => xe(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { u as Pe, j as T } from "./jsx-runtime-CM0TzjGp.js";
|
|
5
|
+
import { c as Le, g as Ue } from "./_commonjsHelpers-BkfeUUK-.js";
|
|
6
|
+
import { useRef as Ce, useState as je, useEffect as ze } from "react";
|
|
7
|
+
import { u as re } from "./state-Ds_OxRHP.js";
|
|
8
|
+
var he = { exports: {} };
|
|
9
|
+
(function(e) {
|
|
10
|
+
(function(t, n) {
|
|
11
|
+
e.exports ? e.exports = n() : t.log = n();
|
|
12
|
+
})(Le, function() {
|
|
13
|
+
var t = function() {
|
|
14
|
+
}, n = "undefined", o = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [
|
|
15
|
+
"trace",
|
|
16
|
+
"debug",
|
|
17
|
+
"info",
|
|
18
|
+
"warn",
|
|
19
|
+
"error"
|
|
20
|
+
], r = {}, i = null;
|
|
21
|
+
function d(u, f) {
|
|
22
|
+
var c = u[f];
|
|
23
|
+
if (typeof c.bind == "function")
|
|
24
|
+
return c.bind(u);
|
|
25
|
+
try {
|
|
26
|
+
return Function.prototype.bind.call(c, u);
|
|
27
|
+
} catch {
|
|
28
|
+
return function() {
|
|
29
|
+
return Function.prototype.apply.apply(c, [u, arguments]);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function g() {
|
|
34
|
+
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
35
|
+
}
|
|
36
|
+
function m(u) {
|
|
37
|
+
return u === "debug" && (u = "log"), typeof console === n ? !1 : u === "trace" && o ? g : console[u] !== void 0 ? d(console, u) : console.log !== void 0 ? d(console, "log") : t;
|
|
38
|
+
}
|
|
39
|
+
function _() {
|
|
40
|
+
for (var u = this.getLevel(), f = 0; f < s.length; f++) {
|
|
41
|
+
var c = s[f];
|
|
42
|
+
this[c] = f < u ? t : this.methodFactory(c, u, this.name);
|
|
43
|
+
}
|
|
44
|
+
if (this.log = this.debug, typeof console === n && u < this.levels.SILENT)
|
|
45
|
+
return "No console available for logging";
|
|
46
|
+
}
|
|
47
|
+
function y(u) {
|
|
48
|
+
return function() {
|
|
49
|
+
typeof console !== n && (_.call(this), this[u].apply(this, arguments));
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function h(u, f, c) {
|
|
53
|
+
return m(u) || y.apply(this, arguments);
|
|
54
|
+
}
|
|
55
|
+
function L(u, f) {
|
|
56
|
+
var c = this, J, $, x, b = "loglevel";
|
|
57
|
+
typeof u == "string" ? b += ":" + u : typeof u == "symbol" && (b = void 0);
|
|
58
|
+
function ke(l) {
|
|
59
|
+
var p = (s[l] || "silent").toUpperCase();
|
|
60
|
+
if (!(typeof window === n || !b)) {
|
|
61
|
+
try {
|
|
62
|
+
window.localStorage[b] = p;
|
|
63
|
+
return;
|
|
64
|
+
} catch {
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
window.document.cookie = encodeURIComponent(b) + "=" + p + ";";
|
|
68
|
+
} catch {
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function ee() {
|
|
73
|
+
var l;
|
|
74
|
+
if (!(typeof window === n || !b)) {
|
|
75
|
+
try {
|
|
76
|
+
l = window.localStorage[b];
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
if (typeof l === n)
|
|
80
|
+
try {
|
|
81
|
+
var p = window.document.cookie, O = encodeURIComponent(b), ne = p.indexOf(O + "=");
|
|
82
|
+
ne !== -1 && (l = /^([^;]+)/.exec(
|
|
83
|
+
p.slice(ne + O.length + 1)
|
|
84
|
+
)[1]);
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
return c.levels[l] === void 0 && (l = void 0), l;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function Te() {
|
|
91
|
+
if (!(typeof window === n || !b)) {
|
|
92
|
+
try {
|
|
93
|
+
window.localStorage.removeItem(b);
|
|
94
|
+
} catch {
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
window.document.cookie = encodeURIComponent(b) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
98
|
+
} catch {
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function U(l) {
|
|
103
|
+
var p = l;
|
|
104
|
+
if (typeof p == "string" && c.levels[p.toUpperCase()] !== void 0 && (p = c.levels[p.toUpperCase()]), typeof p == "number" && p >= 0 && p <= c.levels.SILENT)
|
|
105
|
+
return p;
|
|
106
|
+
throw new TypeError("log.setLevel() called with invalid level: " + l);
|
|
107
|
+
}
|
|
108
|
+
c.name = u, c.levels = {
|
|
109
|
+
TRACE: 0,
|
|
110
|
+
DEBUG: 1,
|
|
111
|
+
INFO: 2,
|
|
112
|
+
WARN: 3,
|
|
113
|
+
ERROR: 4,
|
|
114
|
+
SILENT: 5
|
|
115
|
+
}, c.methodFactory = f || h, c.getLevel = function() {
|
|
116
|
+
return x ?? $ ?? J;
|
|
117
|
+
}, c.setLevel = function(l, p) {
|
|
118
|
+
return x = U(l), p !== !1 && ke(x), _.call(c);
|
|
119
|
+
}, c.setDefaultLevel = function(l) {
|
|
120
|
+
$ = U(l), ee() || c.setLevel(l, !1);
|
|
121
|
+
}, c.resetLevel = function() {
|
|
122
|
+
x = null, Te(), _.call(c);
|
|
123
|
+
}, c.enableAll = function(l) {
|
|
124
|
+
c.setLevel(c.levels.TRACE, l);
|
|
125
|
+
}, c.disableAll = function(l) {
|
|
126
|
+
c.setLevel(c.levels.SILENT, l);
|
|
127
|
+
}, c.rebuild = function() {
|
|
128
|
+
if (i !== c && (J = U(i.getLevel())), _.call(c), i === c)
|
|
129
|
+
for (var l in r)
|
|
130
|
+
r[l].rebuild();
|
|
131
|
+
}, J = U(
|
|
132
|
+
i ? i.getLevel() : "WARN"
|
|
133
|
+
);
|
|
134
|
+
var te = ee();
|
|
135
|
+
te != null && (x = U(te)), _.call(c);
|
|
136
|
+
}
|
|
137
|
+
i = new L(), i.getLogger = function(f) {
|
|
138
|
+
if (typeof f != "symbol" && typeof f != "string" || f === "")
|
|
139
|
+
throw new TypeError("You must supply a name when creating a logger.");
|
|
140
|
+
var c = r[f];
|
|
141
|
+
return c || (c = r[f] = new L(
|
|
142
|
+
f,
|
|
143
|
+
i.methodFactory
|
|
144
|
+
)), c;
|
|
145
|
+
};
|
|
146
|
+
var R = typeof window !== n ? window.log : void 0;
|
|
147
|
+
return i.noConflict = function() {
|
|
148
|
+
return typeof window !== n && window.log === i && (window.log = R), i;
|
|
149
|
+
}, i.getLoggers = function() {
|
|
150
|
+
return r;
|
|
151
|
+
}, i.default = i, i;
|
|
152
|
+
});
|
|
153
|
+
})(he);
|
|
154
|
+
var Je = he.exports;
|
|
155
|
+
const oe = /* @__PURE__ */ Ue(Je);
|
|
156
|
+
let M;
|
|
157
|
+
var I, de;
|
|
158
|
+
(typeof navigator > "u" || !((de = (I = navigator.userAgent) == null ? void 0 : I.startsWith) != null && de.call(I, "Mozilla/5.0 "))) && (M = "oauth4webapi/v2.11.1");
|
|
159
|
+
function q(e, t) {
|
|
13
160
|
if (e == null)
|
|
14
161
|
return !1;
|
|
15
162
|
try {
|
|
@@ -18,32 +165,32 @@ function O(e, t) {
|
|
|
18
165
|
return !1;
|
|
19
166
|
}
|
|
20
167
|
}
|
|
21
|
-
const
|
|
22
|
-
function
|
|
23
|
-
return typeof e == "string" ?
|
|
168
|
+
const K = Symbol(), Oe = Symbol(), V = Symbol(), Ie = new TextEncoder(), Ne = new TextDecoder();
|
|
169
|
+
function A(e) {
|
|
170
|
+
return typeof e == "string" ? Ie.encode(e) : Ne.decode(e);
|
|
24
171
|
}
|
|
25
|
-
const
|
|
26
|
-
function
|
|
172
|
+
const ie = 32768;
|
|
173
|
+
function Ke(e) {
|
|
27
174
|
e instanceof ArrayBuffer && (e = new Uint8Array(e));
|
|
28
175
|
const t = [];
|
|
29
|
-
for (let n = 0; n < e.byteLength; n +=
|
|
30
|
-
t.push(String.fromCharCode.apply(null, e.subarray(n, n +
|
|
176
|
+
for (let n = 0; n < e.byteLength; n += ie)
|
|
177
|
+
t.push(String.fromCharCode.apply(null, e.subarray(n, n + ie)));
|
|
31
178
|
return btoa(t.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
32
179
|
}
|
|
33
|
-
function
|
|
180
|
+
function We(e) {
|
|
34
181
|
try {
|
|
35
182
|
const t = atob(e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), n = new Uint8Array(t.length);
|
|
36
|
-
for (let
|
|
37
|
-
n[
|
|
183
|
+
for (let o = 0; o < t.length; o++)
|
|
184
|
+
n[o] = t.charCodeAt(o);
|
|
38
185
|
return n;
|
|
39
186
|
} catch (t) {
|
|
40
|
-
throw new
|
|
187
|
+
throw new a("The input to be decoded is not correctly encoded.", { cause: t });
|
|
41
188
|
}
|
|
42
189
|
}
|
|
43
|
-
function
|
|
44
|
-
return typeof e == "string" ?
|
|
190
|
+
function k(e) {
|
|
191
|
+
return typeof e == "string" ? We(e) : Ke(e);
|
|
45
192
|
}
|
|
46
|
-
class
|
|
193
|
+
class De {
|
|
47
194
|
constructor(t) {
|
|
48
195
|
this.cache = /* @__PURE__ */ new Map(), this._cache = /* @__PURE__ */ new Map(), this.maxSize = t;
|
|
49
196
|
}
|
|
@@ -67,54 +214,54 @@ class be {
|
|
|
67
214
|
this.cache.set(t, n), this.cache.size >= this.maxSize && (this._cache = this.cache, this.cache = /* @__PURE__ */ new Map());
|
|
68
215
|
}
|
|
69
216
|
}
|
|
70
|
-
class
|
|
217
|
+
class v extends Error {
|
|
71
218
|
constructor(t) {
|
|
72
219
|
var n;
|
|
73
220
|
super(t ?? "operation not supported"), this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
|
|
74
221
|
}
|
|
75
222
|
}
|
|
76
|
-
class
|
|
223
|
+
class He extends Error {
|
|
77
224
|
constructor(t, n) {
|
|
78
|
-
var
|
|
79
|
-
super(t, n), this.name = this.constructor.name, (
|
|
225
|
+
var o;
|
|
226
|
+
super(t, n), this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
|
|
80
227
|
}
|
|
81
228
|
}
|
|
82
|
-
const
|
|
83
|
-
function
|
|
229
|
+
const a = He, fe = new De(100);
|
|
230
|
+
function pe(e) {
|
|
84
231
|
return e instanceof CryptoKey;
|
|
85
232
|
}
|
|
86
|
-
function
|
|
87
|
-
return
|
|
233
|
+
function we(e) {
|
|
234
|
+
return pe(e) && e.type === "private";
|
|
88
235
|
}
|
|
89
|
-
function
|
|
90
|
-
return
|
|
236
|
+
function $e(e) {
|
|
237
|
+
return pe(e) && e.type === "public";
|
|
91
238
|
}
|
|
92
|
-
function
|
|
239
|
+
function Y(e) {
|
|
93
240
|
try {
|
|
94
241
|
const t = e.headers.get("dpop-nonce");
|
|
95
|
-
t &&
|
|
242
|
+
t && fe.set(new URL(e.url).origin, t);
|
|
96
243
|
} catch {
|
|
97
244
|
}
|
|
98
245
|
return e;
|
|
99
246
|
}
|
|
100
|
-
function
|
|
247
|
+
function C(e) {
|
|
101
248
|
return !(e === null || typeof e != "object" || Array.isArray(e));
|
|
102
249
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
250
|
+
function W(e) {
|
|
251
|
+
q(e, Headers) && (e = Object.fromEntries(e.entries()));
|
|
105
252
|
const t = new Headers(e);
|
|
106
|
-
if (
|
|
253
|
+
if (M && !t.has("user-agent") && t.set("user-agent", M), t.has("authorization"))
|
|
107
254
|
throw new TypeError('"options.headers" must not include the "authorization" header name');
|
|
108
255
|
if (t.has("dpop"))
|
|
109
256
|
throw new TypeError('"options.headers" must not include the "dpop" header name');
|
|
110
257
|
return t;
|
|
111
258
|
}
|
|
112
|
-
function
|
|
259
|
+
function Z(e) {
|
|
113
260
|
if (typeof e == "function" && (e = e()), !(e instanceof AbortSignal))
|
|
114
261
|
throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
|
|
115
262
|
return e;
|
|
116
263
|
}
|
|
117
|
-
async function
|
|
264
|
+
async function Fe(e, t) {
|
|
118
265
|
if (!(e instanceof URL))
|
|
119
266
|
throw new TypeError('"issuerIdentifier" must be an instance of URL');
|
|
120
267
|
if (e.protocol !== "https:" && e.protocol !== "http:")
|
|
@@ -131,70 +278,70 @@ async function Ee(e, t) {
|
|
|
131
278
|
default:
|
|
132
279
|
throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"');
|
|
133
280
|
}
|
|
134
|
-
const
|
|
135
|
-
return
|
|
136
|
-
headers: Object.fromEntries(
|
|
281
|
+
const o = W(t == null ? void 0 : t.headers);
|
|
282
|
+
return o.set("accept", "application/json"), ((t == null ? void 0 : t[V]) || fetch)(n.href, {
|
|
283
|
+
headers: Object.fromEntries(o.entries()),
|
|
137
284
|
method: "GET",
|
|
138
285
|
redirect: "manual",
|
|
139
|
-
signal: t != null && t.signal ?
|
|
140
|
-
}).then(
|
|
286
|
+
signal: t != null && t.signal ? Z(t.signal) : null
|
|
287
|
+
}).then(Y);
|
|
141
288
|
}
|
|
142
|
-
function
|
|
289
|
+
function w(e) {
|
|
143
290
|
return typeof e == "string" && e.length !== 0;
|
|
144
291
|
}
|
|
145
|
-
async function
|
|
292
|
+
async function Me(e, t) {
|
|
146
293
|
if (!(e instanceof URL))
|
|
147
294
|
throw new TypeError('"expectedIssuer" must be an instance of URL');
|
|
148
|
-
if (!
|
|
295
|
+
if (!q(t, Response))
|
|
149
296
|
throw new TypeError('"response" must be an instance of Response');
|
|
150
297
|
if (t.status !== 200)
|
|
151
|
-
throw new
|
|
152
|
-
|
|
298
|
+
throw new a('"response" is not a conform Authorization Server Metadata response');
|
|
299
|
+
X(t);
|
|
153
300
|
let n;
|
|
154
301
|
try {
|
|
155
302
|
n = await t.json();
|
|
156
|
-
} catch (
|
|
157
|
-
throw new
|
|
303
|
+
} catch (o) {
|
|
304
|
+
throw new a('failed to parse "response" body as JSON', { cause: o });
|
|
158
305
|
}
|
|
159
|
-
if (!
|
|
160
|
-
throw new
|
|
161
|
-
if (!
|
|
162
|
-
throw new
|
|
306
|
+
if (!C(n))
|
|
307
|
+
throw new a('"response" body must be a top level object');
|
|
308
|
+
if (!w(n.issuer))
|
|
309
|
+
throw new a('"response" body "issuer" property must be a non-empty string');
|
|
163
310
|
if (new URL(n.issuer).href !== e.href)
|
|
164
|
-
throw new
|
|
311
|
+
throw new a('"response" body "issuer" does not match "expectedIssuer"');
|
|
165
312
|
return n;
|
|
166
313
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
314
|
+
function D() {
|
|
315
|
+
return k(crypto.getRandomValues(new Uint8Array(32)));
|
|
169
316
|
}
|
|
170
|
-
function
|
|
171
|
-
return
|
|
317
|
+
function Be() {
|
|
318
|
+
return D();
|
|
172
319
|
}
|
|
173
|
-
function
|
|
174
|
-
return
|
|
320
|
+
function Ge() {
|
|
321
|
+
return D();
|
|
175
322
|
}
|
|
176
|
-
async function
|
|
177
|
-
if (!
|
|
323
|
+
async function qe(e) {
|
|
324
|
+
if (!w(e))
|
|
178
325
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
179
|
-
return
|
|
326
|
+
return k(await crypto.subtle.digest("SHA-256", A(e)));
|
|
180
327
|
}
|
|
181
|
-
function
|
|
328
|
+
function Ve(e) {
|
|
182
329
|
if (e instanceof CryptoKey)
|
|
183
330
|
return { key: e };
|
|
184
331
|
if (!((e == null ? void 0 : e.key) instanceof CryptoKey))
|
|
185
332
|
return {};
|
|
186
|
-
if (e.kid !== void 0 && !
|
|
333
|
+
if (e.kid !== void 0 && !w(e.kid))
|
|
187
334
|
throw new TypeError('"kid" must be a non-empty string');
|
|
188
335
|
return { key: e.key, kid: e.kid };
|
|
189
336
|
}
|
|
190
|
-
function
|
|
337
|
+
function se(e) {
|
|
191
338
|
return encodeURIComponent(e).replace(/%20/g, "+");
|
|
192
339
|
}
|
|
193
|
-
function
|
|
194
|
-
const n =
|
|
195
|
-
return `Basic ${btoa(`${n}:${
|
|
340
|
+
function Ye(e, t) {
|
|
341
|
+
const n = se(e), o = se(t);
|
|
342
|
+
return `Basic ${btoa(`${n}:${o}`)}`;
|
|
196
343
|
}
|
|
197
|
-
function
|
|
344
|
+
function Ze(e) {
|
|
198
345
|
switch (e.algorithm.hash.name) {
|
|
199
346
|
case "SHA-256":
|
|
200
347
|
return "PS256";
|
|
@@ -203,10 +350,10 @@ function je(e) {
|
|
|
203
350
|
case "SHA-512":
|
|
204
351
|
return "PS512";
|
|
205
352
|
default:
|
|
206
|
-
throw new
|
|
353
|
+
throw new v("unsupported RsaHashedKeyAlgorithm hash name");
|
|
207
354
|
}
|
|
208
355
|
}
|
|
209
|
-
function
|
|
356
|
+
function Qe(e) {
|
|
210
357
|
switch (e.algorithm.hash.name) {
|
|
211
358
|
case "SHA-256":
|
|
212
359
|
return "RS256";
|
|
@@ -215,10 +362,10 @@ function Ue(e) {
|
|
|
215
362
|
case "SHA-512":
|
|
216
363
|
return "RS512";
|
|
217
364
|
default:
|
|
218
|
-
throw new
|
|
365
|
+
throw new v("unsupported RsaHashedKeyAlgorithm hash name");
|
|
219
366
|
}
|
|
220
367
|
}
|
|
221
|
-
function
|
|
368
|
+
function Xe(e) {
|
|
222
369
|
switch (e.algorithm.namedCurve) {
|
|
223
370
|
case "P-256":
|
|
224
371
|
return "ES256";
|
|
@@ -227,39 +374,39 @@ function Ce(e) {
|
|
|
227
374
|
case "P-521":
|
|
228
375
|
return "ES512";
|
|
229
376
|
default:
|
|
230
|
-
throw new
|
|
377
|
+
throw new v("unsupported EcKeyAlgorithm namedCurve");
|
|
231
378
|
}
|
|
232
379
|
}
|
|
233
|
-
function
|
|
380
|
+
function ge(e) {
|
|
234
381
|
switch (e.algorithm.name) {
|
|
235
382
|
case "RSA-PSS":
|
|
236
|
-
return
|
|
383
|
+
return Ze(e);
|
|
237
384
|
case "RSASSA-PKCS1-v1_5":
|
|
238
|
-
return
|
|
385
|
+
return Qe(e);
|
|
239
386
|
case "ECDSA":
|
|
240
|
-
return
|
|
387
|
+
return Xe(e);
|
|
241
388
|
case "Ed25519":
|
|
242
389
|
case "Ed448":
|
|
243
390
|
return "EdDSA";
|
|
244
391
|
default:
|
|
245
|
-
throw new
|
|
392
|
+
throw new v("unsupported CryptoKey algorithm name");
|
|
246
393
|
}
|
|
247
394
|
}
|
|
248
|
-
function
|
|
249
|
-
const t = e == null ? void 0 : e[
|
|
395
|
+
function H(e) {
|
|
396
|
+
const t = e == null ? void 0 : e[K];
|
|
250
397
|
return typeof t == "number" && Number.isFinite(t) ? t : 0;
|
|
251
398
|
}
|
|
252
|
-
function
|
|
253
|
-
const t = e == null ? void 0 : e[
|
|
399
|
+
function et(e) {
|
|
400
|
+
const t = e == null ? void 0 : e[Oe];
|
|
254
401
|
return typeof t == "number" && Number.isFinite(t) && Math.sign(t) !== -1 ? t : 30;
|
|
255
402
|
}
|
|
256
|
-
function
|
|
403
|
+
function Q() {
|
|
257
404
|
return Math.floor(Date.now() / 1e3);
|
|
258
405
|
}
|
|
259
|
-
function
|
|
260
|
-
const n =
|
|
406
|
+
function tt(e, t) {
|
|
407
|
+
const n = Q() + H(t);
|
|
261
408
|
return {
|
|
262
|
-
jti:
|
|
409
|
+
jti: D(),
|
|
263
410
|
aud: [e.issuer, e.token_endpoint],
|
|
264
411
|
exp: n + 60,
|
|
265
412
|
iat: n,
|
|
@@ -268,240 +415,240 @@ function Je(e, t) {
|
|
|
268
415
|
sub: t.client_id
|
|
269
416
|
};
|
|
270
417
|
}
|
|
271
|
-
async function
|
|
272
|
-
return
|
|
273
|
-
alg:
|
|
274
|
-
kid:
|
|
275
|
-
},
|
|
418
|
+
async function nt(e, t, n, o) {
|
|
419
|
+
return me({
|
|
420
|
+
alg: ge(n),
|
|
421
|
+
kid: o
|
|
422
|
+
}, tt(e, t), n);
|
|
276
423
|
}
|
|
277
|
-
function
|
|
424
|
+
function j(e) {
|
|
278
425
|
if (typeof e != "object" || e === null)
|
|
279
426
|
throw new TypeError('"as" must be an object');
|
|
280
|
-
if (!
|
|
427
|
+
if (!w(e.issuer))
|
|
281
428
|
throw new TypeError('"as.issuer" property must be a non-empty string');
|
|
282
429
|
return !0;
|
|
283
430
|
}
|
|
284
|
-
function
|
|
431
|
+
function z(e) {
|
|
285
432
|
if (typeof e != "object" || e === null)
|
|
286
433
|
throw new TypeError('"client" must be an object');
|
|
287
|
-
if (!
|
|
434
|
+
if (!w(e.client_id))
|
|
288
435
|
throw new TypeError('"client.client_id" property must be a non-empty string');
|
|
289
436
|
return !0;
|
|
290
437
|
}
|
|
291
|
-
function
|
|
292
|
-
if (!
|
|
438
|
+
function ae(e) {
|
|
439
|
+
if (!w(e))
|
|
293
440
|
throw new TypeError('"client.client_secret" property must be a non-empty string');
|
|
294
441
|
return e;
|
|
295
442
|
}
|
|
296
|
-
function
|
|
443
|
+
function F(e, t) {
|
|
297
444
|
if (t !== void 0)
|
|
298
445
|
throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${e} client authentication method is used.`);
|
|
299
446
|
}
|
|
300
|
-
function
|
|
447
|
+
function ce(e, t) {
|
|
301
448
|
if (t !== void 0)
|
|
302
449
|
throw new TypeError(`"client.client_secret" property must not be provided when ${e} client authentication method is used.`);
|
|
303
450
|
}
|
|
304
|
-
async function
|
|
451
|
+
async function rt(e, t, n, o, s) {
|
|
305
452
|
switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), t.token_endpoint_auth_method) {
|
|
306
453
|
case void 0:
|
|
307
454
|
case "client_secret_basic": {
|
|
308
|
-
|
|
455
|
+
F("client_secret_basic", s), o.set("authorization", Ye(t.client_id, ae(t.client_secret)));
|
|
309
456
|
break;
|
|
310
457
|
}
|
|
311
458
|
case "client_secret_post": {
|
|
312
|
-
|
|
459
|
+
F("client_secret_post", s), n.set("client_id", t.client_id), n.set("client_secret", ae(t.client_secret));
|
|
313
460
|
break;
|
|
314
461
|
}
|
|
315
462
|
case "private_key_jwt": {
|
|
316
|
-
if (
|
|
463
|
+
if (ce("private_key_jwt", t.client_secret), s === void 0)
|
|
317
464
|
throw new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
|
|
318
|
-
const { key:
|
|
319
|
-
if (!
|
|
465
|
+
const { key: r, kid: i } = Ve(s);
|
|
466
|
+
if (!we(r))
|
|
320
467
|
throw new TypeError('"options.clientPrivateKey.key" must be a private CryptoKey');
|
|
321
|
-
n.set("client_id", t.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await
|
|
468
|
+
n.set("client_id", t.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await nt(e, t, r, i));
|
|
322
469
|
break;
|
|
323
470
|
}
|
|
324
471
|
case "tls_client_auth":
|
|
325
472
|
case "self_signed_tls_client_auth":
|
|
326
473
|
case "none": {
|
|
327
|
-
|
|
474
|
+
ce(t.token_endpoint_auth_method, t.client_secret), F(t.token_endpoint_auth_method, s), n.set("client_id", t.client_id);
|
|
328
475
|
break;
|
|
329
476
|
}
|
|
330
477
|
default:
|
|
331
|
-
throw new
|
|
478
|
+
throw new v("unsupported client token_endpoint_auth_method");
|
|
332
479
|
}
|
|
333
480
|
}
|
|
334
|
-
async function
|
|
481
|
+
async function me(e, t, n) {
|
|
335
482
|
if (!n.usages.includes("sign"))
|
|
336
483
|
throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
|
|
337
|
-
const
|
|
338
|
-
return `${
|
|
484
|
+
const o = `${k(A(JSON.stringify(e)))}.${k(A(JSON.stringify(t)))}`, s = k(await crypto.subtle.sign(Se(n), n, A(o)));
|
|
485
|
+
return `${o}.${s}`;
|
|
339
486
|
}
|
|
340
|
-
async function
|
|
341
|
-
const { privateKey:
|
|
342
|
-
if (!
|
|
487
|
+
async function ot(e, t, n, o, s, r) {
|
|
488
|
+
const { privateKey: i, publicKey: d, nonce: g = fe.get(n.origin) } = t;
|
|
489
|
+
if (!we(i))
|
|
343
490
|
throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
|
|
344
|
-
if (
|
|
491
|
+
if (!$e(d))
|
|
345
492
|
throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
|
|
346
|
-
if (
|
|
493
|
+
if (g !== void 0 && !w(g))
|
|
347
494
|
throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
|
|
348
|
-
if (!
|
|
495
|
+
if (!d.extractable)
|
|
349
496
|
throw new TypeError('"DPoP.publicKey.extractable" must be true');
|
|
350
|
-
const
|
|
351
|
-
alg:
|
|
497
|
+
const m = Q() + s, _ = await me({
|
|
498
|
+
alg: ge(i),
|
|
352
499
|
typ: "dpop+jwt",
|
|
353
|
-
jwk: await
|
|
500
|
+
jwk: await st(d)
|
|
354
501
|
}, {
|
|
355
|
-
iat:
|
|
356
|
-
jti:
|
|
357
|
-
htm:
|
|
358
|
-
nonce:
|
|
502
|
+
iat: m,
|
|
503
|
+
jti: D(),
|
|
504
|
+
htm: o,
|
|
505
|
+
nonce: g,
|
|
359
506
|
htu: `${n.origin}${n.pathname}`,
|
|
360
|
-
ath:
|
|
361
|
-
},
|
|
362
|
-
e.set("dpop",
|
|
507
|
+
ath: r ? k(await crypto.subtle.digest("SHA-256", A(r))) : void 0
|
|
508
|
+
}, i);
|
|
509
|
+
e.set("dpop", _);
|
|
363
510
|
}
|
|
364
|
-
let
|
|
365
|
-
async function
|
|
366
|
-
const { kty: t, e: n, n:
|
|
367
|
-
return
|
|
511
|
+
let N;
|
|
512
|
+
async function it(e) {
|
|
513
|
+
const { kty: t, e: n, n: o, x: s, y: r, crv: i } = await crypto.subtle.exportKey("jwk", e), d = { kty: t, e: n, n: o, x: s, y: r, crv: i };
|
|
514
|
+
return N.set(e, d), d;
|
|
368
515
|
}
|
|
369
|
-
async function
|
|
370
|
-
return
|
|
516
|
+
async function st(e) {
|
|
517
|
+
return N || (N = /* @__PURE__ */ new WeakMap()), N.get(e) || it(e);
|
|
371
518
|
}
|
|
372
|
-
function
|
|
519
|
+
function at(e, t, n) {
|
|
373
520
|
if (typeof e != "string")
|
|
374
521
|
throw new TypeError(`"as.${t}" must be a string`);
|
|
375
522
|
return new URL(e);
|
|
376
523
|
}
|
|
377
|
-
function
|
|
378
|
-
return
|
|
524
|
+
function ye(e, t, n) {
|
|
525
|
+
return at(e[t], t);
|
|
379
526
|
}
|
|
380
|
-
function
|
|
527
|
+
function B(e) {
|
|
381
528
|
const t = e;
|
|
382
529
|
return typeof t != "object" || Array.isArray(t) || t === null ? !1 : t.error !== void 0;
|
|
383
530
|
}
|
|
384
|
-
async function
|
|
385
|
-
if (!
|
|
531
|
+
async function ct(e, t, n, o, s, r) {
|
|
532
|
+
if (!w(e))
|
|
386
533
|
throw new TypeError('"accessToken" must be a non-empty string');
|
|
387
534
|
if (!(n instanceof URL))
|
|
388
535
|
throw new TypeError('"url" must be an instance of URL');
|
|
389
|
-
return
|
|
390
|
-
body:
|
|
391
|
-
headers: Object.fromEntries(
|
|
536
|
+
return o = W(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${e}`) : (await ot(o, r.DPoP, n, "GET", H({ [K]: r == null ? void 0 : r[K] }), e), o.set("authorization", `DPoP ${e}`)), ((r == null ? void 0 : r[V]) || fetch)(n.href, {
|
|
537
|
+
body: s,
|
|
538
|
+
headers: Object.fromEntries(o.entries()),
|
|
392
539
|
method: t,
|
|
393
540
|
redirect: "manual",
|
|
394
|
-
signal:
|
|
395
|
-
}).then(
|
|
396
|
-
}
|
|
397
|
-
async function
|
|
398
|
-
|
|
399
|
-
const
|
|
400
|
-
return t.userinfo_signed_response_alg ?
|
|
401
|
-
...
|
|
402
|
-
[
|
|
541
|
+
signal: r != null && r.signal ? Z(r.signal) : null
|
|
542
|
+
}).then(Y);
|
|
543
|
+
}
|
|
544
|
+
async function ut(e, t, n, o) {
|
|
545
|
+
j(e), z(t);
|
|
546
|
+
const s = ye(e, "userinfo_endpoint"), r = W(o == null ? void 0 : o.headers);
|
|
547
|
+
return t.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")), ct(n, "GET", s, r, null, {
|
|
548
|
+
...o,
|
|
549
|
+
[K]: H(t)
|
|
403
550
|
});
|
|
404
551
|
}
|
|
405
|
-
async function
|
|
406
|
-
return await
|
|
407
|
-
body:
|
|
408
|
-
headers: Object.fromEntries(
|
|
552
|
+
async function lt(e, t, n, o, s, r, i) {
|
|
553
|
+
return await rt(e, t, s, r, i == null ? void 0 : i.clientPrivateKey), r.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[V]) || fetch)(o.href, {
|
|
554
|
+
body: s,
|
|
555
|
+
headers: Object.fromEntries(r.entries()),
|
|
409
556
|
method: n,
|
|
410
557
|
redirect: "manual",
|
|
411
|
-
signal:
|
|
412
|
-
}).then(
|
|
558
|
+
signal: i != null && i.signal ? Z(i.signal) : null
|
|
559
|
+
}).then(Y);
|
|
413
560
|
}
|
|
414
|
-
async function
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
const
|
|
418
|
-
return
|
|
561
|
+
async function _e(e, t, n, o, s) {
|
|
562
|
+
const r = ye(e, "token_endpoint");
|
|
563
|
+
o.set("grant_type", n);
|
|
564
|
+
const i = W(s == null ? void 0 : s.headers);
|
|
565
|
+
return i.set("accept", "application/json"), lt(e, t, "POST", r, o, i, s);
|
|
419
566
|
}
|
|
420
|
-
async function
|
|
421
|
-
if (
|
|
567
|
+
async function dt(e, t, n, o) {
|
|
568
|
+
if (j(e), z(t), !w(n))
|
|
422
569
|
throw new TypeError('"refreshToken" must be a non-empty string');
|
|
423
|
-
const
|
|
424
|
-
return
|
|
570
|
+
const s = new URLSearchParams(o == null ? void 0 : o.additionalParameters);
|
|
571
|
+
return s.set("refresh_token", n), _e(e, t, "refresh_token", s, o);
|
|
425
572
|
}
|
|
426
|
-
const
|
|
427
|
-
async function
|
|
428
|
-
if (
|
|
573
|
+
const ht = /* @__PURE__ */ new WeakMap();
|
|
574
|
+
async function be(e, t, n, o = !1, s = !1) {
|
|
575
|
+
if (j(e), z(t), !q(n, Response))
|
|
429
576
|
throw new TypeError('"response" must be an instance of Response');
|
|
430
577
|
if (n.status !== 200) {
|
|
431
|
-
let
|
|
432
|
-
if (
|
|
433
|
-
return
|
|
434
|
-
throw new
|
|
578
|
+
let i;
|
|
579
|
+
if (i = await vt(n))
|
|
580
|
+
return i;
|
|
581
|
+
throw new a('"response" is not a conform Token Endpoint response');
|
|
435
582
|
}
|
|
436
|
-
|
|
437
|
-
let
|
|
583
|
+
X(n);
|
|
584
|
+
let r;
|
|
438
585
|
try {
|
|
439
|
-
|
|
440
|
-
} catch (
|
|
441
|
-
throw new
|
|
442
|
-
}
|
|
443
|
-
if (!
|
|
444
|
-
throw new
|
|
445
|
-
if (!
|
|
446
|
-
throw new
|
|
447
|
-
if (!
|
|
448
|
-
throw new
|
|
449
|
-
if (
|
|
450
|
-
throw new
|
|
451
|
-
if (
|
|
452
|
-
throw new
|
|
453
|
-
if (!
|
|
454
|
-
throw new
|
|
455
|
-
if (
|
|
456
|
-
throw new
|
|
457
|
-
if (!
|
|
458
|
-
if (
|
|
459
|
-
throw new
|
|
460
|
-
if (
|
|
461
|
-
const { claims:
|
|
462
|
-
if (Array.isArray(
|
|
463
|
-
throw new
|
|
464
|
-
if (
|
|
465
|
-
throw new
|
|
466
|
-
|
|
586
|
+
r = await n.json();
|
|
587
|
+
} catch (i) {
|
|
588
|
+
throw new a('failed to parse "response" body as JSON', { cause: i });
|
|
589
|
+
}
|
|
590
|
+
if (!C(r))
|
|
591
|
+
throw new a('"response" body must be a top level object');
|
|
592
|
+
if (!w(r.access_token))
|
|
593
|
+
throw new a('"response" body "access_token" property must be a non-empty string');
|
|
594
|
+
if (!w(r.token_type))
|
|
595
|
+
throw new a('"response" body "token_type" property must be a non-empty string');
|
|
596
|
+
if (r.token_type = r.token_type.toLowerCase(), r.token_type !== "dpop" && r.token_type !== "bearer")
|
|
597
|
+
throw new v("unsupported `token_type` value");
|
|
598
|
+
if (r.expires_in !== void 0 && (typeof r.expires_in != "number" || r.expires_in <= 0))
|
|
599
|
+
throw new a('"response" body "expires_in" property must be a positive number');
|
|
600
|
+
if (!s && r.refresh_token !== void 0 && !w(r.refresh_token))
|
|
601
|
+
throw new a('"response" body "refresh_token" property must be a non-empty string');
|
|
602
|
+
if (r.scope !== void 0 && typeof r.scope != "string")
|
|
603
|
+
throw new a('"response" body "scope" property must be a string');
|
|
604
|
+
if (!o) {
|
|
605
|
+
if (r.id_token !== void 0 && !w(r.id_token))
|
|
606
|
+
throw new a('"response" body "id_token" property must be a non-empty string');
|
|
607
|
+
if (r.id_token) {
|
|
608
|
+
const { claims: i } = await Et(r.id_token, kt.bind(void 0, t.id_token_signed_response_alg, e.id_token_signing_alg_values_supported), Ee, H(t), et(t)).then(_t.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(wt.bind(void 0, e.issuer)).then(pt.bind(void 0, t.client_id));
|
|
609
|
+
if (Array.isArray(i.aud) && i.aud.length !== 1 && i.azp !== t.client_id)
|
|
610
|
+
throw new a('unexpected ID Token "azp" (authorized party) claim value');
|
|
611
|
+
if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
|
|
612
|
+
throw new a('ID Token "auth_time" (authentication time) must be a positive number');
|
|
613
|
+
ht.set(r, i);
|
|
467
614
|
}
|
|
468
615
|
}
|
|
469
|
-
return
|
|
616
|
+
return r;
|
|
470
617
|
}
|
|
471
|
-
async function
|
|
472
|
-
return
|
|
618
|
+
async function ft(e, t, n) {
|
|
619
|
+
return be(e, t, n);
|
|
473
620
|
}
|
|
474
|
-
function
|
|
621
|
+
function pt(e, t) {
|
|
475
622
|
if (Array.isArray(t.claims.aud)) {
|
|
476
623
|
if (!t.claims.aud.includes(e))
|
|
477
|
-
throw new
|
|
624
|
+
throw new a('unexpected JWT "aud" (audience) claim value');
|
|
478
625
|
} else if (t.claims.aud !== e)
|
|
479
|
-
throw new
|
|
626
|
+
throw new a('unexpected JWT "aud" (audience) claim value');
|
|
480
627
|
return t;
|
|
481
628
|
}
|
|
482
|
-
function
|
|
629
|
+
function wt(e, t) {
|
|
483
630
|
if (t.claims.iss !== e)
|
|
484
|
-
throw new
|
|
631
|
+
throw new a('unexpected JWT "iss" (issuer) claim value');
|
|
485
632
|
return t;
|
|
486
633
|
}
|
|
487
|
-
const
|
|
488
|
-
function
|
|
489
|
-
return
|
|
634
|
+
const ve = /* @__PURE__ */ new WeakSet();
|
|
635
|
+
function gt(e) {
|
|
636
|
+
return ve.add(e), e;
|
|
490
637
|
}
|
|
491
|
-
async function
|
|
492
|
-
if (
|
|
638
|
+
async function mt(e, t, n, o, s, r) {
|
|
639
|
+
if (j(e), z(t), !ve.has(n))
|
|
493
640
|
throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
|
|
494
|
-
if (!
|
|
641
|
+
if (!w(o))
|
|
495
642
|
throw new TypeError('"redirectUri" must be a non-empty string');
|
|
496
|
-
if (!
|
|
643
|
+
if (!w(s))
|
|
497
644
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
498
|
-
const
|
|
499
|
-
if (!
|
|
500
|
-
throw new
|
|
501
|
-
const
|
|
502
|
-
return
|
|
645
|
+
const i = E(n, "code");
|
|
646
|
+
if (!i)
|
|
647
|
+
throw new a('no authorization code in "callbackParameters"');
|
|
648
|
+
const d = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
|
|
649
|
+
return d.set("redirect_uri", o), d.set("code_verifier", s), d.set("code", i), _e(e, t, "authorization_code", d, r);
|
|
503
650
|
}
|
|
504
|
-
const
|
|
651
|
+
const yt = {
|
|
505
652
|
aud: "audience",
|
|
506
653
|
c_hash: "code hash",
|
|
507
654
|
client_id: "client id",
|
|
@@ -517,43 +664,43 @@ const Ze = {
|
|
|
517
664
|
htu: "http uri",
|
|
518
665
|
cnf: "confirmation"
|
|
519
666
|
};
|
|
520
|
-
function
|
|
667
|
+
function _t(e, t) {
|
|
521
668
|
for (const n of e)
|
|
522
669
|
if (t.claims[n] === void 0)
|
|
523
|
-
throw new
|
|
670
|
+
throw new a(`JWT "${n}" (${yt[n]}) claim missing`);
|
|
524
671
|
return t;
|
|
525
672
|
}
|
|
526
|
-
async function
|
|
527
|
-
const
|
|
528
|
-
if (
|
|
529
|
-
return
|
|
530
|
-
if (
|
|
531
|
-
if (typeof
|
|
532
|
-
throw new
|
|
533
|
-
delete
|
|
673
|
+
async function bt(e, t, n) {
|
|
674
|
+
const o = await be(e, t, n, !0);
|
|
675
|
+
if (B(o))
|
|
676
|
+
return o;
|
|
677
|
+
if (o.id_token !== void 0) {
|
|
678
|
+
if (typeof o.id_token == "string" && o.id_token.length)
|
|
679
|
+
throw new a("Unexpected ID Token returned, use processAuthorizationCodeOpenIDResponse() for OpenID Connect callback processing");
|
|
680
|
+
delete o.id_token;
|
|
534
681
|
}
|
|
535
|
-
return
|
|
682
|
+
return o;
|
|
536
683
|
}
|
|
537
|
-
function
|
|
684
|
+
function X(e) {
|
|
538
685
|
if (e.bodyUsed)
|
|
539
686
|
throw new TypeError('"response" body has been used already');
|
|
540
687
|
}
|
|
541
|
-
async function
|
|
688
|
+
async function vt(e) {
|
|
542
689
|
if (e.status > 399 && e.status < 500) {
|
|
543
|
-
|
|
690
|
+
X(e);
|
|
544
691
|
try {
|
|
545
692
|
const t = await e.json();
|
|
546
|
-
if (
|
|
693
|
+
if (C(t) && typeof t.error == "string" && t.error.length)
|
|
547
694
|
return t.error_description !== void 0 && typeof t.error_description != "string" && delete t.error_description, t.error_uri !== void 0 && typeof t.error_uri != "string" && delete t.error_uri, t.algs !== void 0 && typeof t.algs != "string" && delete t.algs, t.scope !== void 0 && typeof t.scope != "string" && delete t.scope, t;
|
|
548
695
|
} catch {
|
|
549
696
|
}
|
|
550
697
|
}
|
|
551
698
|
}
|
|
552
|
-
function
|
|
699
|
+
function ue(e) {
|
|
553
700
|
if (typeof e.modulusLength != "number" || e.modulusLength < 2048)
|
|
554
|
-
throw new
|
|
701
|
+
throw new a(`${e.name} modulusLength must be at least 2048 bits`);
|
|
555
702
|
}
|
|
556
|
-
function
|
|
703
|
+
function St(e) {
|
|
557
704
|
switch (e) {
|
|
558
705
|
case "P-256":
|
|
559
706
|
return "SHA-256";
|
|
@@ -562,18 +709,18 @@ function tt(e) {
|
|
|
562
709
|
case "P-521":
|
|
563
710
|
return "SHA-512";
|
|
564
711
|
default:
|
|
565
|
-
throw new
|
|
712
|
+
throw new v();
|
|
566
713
|
}
|
|
567
714
|
}
|
|
568
|
-
function
|
|
715
|
+
function Se(e) {
|
|
569
716
|
switch (e.algorithm.name) {
|
|
570
717
|
case "ECDSA":
|
|
571
718
|
return {
|
|
572
719
|
name: e.algorithm.name,
|
|
573
|
-
hash:
|
|
720
|
+
hash: St(e.algorithm.namedCurve)
|
|
574
721
|
};
|
|
575
722
|
case "RSA-PSS":
|
|
576
|
-
switch (
|
|
723
|
+
switch (ue(e.algorithm), e.algorithm.hash.name) {
|
|
577
724
|
case "SHA-256":
|
|
578
725
|
case "SHA-384":
|
|
579
726
|
case "SHA-512":
|
|
@@ -582,229 +729,229 @@ function oe(e) {
|
|
|
582
729
|
saltLength: parseInt(e.algorithm.hash.name.slice(-3), 10) >> 3
|
|
583
730
|
};
|
|
584
731
|
default:
|
|
585
|
-
throw new
|
|
732
|
+
throw new v();
|
|
586
733
|
}
|
|
587
734
|
case "RSASSA-PKCS1-v1_5":
|
|
588
|
-
return
|
|
735
|
+
return ue(e.algorithm), e.algorithm.name;
|
|
589
736
|
case "Ed448":
|
|
590
737
|
case "Ed25519":
|
|
591
738
|
return e.algorithm.name;
|
|
592
739
|
}
|
|
593
|
-
throw new
|
|
594
|
-
}
|
|
595
|
-
const
|
|
596
|
-
async function
|
|
597
|
-
const { 0:
|
|
598
|
-
if (
|
|
599
|
-
throw new
|
|
600
|
-
if (
|
|
601
|
-
throw new
|
|
602
|
-
let
|
|
740
|
+
throw new v();
|
|
741
|
+
}
|
|
742
|
+
const Ee = Symbol();
|
|
743
|
+
async function Et(e, t, n, o, s) {
|
|
744
|
+
const { 0: r, 1: i, 2: d, length: g } = e.split(".");
|
|
745
|
+
if (g === 5)
|
|
746
|
+
throw new v("JWE structure JWTs are not supported");
|
|
747
|
+
if (g !== 3)
|
|
748
|
+
throw new a("Invalid JWT");
|
|
749
|
+
let m;
|
|
603
750
|
try {
|
|
604
|
-
|
|
605
|
-
} catch (
|
|
606
|
-
throw new
|
|
607
|
-
}
|
|
608
|
-
if (!
|
|
609
|
-
throw new
|
|
610
|
-
if (t(
|
|
611
|
-
throw new
|
|
612
|
-
const
|
|
613
|
-
let
|
|
614
|
-
if (n !==
|
|
615
|
-
|
|
616
|
-
const
|
|
617
|
-
if (!await crypto.subtle.verify(
|
|
618
|
-
throw new
|
|
619
|
-
}
|
|
620
|
-
let
|
|
751
|
+
m = JSON.parse(A(k(r)));
|
|
752
|
+
} catch (R) {
|
|
753
|
+
throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: R });
|
|
754
|
+
}
|
|
755
|
+
if (!C(m))
|
|
756
|
+
throw new a("JWT Header must be a top level object");
|
|
757
|
+
if (t(m), m.crit !== void 0)
|
|
758
|
+
throw new a('unexpected JWT "crit" header parameter');
|
|
759
|
+
const _ = k(d);
|
|
760
|
+
let y;
|
|
761
|
+
if (n !== Ee) {
|
|
762
|
+
y = await n(m);
|
|
763
|
+
const R = `${r}.${i}`;
|
|
764
|
+
if (!await crypto.subtle.verify(Se(y), y, _, A(R)))
|
|
765
|
+
throw new a("JWT signature verification failed");
|
|
766
|
+
}
|
|
767
|
+
let h;
|
|
621
768
|
try {
|
|
622
|
-
|
|
623
|
-
} catch (
|
|
624
|
-
throw new
|
|
625
|
-
}
|
|
626
|
-
if (!
|
|
627
|
-
throw new
|
|
628
|
-
const
|
|
629
|
-
if (
|
|
630
|
-
if (typeof
|
|
631
|
-
throw new
|
|
632
|
-
if (
|
|
633
|
-
throw new
|
|
634
|
-
}
|
|
635
|
-
if (
|
|
636
|
-
throw new
|
|
637
|
-
if (
|
|
638
|
-
throw new
|
|
639
|
-
if (
|
|
640
|
-
if (typeof
|
|
641
|
-
throw new
|
|
642
|
-
if (
|
|
643
|
-
throw new
|
|
644
|
-
}
|
|
645
|
-
if (
|
|
646
|
-
throw new
|
|
647
|
-
return { header:
|
|
648
|
-
}
|
|
649
|
-
function
|
|
769
|
+
h = JSON.parse(A(k(i)));
|
|
770
|
+
} catch (R) {
|
|
771
|
+
throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: R });
|
|
772
|
+
}
|
|
773
|
+
if (!C(h))
|
|
774
|
+
throw new a("JWT Payload must be a top level object");
|
|
775
|
+
const L = Q() + o;
|
|
776
|
+
if (h.exp !== void 0) {
|
|
777
|
+
if (typeof h.exp != "number")
|
|
778
|
+
throw new a('unexpected JWT "exp" (expiration time) claim type');
|
|
779
|
+
if (h.exp <= L - s)
|
|
780
|
+
throw new a('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
|
|
781
|
+
}
|
|
782
|
+
if (h.iat !== void 0 && typeof h.iat != "number")
|
|
783
|
+
throw new a('unexpected JWT "iat" (issued at) claim type');
|
|
784
|
+
if (h.iss !== void 0 && typeof h.iss != "string")
|
|
785
|
+
throw new a('unexpected JWT "iss" (issuer) claim type');
|
|
786
|
+
if (h.nbf !== void 0) {
|
|
787
|
+
if (typeof h.nbf != "number")
|
|
788
|
+
throw new a('unexpected JWT "nbf" (not before) claim type');
|
|
789
|
+
if (h.nbf > L + s)
|
|
790
|
+
throw new a('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
|
|
791
|
+
}
|
|
792
|
+
if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
|
|
793
|
+
throw new a('unexpected JWT "aud" (audience) claim type');
|
|
794
|
+
return { header: m, claims: h, signature: _, key: y };
|
|
795
|
+
}
|
|
796
|
+
function kt(e, t, n) {
|
|
650
797
|
if (e !== void 0) {
|
|
651
798
|
if (n.alg !== e)
|
|
652
|
-
throw new
|
|
799
|
+
throw new a('unexpected JWT "alg" header parameter');
|
|
653
800
|
return;
|
|
654
801
|
}
|
|
655
802
|
if (Array.isArray(t)) {
|
|
656
803
|
if (!t.includes(n.alg))
|
|
657
|
-
throw new
|
|
804
|
+
throw new a('unexpected JWT "alg" header parameter');
|
|
658
805
|
return;
|
|
659
806
|
}
|
|
660
807
|
if (n.alg !== "RS256")
|
|
661
|
-
throw new
|
|
808
|
+
throw new a('unexpected JWT "alg" header parameter');
|
|
662
809
|
}
|
|
663
|
-
function
|
|
664
|
-
const { 0: n, length:
|
|
665
|
-
if (
|
|
666
|
-
throw new
|
|
810
|
+
function E(e, t) {
|
|
811
|
+
const { 0: n, length: o } = e.getAll(t);
|
|
812
|
+
if (o > 1)
|
|
813
|
+
throw new a(`"${t}" parameter must be provided only once`);
|
|
667
814
|
return n;
|
|
668
815
|
}
|
|
669
|
-
const
|
|
670
|
-
function
|
|
671
|
-
if (
|
|
816
|
+
const Tt = Symbol(), At = Symbol();
|
|
817
|
+
function Rt(e, t, n, o) {
|
|
818
|
+
if (j(e), z(t), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
|
|
672
819
|
throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
|
|
673
|
-
if (
|
|
674
|
-
throw new
|
|
675
|
-
const
|
|
676
|
-
if (!
|
|
677
|
-
throw new
|
|
678
|
-
if (
|
|
679
|
-
throw new
|
|
680
|
-
switch (
|
|
820
|
+
if (E(n, "response"))
|
|
821
|
+
throw new a('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
|
|
822
|
+
const s = E(n, "iss"), r = E(n, "state");
|
|
823
|
+
if (!s && e.authorization_response_iss_parameter_supported)
|
|
824
|
+
throw new a('response parameter "iss" (issuer) missing');
|
|
825
|
+
if (s && s !== e.issuer)
|
|
826
|
+
throw new a('unexpected "iss" (issuer) response parameter value');
|
|
827
|
+
switch (o) {
|
|
681
828
|
case void 0:
|
|
682
|
-
case
|
|
683
|
-
if (
|
|
684
|
-
throw new
|
|
829
|
+
case At:
|
|
830
|
+
if (r !== void 0)
|
|
831
|
+
throw new a('unexpected "state" response parameter encountered');
|
|
685
832
|
break;
|
|
686
|
-
case
|
|
833
|
+
case Tt:
|
|
687
834
|
break;
|
|
688
835
|
default:
|
|
689
|
-
if (!
|
|
690
|
-
throw new
|
|
691
|
-
if (
|
|
692
|
-
throw new
|
|
693
|
-
if (
|
|
694
|
-
throw new
|
|
695
|
-
}
|
|
696
|
-
const
|
|
697
|
-
if (
|
|
836
|
+
if (!w(o))
|
|
837
|
+
throw new a('"expectedState" must be a non-empty string');
|
|
838
|
+
if (r === void 0)
|
|
839
|
+
throw new a('response parameter "state" missing');
|
|
840
|
+
if (r !== o)
|
|
841
|
+
throw new a('unexpected "state" response parameter value');
|
|
842
|
+
}
|
|
843
|
+
const i = E(n, "error");
|
|
844
|
+
if (i)
|
|
698
845
|
return {
|
|
699
|
-
error:
|
|
700
|
-
error_description:
|
|
701
|
-
error_uri:
|
|
846
|
+
error: i,
|
|
847
|
+
error_description: E(n, "error_description"),
|
|
848
|
+
error_uri: E(n, "error_uri")
|
|
702
849
|
};
|
|
703
|
-
const
|
|
704
|
-
if (
|
|
705
|
-
throw new
|
|
706
|
-
return
|
|
850
|
+
const d = E(n, "id_token"), g = E(n, "token");
|
|
851
|
+
if (d !== void 0 || g !== void 0)
|
|
852
|
+
throw new v("implicit and hybrid flows are not supported");
|
|
853
|
+
return gt(new URLSearchParams(n));
|
|
707
854
|
}
|
|
708
|
-
class
|
|
855
|
+
class P extends Error {
|
|
709
856
|
}
|
|
710
|
-
class
|
|
711
|
-
constructor(t, n,
|
|
712
|
-
super(t,
|
|
857
|
+
class G extends P {
|
|
858
|
+
constructor(t, n, o) {
|
|
859
|
+
super(t, o), this.error = n;
|
|
713
860
|
}
|
|
714
861
|
}
|
|
715
|
-
function
|
|
862
|
+
function xt({
|
|
716
863
|
handleCallback: e
|
|
717
864
|
}) {
|
|
718
|
-
const t =
|
|
719
|
-
return
|
|
865
|
+
const t = Ce(!1), [n, o] = je(void 0), s = Pe();
|
|
866
|
+
return ze(() => {
|
|
720
867
|
t.current || (t.current = !0, e().then(() => {
|
|
721
|
-
|
|
722
|
-
}).catch((
|
|
723
|
-
r
|
|
868
|
+
s("/");
|
|
869
|
+
}).catch((r) => {
|
|
870
|
+
o(r);
|
|
724
871
|
}));
|
|
725
|
-
}, []), n ? n instanceof
|
|
726
|
-
/* @__PURE__ */
|
|
727
|
-
/* @__PURE__ */
|
|
872
|
+
}, []), n ? n instanceof G ? /* @__PURE__ */ T.jsxs("div", { children: [
|
|
873
|
+
/* @__PURE__ */ T.jsx("h2", { children: "Error" }),
|
|
874
|
+
/* @__PURE__ */ T.jsxs("pre", { children: [
|
|
728
875
|
n.error.error,
|
|
729
876
|
n.error.error_description,
|
|
730
877
|
n.error.error_uri
|
|
731
878
|
] })
|
|
732
|
-
] }) : /* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */
|
|
734
|
-
/* @__PURE__ */
|
|
879
|
+
] }) : /* @__PURE__ */ T.jsxs("div", { children: [
|
|
880
|
+
/* @__PURE__ */ T.jsx("h2", { children: "Error" }),
|
|
881
|
+
/* @__PURE__ */ T.jsxs("pre", { children: [
|
|
735
882
|
n.message,
|
|
736
883
|
n.stack
|
|
737
884
|
] })
|
|
738
|
-
] }) : /* @__PURE__ */
|
|
885
|
+
] }) : /* @__PURE__ */ T.jsx("div", { children: "Loading..." });
|
|
739
886
|
}
|
|
740
|
-
const
|
|
741
|
-
class
|
|
887
|
+
const le = "code-verifier";
|
|
888
|
+
class Pt {
|
|
742
889
|
constructor({
|
|
743
890
|
issuer: t,
|
|
744
891
|
authorizationEndpoint: n,
|
|
745
|
-
tokenEndpoint:
|
|
746
|
-
clientId:
|
|
892
|
+
tokenEndpoint: o,
|
|
893
|
+
clientId: s
|
|
747
894
|
}) {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
const t = new URL(window.location.href), n = t.searchParams.get("state"),
|
|
758
|
-
if (!
|
|
759
|
-
throw new
|
|
895
|
+
S(this, "client");
|
|
896
|
+
S(this, "issuer");
|
|
897
|
+
S(this, "authorizationEndpoint");
|
|
898
|
+
S(this, "tokenEndpoint");
|
|
899
|
+
S(this, "authorizationServer");
|
|
900
|
+
S(this, "tokens");
|
|
901
|
+
S(this, "callbackUrlPath", "/oauth/callback");
|
|
902
|
+
S(this, "logoutRedirectUrlPath", "/");
|
|
903
|
+
S(this, "handleCallback", async () => {
|
|
904
|
+
const t = new URL(window.location.href), n = t.searchParams.get("state"), o = localStorage.getItem(le);
|
|
905
|
+
if (!o)
|
|
906
|
+
throw new P(
|
|
760
907
|
"Code verifier not found. Invalid auth state."
|
|
761
908
|
);
|
|
762
|
-
const
|
|
763
|
-
|
|
909
|
+
const s = await this.getAuthServer(), r = Rt(
|
|
910
|
+
s,
|
|
764
911
|
this.client,
|
|
765
912
|
t.searchParams,
|
|
766
913
|
n ?? void 0
|
|
767
914
|
);
|
|
768
|
-
if (
|
|
769
|
-
throw
|
|
915
|
+
if (B(r))
|
|
916
|
+
throw oe.error("Error validating OAuth response", r), new G(
|
|
770
917
|
"Error validating OAuth response",
|
|
771
|
-
|
|
918
|
+
r
|
|
772
919
|
);
|
|
773
|
-
const
|
|
774
|
-
|
|
775
|
-
const
|
|
776
|
-
|
|
920
|
+
const i = new URL(t);
|
|
921
|
+
i.pathname = this.callbackUrlPath, i.search = "";
|
|
922
|
+
const d = await mt(
|
|
923
|
+
s,
|
|
777
924
|
this.client,
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
),
|
|
782
|
-
|
|
925
|
+
r,
|
|
926
|
+
i.toString(),
|
|
927
|
+
o
|
|
928
|
+
), g = await bt(
|
|
929
|
+
s,
|
|
783
930
|
this.client,
|
|
784
|
-
|
|
931
|
+
d
|
|
785
932
|
);
|
|
786
|
-
this.setTokensFromResponse(
|
|
787
|
-
const
|
|
788
|
-
|
|
933
|
+
this.setTokensFromResponse(g);
|
|
934
|
+
const m = await this.getAccessToken(), y = await (await ut(
|
|
935
|
+
s,
|
|
789
936
|
this.client,
|
|
790
|
-
|
|
791
|
-
)).json(),
|
|
792
|
-
sub:
|
|
793
|
-
email:
|
|
794
|
-
name:
|
|
795
|
-
emailVerified:
|
|
796
|
-
pictureUrl:
|
|
937
|
+
m
|
|
938
|
+
)).json(), h = {
|
|
939
|
+
sub: y.sub,
|
|
940
|
+
email: y.email,
|
|
941
|
+
name: y.name,
|
|
942
|
+
emailVerified: y.email_verified ?? !1,
|
|
943
|
+
pictureUrl: y.picture
|
|
797
944
|
};
|
|
798
|
-
|
|
945
|
+
re.setState({
|
|
799
946
|
isAuthenticated: !0,
|
|
800
947
|
isPending: !1,
|
|
801
|
-
profile:
|
|
948
|
+
profile: h
|
|
802
949
|
});
|
|
803
950
|
});
|
|
804
951
|
this.client = {
|
|
805
|
-
client_id:
|
|
952
|
+
client_id: s,
|
|
806
953
|
token_endpoint_auth_method: "none"
|
|
807
|
-
}, this.issuer = t, this.authorizationEndpoint = n, this.tokenEndpoint =
|
|
954
|
+
}, this.issuer = t, this.authorizationEndpoint = n, this.tokenEndpoint = o;
|
|
808
955
|
}
|
|
809
956
|
async getAuthServer() {
|
|
810
957
|
if (!this.authorizationServer)
|
|
@@ -816,8 +963,8 @@ class ct {
|
|
|
816
963
|
code_challenge_methods_supported: []
|
|
817
964
|
};
|
|
818
965
|
else {
|
|
819
|
-
const t = new URL(this.issuer), n = await
|
|
820
|
-
this.authorizationServer = await
|
|
966
|
+
const t = new URL(this.issuer), n = await Fe(t);
|
|
967
|
+
this.authorizationServer = await Me(
|
|
821
968
|
t,
|
|
822
969
|
n
|
|
823
970
|
);
|
|
@@ -829,10 +976,10 @@ class ct {
|
|
|
829
976
|
* @param response
|
|
830
977
|
*/
|
|
831
978
|
setTokensFromResponse(t) {
|
|
832
|
-
if (
|
|
833
|
-
throw
|
|
979
|
+
if (B(t))
|
|
980
|
+
throw oe.error("Bad Token Response", t), new G("Bad Token Response", t);
|
|
834
981
|
if (!t.expires_in)
|
|
835
|
-
throw new
|
|
982
|
+
throw new P("No expires_in in response");
|
|
836
983
|
this.tokens = {
|
|
837
984
|
accessToken: t.access_token,
|
|
838
985
|
refreshToken: t.refresh_token,
|
|
@@ -843,72 +990,72 @@ class ct {
|
|
|
843
990
|
async initialize() {
|
|
844
991
|
}
|
|
845
992
|
async login() {
|
|
846
|
-
var
|
|
993
|
+
var d;
|
|
847
994
|
const t = "S256", n = await this.getAuthServer();
|
|
848
995
|
if (!n.authorization_endpoint)
|
|
849
|
-
throw new
|
|
850
|
-
const
|
|
851
|
-
localStorage.setItem(
|
|
852
|
-
const
|
|
996
|
+
throw new P("No authorization endpoint");
|
|
997
|
+
const o = Be(), s = await qe(o);
|
|
998
|
+
localStorage.setItem(le, o);
|
|
999
|
+
const r = new URL(
|
|
853
1000
|
n.authorization_endpoint
|
|
854
|
-
),
|
|
855
|
-
if (
|
|
1001
|
+
), i = new URL(window.location.href);
|
|
1002
|
+
if (i.pathname = this.callbackUrlPath, i.search = "", r.searchParams.set("client_id", this.client.client_id), r.searchParams.set("redirect_uri", i.toString()), r.searchParams.set("response_type", "code"), r.searchParams.set("scope", "openid+profile+email"), r.searchParams.set("code_challenge", s), r.searchParams.set(
|
|
856
1003
|
"code_challenge_method",
|
|
857
1004
|
t
|
|
858
|
-
), ((
|
|
859
|
-
const
|
|
860
|
-
|
|
1005
|
+
), ((d = n.code_challenge_methods_supported) == null ? void 0 : d.includes("S256")) !== !0) {
|
|
1006
|
+
const g = Ge();
|
|
1007
|
+
r.searchParams.set("state", g);
|
|
861
1008
|
}
|
|
862
|
-
location.href =
|
|
1009
|
+
location.href = r.href;
|
|
863
1010
|
}
|
|
864
1011
|
async getAccessToken() {
|
|
865
1012
|
const t = await this.getAuthServer();
|
|
866
1013
|
if (!this.tokens)
|
|
867
|
-
throw new
|
|
1014
|
+
throw new P("User is not authenticated");
|
|
868
1015
|
if (this.tokens.expiresOn < /* @__PURE__ */ new Date()) {
|
|
869
1016
|
if (!this.tokens.refreshToken)
|
|
870
|
-
throw new
|
|
1017
|
+
throw new P(
|
|
871
1018
|
"Token expired and no refresh token available"
|
|
872
1019
|
);
|
|
873
|
-
const n = await
|
|
1020
|
+
const n = await dt(
|
|
874
1021
|
t,
|
|
875
1022
|
this.client,
|
|
876
1023
|
this.tokens.refreshToken
|
|
877
|
-
),
|
|
1024
|
+
), o = await ft(
|
|
878
1025
|
t,
|
|
879
1026
|
this.client,
|
|
880
1027
|
n
|
|
881
1028
|
);
|
|
882
|
-
this.setTokensFromResponse(
|
|
1029
|
+
this.setTokensFromResponse(o);
|
|
883
1030
|
}
|
|
884
1031
|
return this.tokens.accessToken;
|
|
885
1032
|
}
|
|
886
1033
|
async logout() {
|
|
887
|
-
|
|
1034
|
+
re.setState({
|
|
888
1035
|
isAuthenticated: !1,
|
|
889
1036
|
isPending: !1,
|
|
890
1037
|
profile: void 0
|
|
891
1038
|
});
|
|
892
1039
|
const t = await this.getAuthServer(), n = new URL(window.location.href);
|
|
893
1040
|
n.pathname = this.logoutRedirectUrlPath;
|
|
894
|
-
let
|
|
895
|
-
t.end_session_endpoint ? (
|
|
1041
|
+
let o;
|
|
1042
|
+
t.end_session_endpoint ? (o = new URL(t.end_session_endpoint), o.searchParams.set(
|
|
896
1043
|
"post_logout_redirect_uri",
|
|
897
1044
|
n.toString()
|
|
898
|
-
)) :
|
|
1045
|
+
)) : o = n;
|
|
899
1046
|
}
|
|
900
1047
|
getRoutes() {
|
|
901
1048
|
return [
|
|
902
1049
|
{
|
|
903
1050
|
path: this.callbackUrlPath,
|
|
904
|
-
element: /* @__PURE__ */
|
|
1051
|
+
element: /* @__PURE__ */ T.jsx(xt, { handleCallback: this.handleCallback })
|
|
905
1052
|
}
|
|
906
1053
|
];
|
|
907
1054
|
}
|
|
908
1055
|
}
|
|
909
|
-
const
|
|
1056
|
+
const Jt = (e) => new Pt(e);
|
|
910
1057
|
export {
|
|
911
|
-
|
|
912
|
-
|
|
1058
|
+
Pt as OpenIDAuthenticationProvider,
|
|
1059
|
+
Jt as default
|
|
913
1060
|
};
|
|
914
1061
|
//# sourceMappingURL=zudoku.auth-openid.js.map
|