{"_id":"@byeto/nuxt-auth-layer","_rev":"3-ec0311dff5d2ad7115a9a333d8f24978","name":"@byeto/nuxt-auth-layer","dist-tags":{"latest":"1.3.1"},"versions":{"1.2.1":{"name":"@byeto/nuxt-auth-layer","version":"1.2.1","_id":"@byeto/nuxt-auth-layer@1.2.1","maintainers":[{"name":"mansour-marzban","email":"marzban.dev@gmail.com"}],"dist":{"shasum":"73860fb209f0bb8e37a1e1fc85f885d782f12264","tarball":"https://registry.npmjs.org/@byeto/nuxt-auth-layer/-/nuxt-auth-layer-1.2.1.tgz","fileCount":40,"integrity":"sha512-s8vFGDL53/9BVhP6PaQiTQlBUUCPwythJU5Q32LB4TUgeD5IxLgWdLrnqZCIF648WrpIWcnrvRsB0g3R8EhQMg==","signatures":[{"sig":"MEUCIQCPw9taDRxSp2xFGdyRtEwJIRtUZ90KiycZEHgjwvKdswIgZWmPeUuzjGtXnJF/TK9sm0HTdyRqBqgxIcpQt88Vlds=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":419948},"main":"./nuxt.config.ts","type":"module","gitHead":"2e5081d675ea4a68f4931680ee3ae5808506e0e2","scripts":{"dev":"nuxi dev .playground","lint":"eslint .","build":"nuxt build .playground","preview":"nuxt preview .playground","generate":"nuxt generate .playground","css:build":"npx @tailwindcss/cli -i ./app/assets/tailwind.css -o ./app/assets/dist.css --minify","css:watch":"npx @tailwindcss/cli -i ./app/assets/tailwind.css -o ./app/assets/dist.css --watch --minify","dev:prepare":"nuxt prepare .playground"},"_npmUser":{"name":"mansour-marzban","email":"marzban.dev@gmail.com"},"_npmVersion":"11.6.2","description":"The Auth Layer provides a comprehensive authentication system for the application, including middleware, composables, and a configurable module for managing login and user sessions.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"axios":"^1.11.0","@nuxtjs/i18n":"^10.0.6","@vueuse/nuxt":"^13.7.0","@vueuse/router":"^13.7.0","@vuelidate/core":"^2.0.3","@tanstack/vue-query":"^5.85.5","@vueuse/integrations":"^13.7.0","@vuelidate/validators":"^2.0.4","@internationalized/date":"^3.8.2","@tanstack/vue-query-devtools":"^5.85.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vue":"latest","nuxt":"^4.0.3","eslint":"^9.33.0","typescript":"^5.9.2","tailwindcss":"^4.1.14","@nuxt/eslint":"latest","@tailwindcss/cli":"^4.1.14","semantic-release":"^25.0.1","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^13.1.1","@semantic-release/github":"^12.0.1","@semantic-release/changelog":"^6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/nuxt-auth-layer_1.2.1_1762156211870_0.03370114401317914","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@byeto/nuxt-auth-layer","version":"1.3.0","_id":"@byeto/nuxt-auth-layer@1.3.0","maintainers":[{"name":"mansour-marzban","email":"marzban.dev@gmail.com"}],"dist":{"shasum":"666dd658ad64015ed457ff40bd4b265c78261ecb","tarball":"https://registry.npmjs.org/@byeto/nuxt-auth-layer/-/nuxt-auth-layer-1.3.0.tgz","fileCount":40,"integrity":"sha512-gZVtZxG0moFWGNbNJWwdgL/7M6RyijJ2hgjKDt307DQNmQ88SMkAGXQbYCJ11ms7SwMWh1lZh9t94kHmrtKONg==","signatures":[{"sig":"MEUCICf6Kj2fcJx32DNgW79dFaV8ahewr5A8Dfvk/llPKK0HAiEAqfBsu7seDmEslayNRoALZ3mBcm4qUs08YZw0/H1hG3U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":418346},"main":"./nuxt.config.ts","type":"module","gitHead":"5704040b20d0e734ceb390d70c6b48065bd2e39b","scripts":{"dev":"nuxi dev .playground","lint":"eslint .","build":"nuxt build .playground","preview":"nuxt preview .playground","generate":"nuxt generate .playground","css:build":"npx @tailwindcss/cli -i ./app/assets/tailwind.css -o ./app/assets/dist.css --minify","css:watch":"npx @tailwindcss/cli -i ./app/assets/tailwind.css -o ./app/assets/dist.css --watch --minify","dev:prepare":"nuxt prepare .playground"},"_npmUser":{"name":"mansour-marzban","email":"marzban.dev@gmail.com"},"_npmVersion":"11.6.2","description":"The Auth Layer provides a comprehensive authentication system for the application, including middleware, composables, and a configurable module for managing login and user sessions.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"axios":"^1.11.0","@nuxtjs/i18n":"^10.0.6","@vueuse/nuxt":"^13.7.0","@vueuse/router":"^13.7.0","@vuelidate/core":"^2.0.3","@tanstack/vue-query":"^5.85.5","@vueuse/integrations":"^13.7.0","@byeto/nuxt-api-layer":"^1.0.0","@vuelidate/validators":"^2.0.4","@byeto/nuxt-utils-layer":"^1.0.0","@internationalized/date":"^3.8.2","@tanstack/vue-query-devtools":"^5.85.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vue":"latest","nuxt":"^4.0.3","eslint":"^9.33.0","typescript":"^5.9.2","tailwindcss":"^4.1.14","@nuxt/eslint":"latest","@tailwindcss/cli":"^4.1.14","semantic-release":"^25.0.1","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^13.1.1","@semantic-release/github":"^12.0.1","@semantic-release/changelog":"^6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/nuxt-auth-layer_1.3.0_1763720005406_0.8035949975717454","host":"s3://npm-registry-packages-npm-production"}},"1.3.1":{"name":"@byeto/nuxt-auth-layer","type":"module","version":"1.3.1","main":"./nuxt.config.ts","publishConfig":{"access":"public"},"scripts":{"dev":"nuxi dev .playground","dev:prepare":"nuxt prepare .playground","build":"nuxt build .playground","generate":"nuxt generate .playground","preview":"nuxt preview .playground","lint":"eslint .","css:watch":"npx @tailwindcss/cli -i ./app/assets/tailwind.css -o ./app/assets/dist.css --watch --minify","css:build":"npx @tailwindcss/cli -i ./app/assets/tailwind.css -o ./app/assets/dist.css --minify"},"devDependencies":{"@nuxt/eslint":"latest","@semantic-release/changelog":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.1","@semantic-release/npm":"^13.1.1","@tailwindcss/cli":"^4.1.14","eslint":"^9.33.0","nuxt":"^4.0.3","semantic-release":"^25.0.1","tailwindcss":"^4.1.14","typescript":"^5.9.2","vue":"latest"},"dependencies":{"@byeto/nuxt-api-layer":"^1.0.0","@byeto/nuxt-utils-layer":"^1.0.0","@internationalized/date":"^3.8.2","@nuxtjs/i18n":"^10.0.6","@tanstack/vue-query":"^5.85.5","@tanstack/vue-query-devtools":"^5.85.5","@vuelidate/core":"^2.0.3","@vuelidate/validators":"^2.0.4","@vueuse/integrations":"^13.7.0","@vueuse/nuxt":"^13.7.0","@vueuse/router":"^13.7.0","axios":"^1.11.0"},"gitHead":"2e6f44afdfe593f646bf5c23cc0d5ef6c055ce14","_id":"@byeto/nuxt-auth-layer@1.3.1","description":"The Auth Layer provides a comprehensive authentication system for the application, including middleware, composables, and a configurable module for managing login and user sessions.","_nodeVersion":"22.21.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-eE5n88RXqBEcUMVDeOn2RgGckwhr1hpD3gfbtN+9Wb4XgunYr6ccVlv1rCGFiRF4l+8KcstJofuZnVpN50HOZg==","shasum":"8e9fb92780864cc5612f55b305c5a0bafd3c4eca","tarball":"https://registry.npmjs.org/@byeto/nuxt-auth-layer/-/nuxt-auth-layer-1.3.1.tgz","fileCount":41,"unpackedSize":418888,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDtpymEVVzUAgKIKKMMzGxlPTtXZxEa46hOmXBA7H6+9QIhAJ4BK8mEOnbyxHZ/5MatgIs7lBECZzM/u0P4rdaKKfbK"}]},"_npmUser":{"name":"mansour-marzban","email":"marzban.dev@gmail.com"},"directories":{},"maintainers":[{"name":"mansour-marzban","email":"marzban.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nuxt-auth-layer_1.3.1_1763911639911_0.5098198188721705"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-03T07:50:11.769Z","modified":"2025-11-23T15:27:20.382Z","1.2.1":"2025-11-03T07:50:12.070Z","1.3.0":"2025-11-21T10:13:25.584Z","1.3.1":"2025-11-23T15:27:20.155Z"},"description":"The Auth Layer provides a comprehensive authentication system for the application, including middleware, composables, and a configurable module for managing login and user sessions.","maintainers":[{"name":"mansour-marzban","email":"marzban.dev@gmail.com"}],"readme":"# Auth Layer Documentation\n\n## Overview\n\nThe Auth Layer provides a comprehensive authentication system for the application, including middleware, composables, and a configurable module for managing login and user sessions.\n\nThis layer also defines **global account types** that can be overridden by the main application:\n\n```ts\ntype AccountProfile = unknown;\ntype UpdateAccountProfile = unknown;\n```\n\nThese types are used internally in the layer for account-related operations but can be redefined in the main app to suit specific needs.\n\nAnd this is the app config options:\n\n```ts\n{\n    authModule?: {\n        unauthorizedEvent?: (error: ApiError) => void;\n    };\n}\n```\n\n---\n\n## Installation\n\n```bash\nnpm i @nuxtjs/i18n @tanstack/vue-query @tanstack/vue-query-devtools @vueuse/integrations @vueuse/nuxt @vueuse/router axios\n```\n\nAdd these layers to extend in nuxt.config.ts ( also check their dependencies ):\n\n`github:Byeto-Company/nuxt-utils-layer` and `github:Byeto-Company/nuxt-api-layer`\n\n---\n\n## Middlewares\n\nThe layer includes the following middlewares:\n\n-   `app/middleware/checkIsLoggedIn.ts`  \n    Ensures the user is logged in. Ideal for protecting routes that require authentication.\n\n-   `app/middleware/checkIsNotLoggedIn.ts`  \n    Ensures the user is not logged in. Useful for routes like login or signup pages.\n\n---\n\n## Module\n\nThe Auth Layer includes a customizable module to configure authentication behavior.\n\n### Module Options\n\n```ts\ntype ModuleOptions = {\n    internalPage: boolean; // Use the internal login page or an external page\n    pagePath: string; // Path to the login page\n    otpCount: number; // Number of digits for OTP login\n    otpTimer: number; // OTP validity period in seconds\n    strategy: \"otp\" | \"credentials\"; // Authentication strategy to use\n    endpoints: {\n        profile: { path: string; name: string };\n        update: { path: string; name: string };\n        refresh: { path: string; name: string };\n        verify: { path: string; name: string };\n        signin: { path: string; name: string };\n        logout: { path: string; name: string };\n        otp: { path: string; name: string };\n        develop_token: { path: string; name: string };\n    };\n};\n```\n\n### Default Options\n\n```ts\n{\n    internalPage: true,\n    pagePath: \"/signin\",\n    otpCount: 6,\n    otpTimer: 60,\n    strategy: \"otp\",\n    endpoints: undefined\n}\n```\n\n### Dynamic Pages\n\nBased on the `internalPage` and `strategy` settings, the module provides dynamic login pages:\n\n-   `modules/auth-module/runtime/templates/credentials-signin.vue`\n-   `modules/auth-module/runtime/templates/otp-signin.vue`\n\n---\n\n## Composables\n\nThe layer provides the following composables for managing authentication flows:\n\n-   `app/composables/useAuth.ts` — Core composable for managing tokens and login state.\n-   `app/composables/useDevelopSignin.ts` — Development helper for signing in users.\n-   `app/composables/useGetAccount.ts` — Fetches the current user's account profile.\n-   `app/composables/useOtp.ts` — Sends OTP requests to users.\n-   `app/composables/useOtpSignIn.ts` — Signs in users using OTP.\n-   `app/composables/useRefreshAuth.ts` — Refreshes authentication tokens.\n-   `app/composables/useServerSideAuthCheck.ts` — Checks authentication during server-side rendering.\n-   `app/composables/useSignOut.ts` — Signs out the current user.\n-   `app/composables/useUpdateAccount.ts` — Updates the current user's account profile.\n-   `app/composables/useVerify.ts` — Verifies access tokens.\n\n---\n\n## Components\n\n-   `app/components/AuthLayerWrapper.vue` — Wrapper for configurations\n\n---\n\nThis layer is designed to provide a consistent, modular, and flexible authentication system for Nuxt applications. Global account types (`AccountProfile` and `UpdateAccountProfile`) are provided with default definitions but can be overridden in the main application to customize account data structures.\n","readmeFilename":"README.md"}