@nitrotool/jwt 1.0.1 → 1.0.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/index.d.mts CHANGED
@@ -3,6 +3,7 @@ export { requireApiToken } from './h3/index.mjs';
3
3
  import { H3Event } from 'h3';
4
4
  import './core/index.mjs';
5
5
  import '@tsndr/cloudflare-worker-jwt';
6
+ import 'nitropack/types';
6
7
 
7
8
  declare const requireJwt: <T extends Record<string, any> = {}>(event: H3Event) => Promise<any>;
8
9
 
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { requireApiToken } from './h3/index.js';
3
3
  import { H3Event } from 'h3';
4
4
  import './core/index.js';
5
5
  import '@tsndr/cloudflare-worker-jwt';
6
+ import 'nitropack/types';
6
7
 
7
8
  declare const requireJwt: <T extends Record<string, any> = {}>(event: H3Event) => Promise<any>;
8
9
 
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  export { r as requireJwt } from './shared/jwt.Cd03UmUN.mjs';
2
2
  export { decodeJwt, encodeJwt, verifyJwt } from './runtime/server/index.mjs';
3
3
  export { requireApiToken } from './h3/index.mjs';
4
- export { c as configureJwtRuntime, g as getJwtSecret } from './shared/jwt.Cgq_6NMU.mjs';
4
+ export { c as configureJwtRuntime, g as getJwtSecret } from './shared/jwt.ftBB7-nW.mjs';
5
5
  import './core/index.mjs';
6
6
  import '@tsndr/cloudflare-worker-jwt';
7
7
  import '@nitrotool/errors';
package/dist/module.mjs CHANGED
@@ -3,7 +3,7 @@ import { defineNuxtModule, createResolver, addServerScanDir, addServerPlugin, ad
3
3
  import { consola } from 'consola';
4
4
  import { join } from 'pathe';
5
5
 
6
- const version = "1.0.1";
6
+ const version = "1.0.2";
7
7
 
8
8
  async function getFilesInDirectory(dir) {
9
9
  const files = await fs.promises.readdir(dir);
@@ -1,7 +1,8 @@
1
1
  import { ExtendableJwtPayload } from '../../core/index.mjs';
2
+ import { NitroRuntimeConfig } from 'nitropack/types';
2
3
  import '@tsndr/cloudflare-worker-jwt';
3
4
 
4
- type JwtRuntimeConfig = {
5
+ type JwtRuntimeConfig = NitroRuntimeConfig & {
5
6
  jwtSecret?: string;
6
7
  };
7
8
  declare const configureJwtRuntime: (getter: () => JwtRuntimeConfig) => void;
@@ -11,6 +12,6 @@ declare const encodeJwt: <T extends Record<string, any> = {}>(payload: Extendabl
11
12
  declare const verifyJwt: (token: string) => Promise<any>;
12
13
  declare const decodeJwt: <T extends Record<string, any> = {}>(token: string, opts?: {
13
14
  verify?: boolean;
14
- }) => Promise<any>;
15
+ }) => Promise<ExtendableJwtPayload<T>>;
15
16
 
16
17
  export { ExtendableJwtPayload, configureJwtRuntime, decodeJwt, encodeJwt, getJwtSecret, verifyJwt };
@@ -1,7 +1,8 @@
1
1
  import { ExtendableJwtPayload } from '../../core/index.js';
2
+ import { NitroRuntimeConfig } from 'nitropack/types';
2
3
  import '@tsndr/cloudflare-worker-jwt';
3
4
 
4
- type JwtRuntimeConfig = {
5
+ type JwtRuntimeConfig = NitroRuntimeConfig & {
5
6
  jwtSecret?: string;
6
7
  };
7
8
  declare const configureJwtRuntime: (getter: () => JwtRuntimeConfig) => void;
@@ -11,6 +12,6 @@ declare const encodeJwt: <T extends Record<string, any> = {}>(payload: Extendabl
11
12
  declare const verifyJwt: (token: string) => Promise<any>;
12
13
  declare const decodeJwt: <T extends Record<string, any> = {}>(token: string, opts?: {
13
14
  verify?: boolean;
14
- }) => Promise<any>;
15
+ }) => Promise<ExtendableJwtPayload<T>>;
15
16
 
16
17
  export { ExtendableJwtPayload, configureJwtRuntime, decodeJwt, encodeJwt, getJwtSecret, verifyJwt };
@@ -1,5 +1,5 @@
1
- import { g as getJwtSecret } from '../../shared/jwt.Cgq_6NMU.mjs';
2
- export { c as configureJwtRuntime } from '../../shared/jwt.Cgq_6NMU.mjs';
1
+ import { g as getJwtSecret } from '../../shared/jwt.ftBB7-nW.mjs';
2
+ export { c as configureJwtRuntime } from '../../shared/jwt.ftBB7-nW.mjs';
3
3
  import { encodeJwtRaw, decodeJwtRaw, verifyJwtRaw } from '../../core/index.mjs';
4
4
  import '@tsndr/cloudflare-worker-jwt';
5
5
  import '@nitrotool/errors';
@@ -1,5 +1,5 @@
1
1
  import { defineNitroPlugin, useRuntimeConfig } from 'nitropack/runtime';
2
- import { c as configureJwtRuntime } from '../../../shared/jwt.Cgq_6NMU.mjs';
2
+ import { c as configureJwtRuntime } from '../../../shared/jwt.ftBB7-nW.mjs';
3
3
  import '@tsndr/cloudflare-worker-jwt';
4
4
  import '@nitrotool/errors';
5
5
 
@@ -4,3 +4,4 @@ export { requireApiToken } from '../../../../h3/index.mjs';
4
4
  import 'h3';
5
5
  import '../../../../core/index.mjs';
6
6
  import '@tsndr/cloudflare-worker-jwt';
7
+ import 'nitropack/types';
@@ -4,3 +4,4 @@ export { requireApiToken } from '../../../../h3/index.js';
4
4
  import 'h3';
5
5
  import '../../../../core/index.js';
6
6
  import '@tsndr/cloudflare-worker-jwt';
7
+ import 'nitropack/types';
@@ -1,7 +1,7 @@
1
1
  export { r as requireJwt } from '../../../../shared/jwt.Cd03UmUN.mjs';
2
2
  export { decodeJwt, encodeJwt, verifyJwt } from '../../index.mjs';
3
3
  export { requireApiToken } from '../../../../h3/index.mjs';
4
- export { c as configureJwtRuntime, g as getJwtSecret } from '../../../../shared/jwt.Cgq_6NMU.mjs';
4
+ export { c as configureJwtRuntime, g as getJwtSecret } from '../../../../shared/jwt.ftBB7-nW.mjs';
5
5
  import '../../../../core/index.mjs';
6
6
  import '@tsndr/cloudflare-worker-jwt';
7
7
  import '@nitrotool/errors';
@@ -5,8 +5,6 @@ const configureJwtRuntime = (getter) => {
5
5
  const getJwtSecret = () => {
6
6
  const cfg = getRuntimeConfig();
7
7
  if (cfg?.jwtSecret) return cfg.jwtSecret;
8
- if (process?.env?.NUXT_JWT_SECRET) return process?.env?.NUXT_JWT_SECRET;
9
- if (process?.env?.NITRO_JWT_SECRET) return process?.env?.NITRO_JWT_SECRET;
10
8
  if (process?.env?.JWT_SECRET) return process.env.JWT_SECRET;
11
9
  throw new Error(
12
10
  "jwtSecret is not configured. configure using NUXT_JWT_SECRET or jwt.secret"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitrotool/jwt",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@tsndr/cloudflare-worker-jwt": "^3.2.0",
27
- "@nitrotool/errors": "1.0.1",
27
+ "@nitrotool/errors": "1.0.2",
28
28
  "@nuxt/kit": "latest",
29
29
  "pathe": "^2.0.3",
30
30
  "@nuxt/schema": "^4.2.2",