@authdog/nextjs-app 0.0.14 → 0.0.16
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/{index.js → index.mjs} +1 -1
- package/dist/{index.server.js → index.server.mjs} +1 -1
- package/package.json +5 -2
- /package/dist/{index.d.ts → index.d.mts} +0 -0
- /package/dist/{index.js.map → index.mjs.map} +0 -0
- /package/dist/{index.server.d.ts → index.server.d.mts} +0 -0
- /package/dist/{index.server.js.map → index.server.mjs.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";import{getPublicKeyPayload as s}from"@authdog/node-commons";var a=e=>new URL(e).searchParams.get("token"),i=e=>{if(!e)throw new Error("Public key is not defined");if(!e.startsWith("pk_"))throw new Error("Invalid public key")},g=async(e,t)=>{i(e);let r=s(e),n=await fetch(`${r?.identityHost}/oidc/${r?.environmentId}/userinfo`,{headers:{authorization:`Bearer ${t}`}});if(!n.ok)throw new Error("Failed to fetch user info");return await n.json()},l={maxAge:60*60*24*7,path:"/",httpOnly:!0};import o,{useEffect as c}from"react";var d=({children:e})=>(c(()=>{let t=new URLSearchParams(window.location.search).get("token");t&&(localStorage.setItem("token",t),window.history.replaceState({},document.title,"/"))},[]),o.createElement(o.Fragment,null,e));export{d as AuthdogProvider,l as browserCookiesOptions,g as fetchUserData,a as getTokenFromUri,i as validatePublicKey};
|
|
2
|
-
//# sourceMappingURL=index.
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use server";import{getPublicKeyPayload as p}from"@authdog/node-commons";import{NextResponse as c}from"next/server";var u=e=>{if(!e)throw new Error("Public key is not defined");if(!e.startsWith("pk_"))throw new Error("Invalid public key");let t=JSON.parse(Buffer.from(e.replace("pk_",""),"base64").toString("utf-8"));return async n=>{let o=c.next(),i={maxAge:60*60*24*7,path:"/",httpOnly:!0},r=new URL(n.nextUrl).searchParams.get("token");if(r){let s=await fetch(`${t.identityHost}/oidc/${t.environmentId}/userinfo`,{headers:{authorization:`Bearer ${r}`}});if(!s.ok)throw new Error("Failed to fetch user info");let a=await s.json();a?.meta?.code===200&&(o.cookies.set({name:`user_session_${t.environmentId}`,value:JSON.stringify(a.user),...i}),o.cookies.set({name:`user_session_hash_${t.environmentId}`,value:r,...i}))}return o}};import{cookies as d}from"next/headers";import{buildSessionKey as f,getPublicKeyPayload as l}from"@authdog/node-commons";var m=async e=>{if(!e)throw new Error("Public key is not defined");let t=l(e);return(await d()).get(f(t?.environmentId))};var b=e=>{if(!e)throw new Error("Public key is not defined");return p(e)};export{b as getServerSidePayloadPublicKey,m as getSessionCookie,u as useAuthMiddleware};
|
|
2
|
-
//# sourceMappingURL=index.server.
|
|
2
|
+
//# sourceMappingURL=index.server.mjs.map
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authdog/nextjs-app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "Authdog Next.js SDK",
|
|
5
|
-
"type": "module",
|
|
6
5
|
"source": "src/index.ts",
|
|
7
6
|
"main": "./dist/index.js",
|
|
8
7
|
"types": "./dist/index.d.ts",
|
|
@@ -10,6 +9,10 @@
|
|
|
10
9
|
".": {
|
|
11
10
|
"types": "./dist/index.d.ts",
|
|
12
11
|
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./dist/index.server": {
|
|
14
|
+
"types": "./dist/index.server.d.ts",
|
|
15
|
+
"import": "./dist/index.server.js"
|
|
13
16
|
}
|
|
14
17
|
},
|
|
15
18
|
"files": [
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|