@vatts/auth 2.2.0-canary.0.1.0 → 2.2.0-canary.0.1.5

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 CHANGED
@@ -1,13 +1,13 @@
1
- Copyright 2026 mfraz
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
1
+ Copyright 2026 mfraz
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
13
  limitations under the License.
package/README.md CHANGED
@@ -1,58 +1,58 @@
1
- <div align="center">
2
- <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mfrazlab/vatts-docs/master/public/logo.png">
4
- <img alt="Vatts.js logo" src="https://raw.githubusercontent.com/mfrazlab/vatts-docs/master/public/logo.png" width="128">
5
- </picture>
6
- <h1>@vatts/auth</h1>
7
-
8
- [![NPM](https://img.shields.io/npm/v/@vatts/auth.svg?style=for-the-badge&labelColor=000000)](https://www.npmjs.com/package/@vatts/auth)
9
- [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg?style=for-the-badge&labelColor=000000)](../../LICENSE)
10
- [![GitHub](https://img.shields.io/badge/GitHub-mfrazlab/vatts.js-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/mfrazlab/vatts.js)
11
- </div>
12
-
13
- ___
14
-
15
- ## Getting Started
16
-
17
- **@vatts/auth** is the official authentication package for the **Vatts.js** framework, providing secure, flexible, and production-ready authentication with JWT, multiple OAuth providers and session management.
18
-
19
- - Secure by default — robust JWT implementation
20
- - Multiple providers — OAuth, credentials, and custom
21
- - Ready for React and Vue — integrated hooks and components
22
- - Strong typing — 100% TypeScript
23
- - Zero configuration — works out-of-the-box
24
- - Production-ready — CSRF protection, and more
25
-
26
- ___
27
-
28
- ## Documentation
29
-
30
- Visit [https://vatts.mfraz.ovh](https://vatts.mfraz.ovh) for full documentation of Vatts.js and its official packages.
31
-
32
- ___
33
-
34
- ## Community
35
-
36
- Join the Vatts.js community on [GitHub Discussions](https://github.com/mfraz/vatts.js) to ask questions, share ideas, and showcase your projects.
37
-
38
- ___
39
-
40
- ## Security
41
-
42
- Vatts.js uses a security-first hybrid architecture in which Node.js coordinates the application layer and a high-performance Go networking engine manages HTTP connections and transport protocols.
43
- By delegating network handling to Go, the platform achieves strong isolation, predictable request processing, and native support for modern transports like HTTP/3 under SSL — all while maintaining consistent security enforcement across environments, including local and non-TLS setups.
44
-
45
- If you believe you have found a security vulnerability in Vatts.js, we encourage you to **responsibly disclose it and NOT open a public issue**.
46
-
47
- To participate in our vulnerability disclosure program, please email [contact@mfraz.ovh](mailto:contact@mfraz.ovh). We will add you to the program and provide further instructions for submitting your report.
48
-
49
- ___
50
-
51
-
52
- ## License
53
-
54
- Copyright 2026 mfraz
55
-
56
- This project is licensed under the [Apache License 2.0](./LICENSE).
57
-
58
- ___
1
+ <div align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mfrazlab/vatts-docs/master/public/logo.png">
4
+ <img alt="Vatts.js logo" src="https://raw.githubusercontent.com/mfrazlab/vatts-docs/master/public/logo.png" width="128">
5
+ </picture>
6
+ <h1>@vatts/auth</h1>
7
+
8
+ [![NPM](https://img.shields.io/npm/v/@vatts/auth.svg?style=for-the-badge&labelColor=000000)](https://www.npmjs.com/package/@vatts/auth)
9
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg?style=for-the-badge&labelColor=000000)](../../LICENSE)
10
+ [![GitHub](https://img.shields.io/badge/GitHub-mfrazlab/vatts.js-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/mfrazlab/vatts.js)
11
+ </div>
12
+
13
+ ___
14
+
15
+ ## Getting Started
16
+
17
+ **@vatts/auth** is the official authentication package for the **Vatts.js** framework, providing secure, flexible, and production-ready authentication with JWT, multiple OAuth providers and session management.
18
+
19
+ - Secure by default — robust JWT implementation
20
+ - Multiple providers — OAuth, credentials, and custom
21
+ - Ready for React and Vue — integrated hooks and components
22
+ - Strong typing — 100% TypeScript
23
+ - Zero configuration — works out-of-the-box
24
+ - Production-ready — CSRF protection, and more
25
+
26
+ ___
27
+
28
+ ## Documentation
29
+
30
+ Visit [https://vatts.mfraz.ovh](https://vatts.mfraz.ovh) for full documentation of Vatts.js and its official packages.
31
+
32
+ ___
33
+
34
+ ## Community
35
+
36
+ Join the Vatts.js community on [GitHub Discussions](https://github.com/mfraz/vatts.js) to ask questions, share ideas, and showcase your projects.
37
+
38
+ ___
39
+
40
+ ## Security
41
+
42
+ Vatts.js uses a security-first hybrid architecture in which Node.js coordinates the application layer and a high-performance Go networking engine manages HTTP connections and transport protocols.
43
+ By delegating network handling to Go, the platform achieves strong isolation, predictable request processing, and native support for modern transports like HTTP/3 under SSL — all while maintaining consistent security enforcement across environments, including local and non-TLS setups.
44
+
45
+ If you believe you have found a security vulnerability in Vatts.js, we encourage you to **responsibly disclose it and NOT open a public issue**.
46
+
47
+ To participate in our vulnerability disclosure program, please email [contact@mfraz.ovh](mailto:contact@mfraz.ovh). We will add you to the program and provide further instructions for submitting your report.
48
+
49
+ ___
50
+
51
+
52
+ ## License
53
+
54
+ Copyright 2026 mfraz
55
+
56
+ This project is licensed under the [Apache License 2.0](./LICENSE).
57
+
58
+ ___
package/dist/routes.js CHANGED
@@ -162,76 +162,76 @@ function handlePopupCallback(req) {
162
162
  const error = url.searchParams.get('error');
163
163
  const provider = url.searchParams.get('provider') || 'unknown';
164
164
  const callbackUrl = url.searchParams.get('callbackUrl') || '/';
165
- const html = `
166
- <!DOCTYPE html>
167
- <html>
168
- <head>
169
- <meta charset="UTF-8">
170
- <title>Authenticating...</title>
171
- <style>
172
- body {
173
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
174
- display: flex;
175
- justify-content: center;
176
- align-items: center;
177
- height: 100vh;
178
- margin: 0;
179
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
180
- color: white;
181
- }
182
- .container {
183
- text-align: center;
184
- }
185
- .spinner {
186
- border: 4px solid rgba(255,255,255,0.3);
187
- border-radius: 50%;
188
- border-top: 4px solid white;
189
- width: 40px;
190
- height: 40px;
191
- animation: spin 1s linear infinite;
192
- margin: 0 auto 20px;
193
- }
194
- @keyframes spin {
195
- 0% { transform: rotate(0deg); }
196
- 100% { transform: rotate(360deg); }
197
- }
198
- h2 {
199
- margin: 0;
200
- font-size: 24px;
201
- }
202
- p {
203
- margin: 10px 0 0;
204
- opacity: 0.9;
205
- }
206
- </style>
207
- </head>
208
- <body>
209
- <div class="container">
210
- <div class="spinner"></div>
211
- <h2>${success ? '✓ Autenticação bem-sucedida' : '✗ Erro na autenticação'}</h2>
212
- <p>${success ? 'Fechando janela...' : (error || 'Algo deu errado')}</p>
213
- </div>
214
- <script>
215
- (function() {
216
- try {
217
- if (window.opener) {
218
- console.log('Enviando mensagem para janela pai:')
219
- window.opener.postMessage({
220
- type: ${success ? "'oauth-success'" : "'oauth-error'"},
221
- provider: "${provider}",
222
- ${success ? `callbackUrl: "${callbackUrl}"` : `error: "${error || 'Authentication failed'}"`}
223
- }, window.location.origin);
224
- }
225
- setTimeout(() => {
226
- window.close();
227
- }, 1000);
228
- } catch (e) {
229
- console.error('Error communicating with parent window:', e);
230
- }
231
- })();
232
- </script>
233
- </body>
234
- </html>
165
+ const html = `
166
+ <!DOCTYPE html>
167
+ <html>
168
+ <head>
169
+ <meta charset="UTF-8">
170
+ <title>Authenticating...</title>
171
+ <style>
172
+ body {
173
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
174
+ display: flex;
175
+ justify-content: center;
176
+ align-items: center;
177
+ height: 100vh;
178
+ margin: 0;
179
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
180
+ color: white;
181
+ }
182
+ .container {
183
+ text-align: center;
184
+ }
185
+ .spinner {
186
+ border: 4px solid rgba(255,255,255,0.3);
187
+ border-radius: 50%;
188
+ border-top: 4px solid white;
189
+ width: 40px;
190
+ height: 40px;
191
+ animation: spin 1s linear infinite;
192
+ margin: 0 auto 20px;
193
+ }
194
+ @keyframes spin {
195
+ 0% { transform: rotate(0deg); }
196
+ 100% { transform: rotate(360deg); }
197
+ }
198
+ h2 {
199
+ margin: 0;
200
+ font-size: 24px;
201
+ }
202
+ p {
203
+ margin: 10px 0 0;
204
+ opacity: 0.9;
205
+ }
206
+ </style>
207
+ </head>
208
+ <body>
209
+ <div class="container">
210
+ <div class="spinner"></div>
211
+ <h2>${success ? '✓ Autenticação bem-sucedida' : '✗ Erro na autenticação'}</h2>
212
+ <p>${success ? 'Fechando janela...' : (error || 'Algo deu errado')}</p>
213
+ </div>
214
+ <script>
215
+ (function() {
216
+ try {
217
+ if (window.opener) {
218
+ console.log('Enviando mensagem para janela pai:')
219
+ window.opener.postMessage({
220
+ type: ${success ? "'oauth-success'" : "'oauth-error'"},
221
+ provider: "${provider}",
222
+ ${success ? `callbackUrl: "${callbackUrl}"` : `error: "${error || 'Authentication failed'}"`}
223
+ }, window.location.origin);
224
+ }
225
+ setTimeout(() => {
226
+ window.close();
227
+ }, 1000);
228
+ } catch (e) {
229
+ console.error('Error communicating with parent window:', e);
230
+ }
231
+ })();
232
+ </script>
233
+ </body>
234
+ </html>
235
235
  `;
236
236
  return vatts_1.VattsResponse.html(html);
237
237
  }
@@ -1,30 +1,30 @@
1
- <script setup>
2
- /**
3
- * This file is part of the Vatts.js Project.
4
- * Copyright (c) 2026 mfraz
5
- */
6
- import { useSessionProviderLogic } from './session';
7
-
8
- // Definição das props com valores padrão (Sintaxe JavaScript)
9
- const props = defineProps({
10
- basePath: {
11
- type: String,
12
- default: '/api/auth'
13
- },
14
- refetchInterval: {
15
- type: Number,
16
- default: 0
17
- },
18
- refetchOnWindowFocus: {
19
- type: Boolean,
20
- default: true
21
- }
22
- });
23
-
24
- // Inicializa a lógica do provider passando as props reativas
25
- useSessionProviderLogic(props);
26
- </script>
27
-
28
- <template>
29
- <slot />
1
+ <script setup>
2
+ /**
3
+ * This file is part of the Vatts.js Project.
4
+ * Copyright (c) 2026 mfraz
5
+ */
6
+ import { useSessionProviderLogic } from './session';
7
+
8
+ // Definição das props com valores padrão (Sintaxe JavaScript)
9
+ const props = defineProps({
10
+ basePath: {
11
+ type: String,
12
+ default: '/api/auth'
13
+ },
14
+ refetchInterval: {
15
+ type: Number,
16
+ default: 0
17
+ },
18
+ refetchOnWindowFocus: {
19
+ type: Boolean,
20
+ default: true
21
+ }
22
+ });
23
+
24
+ // Inicializa a lógica do provider passando as props reativas
25
+ useSessionProviderLogic(props);
26
+ </script>
27
+
28
+ <template>
29
+ <slot />
30
30
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vatts/auth",
3
- "version": "2.2.0-canary.0.1.0",
3
+ "version": "2.2.0-canary.0.1.5",
4
4
  "description": "Authentication package for Vatts.js framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  "react": "^19.2.0",
51
51
  "react-dom": "^19.2.0",
52
52
  "vue": "^3.5.27",
53
- "vatts": "^2.2.0-canary.0.1.0"
53
+ "vatts": "^2.2.0-canary.0.1.5"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "react-dom": {