@thunderid/nextjs 0.0.1
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/LICENSE +201 -0
- package/dist/SessionManager-CmqWChPm.js +1384 -0
- package/dist/cache-CxW8LP5j.js +7893 -0
- package/dist/cjs/SessionManager-RFfauUwH.js +1397 -0
- package/dist/cjs/cache-TPlce_OL.js +7896 -0
- package/dist/cjs/dynamic-rendering-L2d7BrDx.js +1540 -0
- package/dist/cjs/getAccessToken-Cse753Fb.js +22 -0
- package/dist/cjs/getSessionId-0NYmTSk-.js +5 -0
- package/dist/cjs/getSessionId-CTcwNOBu.js +28 -0
- package/dist/cjs/index.cjs +1033 -0
- package/dist/cjs/index2.cjs +8 -0
- package/dist/cjs/middleware.cjs +5147 -0
- package/dist/cjs/segment-oJYpzazg.js +52 -0
- package/dist/cjs/server-DhPu4EWA.js +2477 -0
- package/dist/dynamic-rendering-qQ5hSvc6.js +1441 -0
- package/dist/getAccessToken-tip3mkrS.js +22 -0
- package/dist/getSessionId-CgVEEnja.js +23 -0
- package/dist/getSessionId-dhNlHUsz.js +5 -0
- package/dist/index.js +977 -0
- package/dist/index2.js +7 -0
- package/dist/middleware.js +5148 -0
- package/dist/segment-BliKCoQf.js +47 -0
- package/dist/server-BUTC5fQO.js +2433 -0
- package/dist/types/ThunderIDNextClient.d.ts +94 -0
- package/dist/types/ThunderIDNextClient.d.ts.map +1 -0
- package/dist/types/client/components/actions/SignInButton/SignInButton.d.ts +55 -0
- package/dist/types/client/components/actions/SignInButton/SignInButton.d.ts.map +1 -0
- package/dist/types/client/components/actions/SignOutButton/SignOutButton.d.ts +43 -0
- package/dist/types/client/components/actions/SignOutButton/SignOutButton.d.ts.map +1 -0
- package/dist/types/client/components/actions/SignUpButton/SignUpButton.d.ts +67 -0
- package/dist/types/client/components/actions/SignUpButton/SignUpButton.d.ts.map +1 -0
- package/dist/types/client/components/control/Loading/Loading.d.ts +48 -0
- package/dist/types/client/components/control/Loading/Loading.d.ts.map +1 -0
- package/dist/types/client/components/control/SignedIn/SignedIn.d.ts +46 -0
- package/dist/types/client/components/control/SignedIn/SignedIn.d.ts.map +1 -0
- package/dist/types/client/components/control/SignedOut/SignedOut.d.ts +46 -0
- package/dist/types/client/components/control/SignedOut/SignedOut.d.ts.map +1 -0
- package/dist/types/client/components/presentation/CreateOrganization/CreateOrganization.d.ts +68 -0
- package/dist/types/client/components/presentation/CreateOrganization/CreateOrganization.d.ts.map +1 -0
- package/dist/types/client/components/presentation/Organization/Organization.d.ts +67 -0
- package/dist/types/client/components/presentation/Organization/Organization.d.ts.map +1 -0
- package/dist/types/client/components/presentation/OrganizationList/OrganizationList.d.ts +93 -0
- package/dist/types/client/components/presentation/OrganizationList/OrganizationList.d.ts.map +1 -0
- package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +120 -0
- package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts.map +1 -0
- package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +72 -0
- package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts.map +1 -0
- package/dist/types/client/components/presentation/SignIn/SignIn.d.ts +70 -0
- package/dist/types/client/components/presentation/SignIn/SignIn.d.ts.map +1 -0
- package/dist/types/client/components/presentation/SignUp/SignUp.d.ts +56 -0
- package/dist/types/client/components/presentation/SignUp/SignUp.d.ts.map +1 -0
- package/dist/types/client/components/presentation/User/User.d.ts +62 -0
- package/dist/types/client/components/presentation/User/User.d.ts.map +1 -0
- package/dist/types/client/components/presentation/UserDropdown/UserDropdown.d.ts +106 -0
- package/dist/types/client/components/presentation/UserDropdown/UserDropdown.d.ts.map +1 -0
- package/dist/types/client/components/presentation/UserProfile/UserProfile.d.ts +50 -0
- package/dist/types/client/components/presentation/UserProfile/UserProfile.d.ts.map +1 -0
- package/dist/types/client/contexts/ThunderID/ThunderIDContext.d.ts +33 -0
- package/dist/types/client/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -0
- package/dist/types/client/contexts/ThunderID/ThunderIDProvider.d.ts +59 -0
- package/dist/types/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -0
- package/dist/types/client/contexts/ThunderID/useThunderID.d.ts +21 -0
- package/dist/types/client/contexts/ThunderID/useThunderID.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +47 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/configs/InternalAuthAPIRoutesConfig.d.ts +21 -0
- package/dist/types/configs/InternalAuthAPIRoutesConfig.d.ts.map +1 -0
- package/dist/types/constants/sessionConstants.d.ts +49 -0
- package/dist/types/constants/sessionConstants.d.ts.map +1 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/middleware.d.ts +35 -0
- package/dist/types/middleware.d.ts.map +1 -0
- package/dist/types/models/api.d.ts +49 -0
- package/dist/types/models/api.d.ts.map +1 -0
- package/dist/types/models/config.d.ts +31 -0
- package/dist/types/models/config.d.ts.map +1 -0
- package/dist/types/server/ThunderIDProvider.d.ts +58 -0
- package/dist/types/server/ThunderIDProvider.d.ts.map +1 -0
- package/dist/types/server/actions/clearSession.d.ts +40 -0
- package/dist/types/server/actions/clearSession.d.ts.map +1 -0
- package/dist/types/server/actions/createOrganization.d.ts +24 -0
- package/dist/types/server/actions/createOrganization.d.ts.map +1 -0
- package/dist/types/server/actions/getAccessToken.d.ts +25 -0
- package/dist/types/server/actions/getAccessToken.d.ts.map +1 -0
- package/dist/types/server/actions/getAllOrganizations.d.ts +24 -0
- package/dist/types/server/actions/getAllOrganizations.d.ts.map +1 -0
- package/dist/types/server/actions/getBrandingPreference.d.ts +24 -0
- package/dist/types/server/actions/getBrandingPreference.d.ts.map +1 -0
- package/dist/types/server/actions/getClientOrigin.d.ts +20 -0
- package/dist/types/server/actions/getClientOrigin.d.ts.map +1 -0
- package/dist/types/server/actions/getCurrentOrganizationAction.d.ts +31 -0
- package/dist/types/server/actions/getCurrentOrganizationAction.d.ts.map +1 -0
- package/dist/types/server/actions/getMyOrganizations.d.ts +24 -0
- package/dist/types/server/actions/getMyOrganizations.d.ts.map +1 -0
- package/dist/types/server/actions/getOrganizationAction.d.ts +31 -0
- package/dist/types/server/actions/getOrganizationAction.d.ts.map +1 -0
- package/dist/types/server/actions/getSessionId.d.ts +26 -0
- package/dist/types/server/actions/getSessionId.d.ts.map +1 -0
- package/dist/types/server/actions/getSessionPayload.d.ts +27 -0
- package/dist/types/server/actions/getSessionPayload.d.ts.map +1 -0
- package/dist/types/server/actions/getUserAction.d.ts +31 -0
- package/dist/types/server/actions/getUserAction.d.ts.map +1 -0
- package/dist/types/server/actions/getUserProfileAction.d.ts +31 -0
- package/dist/types/server/actions/getUserProfileAction.d.ts.map +1 -0
- package/dist/types/server/actions/handleOAuthCallbackAction.d.ts +34 -0
- package/dist/types/server/actions/handleOAuthCallbackAction.d.ts.map +1 -0
- package/dist/types/server/actions/isSignedIn.d.ts +32 -0
- package/dist/types/server/actions/isSignedIn.d.ts.map +1 -0
- package/dist/types/server/actions/refreshToken.d.ts +45 -0
- package/dist/types/server/actions/refreshToken.d.ts.map +1 -0
- package/dist/types/server/actions/signInAction.d.ts +36 -0
- package/dist/types/server/actions/signInAction.d.ts.map +1 -0
- package/dist/types/server/actions/signOutAction.d.ts +32 -0
- package/dist/types/server/actions/signOutAction.d.ts.map +1 -0
- package/dist/types/server/actions/signUpAction.d.ts +36 -0
- package/dist/types/server/actions/signUpAction.d.ts.map +1 -0
- package/dist/types/server/actions/switchOrganization.d.ts +24 -0
- package/dist/types/server/actions/switchOrganization.d.ts.map +1 -0
- package/dist/types/server/actions/updateUserProfileAction.d.ts +31 -0
- package/dist/types/server/actions/updateUserProfileAction.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +21 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/types/server/middleware/createRouteMatcher.d.ts +40 -0
- package/dist/types/server/middleware/createRouteMatcher.d.ts.map +1 -0
- package/dist/types/server/middleware/thunderIDMiddleware.d.ts +93 -0
- package/dist/types/server/middleware/thunderIDMiddleware.d.ts.map +1 -0
- package/dist/types/server/thunderid.d.ts +27 -0
- package/dist/types/server/thunderid.d.ts.map +1 -0
- package/dist/types/utils/SessionManager.d.ts +115 -0
- package/dist/types/utils/SessionManager.d.ts.map +1 -0
- package/dist/types/utils/createRouteMatcher.d.ts +39 -0
- package/dist/types/utils/createRouteMatcher.d.ts.map +1 -0
- package/dist/types/utils/decorateConfigWithNextEnv.d.ts +21 -0
- package/dist/types/utils/decorateConfigWithNextEnv.d.ts.map +1 -0
- package/dist/types/utils/handleRefreshToken.d.ts +47 -0
- package/dist/types/utils/handleRefreshToken.d.ts.map +1 -0
- package/dist/types/utils/logger.d.ts +20 -0
- package/dist/types/utils/logger.d.ts.map +1 -0
- package/dist/types/utils/sessionUtils.d.ts +51 -0
- package/dist/types/utils/sessionUtils.d.ts.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
19
|
+
import { ThunderIDNextConfig } from '../../models/config';
|
|
20
|
+
import { SessionTokenPayload } from '../../utils/SessionManager';
|
|
21
|
+
export type ThunderIDMiddlewareOptions = Partial<ThunderIDNextConfig>;
|
|
22
|
+
export interface ThunderIDMiddlewareContext {
|
|
23
|
+
/** Get the session payload from JWT session if available */
|
|
24
|
+
getSession: () => Promise<SessionTokenPayload | undefined>;
|
|
25
|
+
/** Get the session ID from the current request */
|
|
26
|
+
getSessionId: () => string | undefined;
|
|
27
|
+
/** Check if the current request has a valid ThunderID session */
|
|
28
|
+
isSignedIn: () => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Protect a route by redirecting unauthenticated users.
|
|
31
|
+
* Redirect URL fallback order:
|
|
32
|
+
* 1. options.redirect
|
|
33
|
+
* 2. resolvedOptions.signInUrl
|
|
34
|
+
* 3. resolvedOptions.defaultRedirect
|
|
35
|
+
* 4. referer (if from same origin)
|
|
36
|
+
* If none are available, falls back to '/'.
|
|
37
|
+
*/
|
|
38
|
+
protectRoute: (routeOptions?: {
|
|
39
|
+
redirect?: string;
|
|
40
|
+
}) => Promise<NextResponse | void>;
|
|
41
|
+
}
|
|
42
|
+
type ThunderIDMiddlewareHandler = (thunderid: ThunderIDMiddlewareContext, req: NextRequest) => Promise<NextResponse | void> | NextResponse | void;
|
|
43
|
+
/**
|
|
44
|
+
* ThunderID middleware that integrates authentication into your Next.js application.
|
|
45
|
+
* Similar to Clerk's clerkMiddleware pattern.
|
|
46
|
+
*
|
|
47
|
+
* Proactively refreshes the access token when it is within REFRESH_BUFFER_SECONDS of
|
|
48
|
+
* expiry so that Server Components always receive a fresh session. The refresh also
|
|
49
|
+
* recovers expired tokens as long as a refresh token is present.
|
|
50
|
+
*
|
|
51
|
+
* The updated session cookie is written to:
|
|
52
|
+
* - The response → browser stores the new cookie for subsequent requests.
|
|
53
|
+
* - The forwarded request headers → the same-request Server Component render sees
|
|
54
|
+
* the fresh token immediately without waiting for the next navigation.
|
|
55
|
+
*
|
|
56
|
+
* Token refresh requires baseUrl, clientId, and clientSecret. These are resolved from
|
|
57
|
+
* the options argument first, then from the standard ThunderID environment variables
|
|
58
|
+
* (NEXT_PUBLIC_ASGARDEO_BASE_URL, NEXT_PUBLIC_ASGARDEO_CLIENT_ID,
|
|
59
|
+
* ASGARDEO_CLIENT_SECRET). If none are available the refresh step is skipped silently.
|
|
60
|
+
*
|
|
61
|
+
* @param handler - Optional handler function to customize middleware behavior
|
|
62
|
+
* @param options - Configuration options for the middleware
|
|
63
|
+
* @returns Next.js middleware function
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* // middleware.ts - Basic usage (config read from env vars automatically)
|
|
68
|
+
* import { thunderIDMiddleware } from '@thunderid/nextjs';
|
|
69
|
+
*
|
|
70
|
+
* export default thunderIDMiddleware();
|
|
71
|
+
*
|
|
72
|
+
* export const config = {
|
|
73
|
+
* matcher: ['/((?!_next/static|_next/image|favicon.ico).*)'],
|
|
74
|
+
* };
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* // With route protection
|
|
80
|
+
* import { thunderIDMiddleware, createRouteMatcher } from '@thunderid/nextjs';
|
|
81
|
+
*
|
|
82
|
+
* const isProtectedRoute = createRouteMatcher(['/dashboard(.*)']);
|
|
83
|
+
*
|
|
84
|
+
* export default thunderIDMiddleware(async (thunderid, req) => {
|
|
85
|
+
* if (isProtectedRoute(req)) {
|
|
86
|
+
* await thunderid.protectRoute();
|
|
87
|
+
* }
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
declare const thunderIDMiddleware: (handler?: ThunderIDMiddlewareHandler, options?: ThunderIDMiddlewareOptions | ((req: NextRequest) => ThunderIDMiddlewareOptions)) => ((request: NextRequest) => Promise<NextResponse>);
|
|
92
|
+
export default thunderIDMiddleware;
|
|
93
|
+
//# sourceMappingURL=thunderIDMiddleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thunderIDMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middleware/thunderIDMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAGxD,OAAuB,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAC;AAG/E,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEtE,MAAM,WAAW,0BAA0B;IACzC,4DAA4D;IAC5D,UAAU,EAAE,MAAM,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;IAC3D,kDAAkD;IAClD,YAAY,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACvC,iEAAiE;IACjE,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B;;;;;;;;OAQG;IACH,YAAY,EAAE,CAAC,YAAY,CAAC,EAAE;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CACpF;AAED,KAAK,0BAA0B,GAAG,CAChC,SAAS,EAAE,0BAA0B,EACrC,GAAG,EAAE,WAAW,KACb,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,YAAY,GAAG,IAAI,CAAC;AA4CxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,QAAA,MAAM,mBAAmB,GAErB,UAAU,0BAA0B,EACpC,UAAU,0BAA0B,GAAG,CAAC,CAAC,GAAG,EAAE,WAAW,KAAK,0BAA0B,CAAC,KACxF,CAAC,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,CAqMlD,CAAC;AAEJ,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { TokenExchangeRequestConfig, TokenResponse } from '@thunderid/node';
|
|
19
|
+
import { ThunderIDNextConfig } from '../models/config';
|
|
20
|
+
declare const thunderid: () => Promise<{
|
|
21
|
+
exchangeToken: (config: TokenExchangeRequestConfig, sessionId: string) => Promise<TokenResponse | Response>;
|
|
22
|
+
getAccessToken: (sessionId: string) => Promise<string>;
|
|
23
|
+
getSessionId: () => Promise<string | undefined>;
|
|
24
|
+
reInitialize: (config: Partial<ThunderIDNextConfig>) => Promise<boolean>;
|
|
25
|
+
}>;
|
|
26
|
+
export default thunderid;
|
|
27
|
+
//# sourceMappingURL=thunderid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thunderid.d.ts","sourceRoot":"","sources":["../../../src/server/thunderid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,0BAA0B,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAGrD,QAAA,MAAM,SAAS,QAAa,OAAO,CAAC;IAClC,aAAa,EAAE,CAAC,MAAM,EAAE,0BAA0B,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,GAAG,QAAQ,CAAC,CAAC;IAC5G,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,YAAY,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAChD,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1E,CA2BA,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { JWTPayload } from 'jose';
|
|
19
|
+
/**
|
|
20
|
+
* Session token payload interface
|
|
21
|
+
*/
|
|
22
|
+
export interface SessionTokenPayload extends JWTPayload {
|
|
23
|
+
/** Expiration timestamp — doubles as the access token expiry (JWT exp == access token exp) */
|
|
24
|
+
exp: number;
|
|
25
|
+
/** Issued at timestamp */
|
|
26
|
+
iat: number;
|
|
27
|
+
/** Organization ID if applicable */
|
|
28
|
+
organizationId?: string;
|
|
29
|
+
/** The refresh token; empty string if not provided by the auth server */
|
|
30
|
+
refreshToken: string;
|
|
31
|
+
/** OAuth scopes */
|
|
32
|
+
scopes: string[];
|
|
33
|
+
/** Session ID */
|
|
34
|
+
sessionId: string;
|
|
35
|
+
/** User ID */
|
|
36
|
+
sub: string;
|
|
37
|
+
/** Token type discriminant — must be 'session' for access-session JWTs */
|
|
38
|
+
type: 'session';
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Session management utility class for JWT-based session cookies
|
|
42
|
+
*/
|
|
43
|
+
declare class SessionManager {
|
|
44
|
+
/**
|
|
45
|
+
* Get the signing secret from environment variable
|
|
46
|
+
* Throws error in production if not set
|
|
47
|
+
*/
|
|
48
|
+
private static getSecret;
|
|
49
|
+
/**
|
|
50
|
+
* Create a temporary session cookie for login initiation
|
|
51
|
+
*/
|
|
52
|
+
static createTempSession(sessionId: string): Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Resolve the session cookie expiry time in seconds.
|
|
55
|
+
*
|
|
56
|
+
* Resolution order (first defined value wins):
|
|
57
|
+
* 1. `configuredExpiry` — value from `ThunderIDNodeConfig.sessionCookieExpiryTime`
|
|
58
|
+
* 2. `ASGARDEO_SESSION_COOKIE_EXPIRY_TIME` environment variable
|
|
59
|
+
* 3. `DEFAULT_SESSION_COOKIE_EXPIRY_TIME` (24 hours)
|
|
60
|
+
*/
|
|
61
|
+
static resolveSessionCookieExpiry(configuredExpiry?: number): number;
|
|
62
|
+
static createSessionToken(accessToken: string, userId: string, sessionId: string, scopes: string, accessTokenTtlSeconds: number, refreshToken: string, organizationId?: string): Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Verify and decode a session token
|
|
65
|
+
*/
|
|
66
|
+
static verifySessionToken(token: string): Promise<SessionTokenPayload>;
|
|
67
|
+
/**
|
|
68
|
+
* Verify a session token for refresh. Validates the HMAC signature and the
|
|
69
|
+
* `type === 'session'` discriminant but intentionally skips the `exp` check
|
|
70
|
+
* so an expired access token can still be exchanged for a new one.
|
|
71
|
+
*
|
|
72
|
+
* Session lifetime is still bounded — the cookie's `maxAge` is set from
|
|
73
|
+
* `sessionCookieExpiryTime`, so the browser drops an over-age session regardless
|
|
74
|
+
* of the access-token exp embedded in the JWT.
|
|
75
|
+
*
|
|
76
|
+
* Never use the returned payload for authorization.
|
|
77
|
+
*/
|
|
78
|
+
static verifySessionTokenForRefresh(token: string): Promise<SessionTokenPayload>;
|
|
79
|
+
/**
|
|
80
|
+
* Verify and decode a temporary session token
|
|
81
|
+
*/
|
|
82
|
+
static verifyTempSession(token: string): Promise<{
|
|
83
|
+
sessionId: string;
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* Get session cookie options
|
|
87
|
+
*/
|
|
88
|
+
static getSessionCookieOptions(maxAge: number): {
|
|
89
|
+
httpOnly: boolean;
|
|
90
|
+
maxAge: number;
|
|
91
|
+
path: string;
|
|
92
|
+
sameSite: 'lax';
|
|
93
|
+
secure: boolean;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Get temporary session cookie options
|
|
97
|
+
*/
|
|
98
|
+
static getTempSessionCookieOptions(): {
|
|
99
|
+
httpOnly: boolean;
|
|
100
|
+
maxAge: number;
|
|
101
|
+
path: string;
|
|
102
|
+
sameSite: 'lax';
|
|
103
|
+
secure: boolean;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Get session cookie name
|
|
107
|
+
*/
|
|
108
|
+
static getSessionCookieName(): string;
|
|
109
|
+
/**
|
|
110
|
+
* Get temporary session cookie name
|
|
111
|
+
*/
|
|
112
|
+
static getTempSessionCookieName(): string;
|
|
113
|
+
}
|
|
114
|
+
export default SessionManager;
|
|
115
|
+
//# sourceMappingURL=SessionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionManager.d.ts","sourceRoot":"","sources":["../../../src/utils/SessionManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAoC,UAAU,EAAC,MAAM,MAAM,CAAC;AAGnE;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,8FAA8F;IAC9F,GAAG,EAAE,MAAM,CAAC;IACZ,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;GAEG;AACH,cAAM,cAAc;IAClB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS;IAqBxB;;OAEG;WACU,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAelE;;;;;;;OAOG;IACH,MAAM,CAAC,0BAA0B,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;WAkBvD,kBAAkB,CAC7B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,qBAAqB,EAAE,MAAM,EAC7B,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,CAAC;IAoBlB;;OAEG;WACU,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAoB5E;;;;;;;;;;OAUG;WACU,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAqBtF;;OAEG;WACU,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAC,CAAC;IAoB3E;;OAEG;IACH,MAAM,CAAC,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG;QAC9C,QAAQ,EAAE,OAAO,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,KAAK,CAAC;QAChB,MAAM,EAAE,OAAO,CAAC;KACjB;IAUD;;OAEG;IACH,MAAM,CAAC,2BAA2B,IAAI;QACpC,QAAQ,EAAE,OAAO,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,KAAK,CAAC;QAChB,MAAM,EAAE,OAAO,CAAC;KACjB;IAUD;;OAEG;IACH,MAAM,CAAC,oBAAoB,IAAI,MAAM;IAIrC;;OAEG;IACH,MAAM,CAAC,wBAAwB,IAAI,MAAM;CAG1C;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { NextRequest } from 'next/server';
|
|
19
|
+
/**
|
|
20
|
+
* Creates a route matcher function that tests if a request matches any of the given patterns.
|
|
21
|
+
*
|
|
22
|
+
* @param patterns - Array of route patterns to match. Supports glob-like patterns.
|
|
23
|
+
* @returns Function that tests if a request matches any of the patterns
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const isProtectedRoute = createRouteMatcher([
|
|
28
|
+
* '/dashboard(.*)',
|
|
29
|
+
* '/admin(.*)',
|
|
30
|
+
* '/profile'
|
|
31
|
+
* ]);
|
|
32
|
+
*
|
|
33
|
+
* if (isProtectedRoute(req)) {
|
|
34
|
+
* // Route is protected
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare const createRouteMatcher: (patterns: string[]) => ((req: NextRequest) => boolean);
|
|
39
|
+
//# sourceMappingURL=createRouteMatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRouteMatcher.d.ts","sourceRoot":"","sources":["../../../src/utils/createRouteMatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,EAAE,KAAG,CAAC,CAAC,GAAG,EAAE,WAAW,KAAK,OAAO,CAerF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { ThunderIDNextConfig } from '../models/config';
|
|
19
|
+
declare const decorateConfigWithNextEnv: (config: ThunderIDNextConfig) => ThunderIDNextConfig;
|
|
20
|
+
export default decorateConfigWithNextEnv;
|
|
21
|
+
//# sourceMappingURL=decorateConfigWithNextEnv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorateConfigWithNextEnv.d.ts","sourceRoot":"","sources":["../../../src/utils/decorateConfigWithNextEnv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAErD,QAAA,MAAM,yBAAyB,GAAI,QAAQ,mBAAmB,KAAG,mBAkChE,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import type { TokenResponse } from '@thunderid/node';
|
|
19
|
+
import { SessionTokenPayload } from './SessionManager';
|
|
20
|
+
/**
|
|
21
|
+
* Config required to call the token endpoint.
|
|
22
|
+
*/
|
|
23
|
+
export interface HandleRefreshTokenConfig {
|
|
24
|
+
baseUrl: string;
|
|
25
|
+
clientId: string;
|
|
26
|
+
clientSecret: string;
|
|
27
|
+
sessionCookieExpiryTime?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Result returned by handleRefreshToken.
|
|
31
|
+
* Callers are responsible for persisting newSessionToken in the appropriate cookie context.
|
|
32
|
+
*/
|
|
33
|
+
export interface HandleRefreshTokenResult {
|
|
34
|
+
newSessionToken: string;
|
|
35
|
+
sessionCookieExpiryTime: number;
|
|
36
|
+
tokenResponse: TokenResponse;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Handles the OAuth refresh_token grant and builds a new session JWT string.
|
|
40
|
+
*
|
|
41
|
+
* Intentionally decoupled from cookie APIs so it can be called from both the Edge
|
|
42
|
+
* Runtime (Next.js middleware) and the Node.js Runtime (server actions).
|
|
43
|
+
* Cookie persistence is the caller's responsibility.
|
|
44
|
+
*/
|
|
45
|
+
declare const handleRefreshToken: (sessionPayload: SessionTokenPayload, config: HandleRefreshTokenConfig) => Promise<HandleRefreshTokenResult>;
|
|
46
|
+
export default handleRefreshToken;
|
|
47
|
+
//# sourceMappingURL=handleRefreshToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleRefreshToken.d.ts","sourceRoot":"","sources":["../../../src/utils/handleRefreshToken.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAuB,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,QAAA,MAAM,kBAAkB,GACtB,gBAAgB,mBAAmB,EACnC,QAAQ,wBAAwB,KAC/B,OAAO,CAAC,wBAAwB,CA2ElC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
declare const logger: any;
|
|
19
|
+
export default logger;
|
|
20
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,QAAA,MAAM,MAAM,EAAE,GAEZ,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { NextRequest } from 'next/server';
|
|
19
|
+
import { SessionTokenPayload } from './SessionManager';
|
|
20
|
+
/**
|
|
21
|
+
* Checks if a request has a valid session cookie (JWT).
|
|
22
|
+
* This verifies the JWT signature and expiration.
|
|
23
|
+
*
|
|
24
|
+
* @param request - The Next.js request object
|
|
25
|
+
* @returns True if a valid session exists, false otherwise
|
|
26
|
+
*/
|
|
27
|
+
export declare const hasValidSession: (request: NextRequest) => Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the session payload from the request cookies.
|
|
30
|
+
* This includes user ID, session ID, and scopes.
|
|
31
|
+
*
|
|
32
|
+
* @param request - The Next.js request object
|
|
33
|
+
* @returns The session payload if valid, undefined otherwise
|
|
34
|
+
*/
|
|
35
|
+
export declare const getSessionFromRequest: (request: NextRequest) => Promise<SessionTokenPayload | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the session ID from the request cookies (legacy support).
|
|
38
|
+
* First tries to get from JWT session, then falls back to legacy session ID cookie.
|
|
39
|
+
*
|
|
40
|
+
* @param request - The Next.js request object
|
|
41
|
+
* @returns The session ID if it exists, undefined otherwise
|
|
42
|
+
*/
|
|
43
|
+
export declare const getSessionIdFromRequest: (request: NextRequest) => Promise<string | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* Gets the temporary session ID from request cookies.
|
|
46
|
+
*
|
|
47
|
+
* @param request - The Next.js request object
|
|
48
|
+
* @returns The temporary session ID if valid, undefined otherwise
|
|
49
|
+
*/
|
|
50
|
+
export declare const getTempSessionFromRequest: (request: NextRequest) => Promise<string | undefined>;
|
|
51
|
+
//# sourceMappingURL=sessionUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/sessionUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AACxC,OAAuB,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAU,SAAS,WAAW,KAAG,OAAO,CAAC,OAAO,CAY3E,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAAU,SAAS,WAAW,KAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAWzG,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,GAAU,SAAS,WAAW,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAY9F,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GAAU,SAAS,WAAW,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAYhG,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thunderid/nextjs",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Next.js SDK for ThunderID",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"thunderid",
|
|
7
|
+
"next.js",
|
|
8
|
+
"react",
|
|
9
|
+
"ssr"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/thunder-id/thunderid/tree/main/packages/next#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/thunder-id/thunderid/issues"
|
|
14
|
+
},
|
|
15
|
+
"author": "WSO2",
|
|
16
|
+
"license": "Apache-2.0",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "dist/cjs/index.cjs",
|
|
19
|
+
"module": "dist/index.js",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/cjs/index.cjs"
|
|
25
|
+
},
|
|
26
|
+
"./server": {
|
|
27
|
+
"types": "./dist/server/index.d.ts",
|
|
28
|
+
"import": "./dist/server/index.js",
|
|
29
|
+
"require": "./dist/cjs/server/index.cjs"
|
|
30
|
+
},
|
|
31
|
+
"./middleware": {
|
|
32
|
+
"types": "./dist/middleware.d.ts",
|
|
33
|
+
"edge-light": "./dist/middleware.js",
|
|
34
|
+
"import": "./dist/middleware.js",
|
|
35
|
+
"require": "./dist/cjs/middleware.cjs"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
],
|
|
43
|
+
"types": "dist/index.d.ts",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/thunder-id/thunderid",
|
|
47
|
+
"directory": "packages/next"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@types/react": "19.2.14",
|
|
51
|
+
"jose": "5.2.0",
|
|
52
|
+
"tslib": "2.8.1",
|
|
53
|
+
"@thunderid/node": "^0.0.0",
|
|
54
|
+
"@thunderid/react": "^0.0.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@types/node": "24.7.2",
|
|
58
|
+
"eslint": "9.39.4",
|
|
59
|
+
"next": "15.5.18",
|
|
60
|
+
"prettier": "3.6.2",
|
|
61
|
+
"react": "19.2.3",
|
|
62
|
+
"rimraf": "6.1.3",
|
|
63
|
+
"rolldown": "1.0.0-beta.45",
|
|
64
|
+
"typescript": "5.9.3",
|
|
65
|
+
"vitest": "4.1.3",
|
|
66
|
+
"@thunderid/eslint-plugin": "^0.0.0",
|
|
67
|
+
"@thunderid/prettier-config": "^0.0.0"
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"next": ">=15.5.18",
|
|
71
|
+
"react": ">=16.8.0"
|
|
72
|
+
},
|
|
73
|
+
"publishConfig": {
|
|
74
|
+
"access": "public"
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "pnpm clean && rolldown -c rolldown.config.js && tsc -p tsconfig.lib.json --emitDeclarationOnly --outDir dist",
|
|
78
|
+
"clean": "rimraf dist",
|
|
79
|
+
"format:check": "prettier --check --cache .",
|
|
80
|
+
"format:fix": "prettier --write --cache .",
|
|
81
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
|
|
82
|
+
"lint:fix": "eslint . --fix --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
|
|
83
|
+
"test": "vitest"
|
|
84
|
+
}
|
|
85
|
+
}
|