@_mustachio/openauth 0.9.0 → 0.9.2
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/esm/ui/passkey.js +4 -4
- package/dist/types/issuer.d.ts +17 -4
- package/dist/types/issuer.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/issuer.ts +17 -4
- package/src/ui/passkey.tsx +4 -4
package/dist/esm/ui/passkey.js
CHANGED
|
@@ -52,7 +52,7 @@ window.addEventListener("load", async () => {
|
|
|
52
52
|
// GET registration options from the endpoint that calls
|
|
53
53
|
// @simplewebauthn/server -> generateRegistrationOptions()
|
|
54
54
|
const resp = await fetch(
|
|
55
|
-
"
|
|
55
|
+
"authenticate-options?userId=" + email + "&rpID=" + rpID
|
|
56
56
|
);
|
|
57
57
|
|
|
58
58
|
const optionsJSON = await resp.json();
|
|
@@ -71,7 +71,7 @@ window.addEventListener("load", async () => {
|
|
|
71
71
|
throw error;
|
|
72
72
|
}
|
|
73
73
|
const verificationResp = await fetch(
|
|
74
|
-
"
|
|
74
|
+
"authenticate-verify?userId=" +
|
|
75
75
|
email +
|
|
76
76
|
"&rpID=" +
|
|
77
77
|
rpID +
|
|
@@ -184,7 +184,7 @@ window.addEventListener("load", async () => {
|
|
|
184
184
|
// GET registration options from the endpoint that calls
|
|
185
185
|
// @simplewebauthn/server -> generateRegistrationOptions()
|
|
186
186
|
const resp = await fetch(
|
|
187
|
-
"
|
|
187
|
+
"register-request?userId=" +
|
|
188
188
|
email +
|
|
189
189
|
"&origin=" +
|
|
190
190
|
origin +
|
|
@@ -214,7 +214,7 @@ window.addEventListener("load", async () => {
|
|
|
214
214
|
// @simplewebauthn/server -> verifyRegistrationResponse()
|
|
215
215
|
try {
|
|
216
216
|
const verificationResp = await fetch(
|
|
217
|
-
"
|
|
217
|
+
"register-verify?userId=" +
|
|
218
218
|
email +
|
|
219
219
|
"&origin=" +
|
|
220
220
|
origin +
|
package/dist/types/issuer.d.ts
CHANGED
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
*
|
|
114
114
|
* For complex multi-tenant scenarios, OpenAuth provides three additional configuration options:
|
|
115
115
|
*
|
|
116
|
-
* - **`basePath`** - Dynamic URL prefix when the issuer is mounted at a variable path
|
|
116
|
+
* - **`basePath`** - Dynamic URL prefix for both incoming routing and outgoing URLs when the issuer is mounted at a variable path
|
|
117
117
|
* - **`cookies.path`** - Set to `"/"` so cookies work across all paths
|
|
118
118
|
* - **`context`** - Extract custom data from requests, available in providers and callbacks
|
|
119
119
|
*
|
|
@@ -566,11 +566,24 @@ export interface IssuerInput<Providers extends Record<string, Provider<any>>, Su
|
|
|
566
566
|
* Base path for all routes. Can be a static string or a function that
|
|
567
567
|
* receives the request and returns the path.
|
|
568
568
|
*
|
|
569
|
+
* When set, OpenAuth will:
|
|
570
|
+
* 1. **Strip the basePath from incoming requests** for internal routing
|
|
571
|
+
* 2. **Prepend the basePath to outgoing URLs** (redirects, metadata endpoints)
|
|
572
|
+
*
|
|
573
|
+
* This enables clean integration when mounting the issuer at dynamic paths:
|
|
574
|
+
*
|
|
569
575
|
* @example
|
|
570
576
|
* ```ts
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
*
|
|
577
|
+
* const auth = issuer({
|
|
578
|
+
* basePath: (req) => `/auth/${req.headers.get("x-org-slug")}`,
|
|
579
|
+
* // ...
|
|
580
|
+
* })
|
|
581
|
+
*
|
|
582
|
+
* // Mount at dynamic path - no manual URL rewriting needed
|
|
583
|
+
* app.all("/auth/:orgSlug/*", (c) => {
|
|
584
|
+
* c.req.raw.headers.set("x-org-slug", c.req.param("orgSlug"))
|
|
585
|
+
* return auth.fetch(c.req.raw)
|
|
586
|
+
* })
|
|
574
587
|
* ```
|
|
575
588
|
*/
|
|
576
589
|
basePath?: string | ((req: Request) => string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issuer.d.ts","sourceRoot":"","sources":["../../src/issuer.ts"],"names":[],"mappings":"A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Q,SAAS,aAAa,EAC9B,cAAc,GAAG,SAAS,EAC1B,MAAM,GAAG;KACN,GAAG,IAAI,MAAM,SAAS,GAAG,QAAQ,CAChC;QACE,QAAQ,EAAE,GAAG,CAAA;QACb,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,OAAO,EAAE,cAAc,CAAA;KACxB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CACxD;CACF,CAAC,MAAM,SAAS,CAAC,EAClB,KAAK,EAAE,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,CAAC;eAwSlD;QACT,aAAa,EAAE,kBAAkB,CAAA;QACjC,QAAQ,EAAE,MAAM,CAAA;QAChB,cAAc,EAAE,cAAc,CAAA;KAC/B;+CA0qBJ"}
|
package/package.json
CHANGED
package/src/issuer.ts
CHANGED
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
*
|
|
114
114
|
* For complex multi-tenant scenarios, OpenAuth provides three additional configuration options:
|
|
115
115
|
*
|
|
116
|
-
* - **`basePath`** - Dynamic URL prefix when the issuer is mounted at a variable path
|
|
116
|
+
* - **`basePath`** - Dynamic URL prefix for both incoming routing and outgoing URLs when the issuer is mounted at a variable path
|
|
117
117
|
* - **`cookies.path`** - Set to `"/"` so cookies work across all paths
|
|
118
118
|
* - **`context`** - Extract custom data from requests, available in providers and callbacks
|
|
119
119
|
*
|
|
@@ -604,11 +604,24 @@ export interface IssuerInput<
|
|
|
604
604
|
* Base path for all routes. Can be a static string or a function that
|
|
605
605
|
* receives the request and returns the path.
|
|
606
606
|
*
|
|
607
|
+
* When set, OpenAuth will:
|
|
608
|
+
* 1. **Strip the basePath from incoming requests** for internal routing
|
|
609
|
+
* 2. **Prepend the basePath to outgoing URLs** (redirects, metadata endpoints)
|
|
610
|
+
*
|
|
611
|
+
* This enables clean integration when mounting the issuer at dynamic paths:
|
|
612
|
+
*
|
|
607
613
|
* @example
|
|
608
614
|
* ```ts
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
*
|
|
615
|
+
* const auth = issuer({
|
|
616
|
+
* basePath: (req) => `/auth/${req.headers.get("x-org-slug")}`,
|
|
617
|
+
* // ...
|
|
618
|
+
* })
|
|
619
|
+
*
|
|
620
|
+
* // Mount at dynamic path - no manual URL rewriting needed
|
|
621
|
+
* app.all("/auth/:orgSlug/*", (c) => {
|
|
622
|
+
* c.req.raw.headers.set("x-org-slug", c.req.param("orgSlug"))
|
|
623
|
+
* return auth.fetch(c.req.raw)
|
|
624
|
+
* })
|
|
612
625
|
* ```
|
|
613
626
|
*/
|
|
614
627
|
basePath?: string | ((req: Request) => string)
|
package/src/ui/passkey.tsx
CHANGED
|
@@ -81,7 +81,7 @@ window.addEventListener("load", async () => {
|
|
|
81
81
|
// GET registration options from the endpoint that calls
|
|
82
82
|
// @simplewebauthn/server -> generateRegistrationOptions()
|
|
83
83
|
const resp = await fetch(
|
|
84
|
-
"
|
|
84
|
+
"authenticate-options?userId=" + email + "&rpID=" + rpID
|
|
85
85
|
);
|
|
86
86
|
|
|
87
87
|
const optionsJSON = await resp.json();
|
|
@@ -100,7 +100,7 @@ window.addEventListener("load", async () => {
|
|
|
100
100
|
throw error;
|
|
101
101
|
}
|
|
102
102
|
const verificationResp = await fetch(
|
|
103
|
-
"
|
|
103
|
+
"authenticate-verify?userId=" +
|
|
104
104
|
email +
|
|
105
105
|
"&rpID=" +
|
|
106
106
|
rpID +
|
|
@@ -197,7 +197,7 @@ window.addEventListener("load", async () => {
|
|
|
197
197
|
// GET registration options from the endpoint that calls
|
|
198
198
|
// @simplewebauthn/server -> generateRegistrationOptions()
|
|
199
199
|
const resp = await fetch(
|
|
200
|
-
"
|
|
200
|
+
"register-request?userId=" +
|
|
201
201
|
email +
|
|
202
202
|
"&origin=" +
|
|
203
203
|
origin +
|
|
@@ -227,7 +227,7 @@ window.addEventListener("load", async () => {
|
|
|
227
227
|
// @simplewebauthn/server -> verifyRegistrationResponse()
|
|
228
228
|
try {
|
|
229
229
|
const verificationResp = await fetch(
|
|
230
|
-
"
|
|
230
|
+
"register-verify?userId=" +
|
|
231
231
|
email +
|
|
232
232
|
"&origin=" +
|
|
233
233
|
origin +
|