@meistrari/data-token 0.0.2 → 0.0.4

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/README.md CHANGED
@@ -26,10 +26,12 @@ import { Hono } from 'hono'
26
26
  import { DataTokenContext, createDataTokenMiddleware } from '@meistrari/data-token/hono'
27
27
 
28
28
  // Combine DataTokenContext with your own context type
29
- interface MyContext {
30
- customProp: string
29
+ type Env = {
30
+ Variables: {
31
+ customProp: string
32
+ }
31
33
  }
32
- type AppContext = MyContext & DataTokenContext
34
+ type AppContext = Env & DataTokenContext
33
35
 
34
36
  const app = new Hono<AppContext>()
35
37
  const dataToken = createDataTokenMiddleware('https://some.api.com/well-known/jwks.json')
@@ -1,10 +1,10 @@
1
1
  import type { Context } from 'hono';
2
2
  import type { DataToken } from '../types';
3
- export interface DataTokenContext {
3
+ export type DataTokenContext = {
4
4
  Variables: {
5
5
  authData?: DataToken;
6
6
  };
7
- }
7
+ };
8
8
  /**
9
9
  * Create a data token middleware for Hono
10
10
  * @param url - The URL of the JWKS endpoint
@@ -23,4 +23,4 @@ export interface DataTokenContext {
23
23
  * app.get('/', c => c.json({ data: c.get('authData') }))
24
24
  * ```
25
25
  */
26
- export declare function createDataTokenMiddleware(url: string, skipOnError?: boolean, getToken?: (c: Context) => string): import("hono").MiddlewareHandler<DataTokenContext, string, {}>;
26
+ export declare function createDataTokenMiddleware<Env extends DataTokenContext>(url: string, skipOnError?: boolean, getToken?: (c: Context<Env>) => string): import("hono").MiddlewareHandler<Env, string, {}>;
package/dist/types.d.ts CHANGED
@@ -40,7 +40,7 @@ export declare const DataToken: z.ZodObject<{
40
40
  } | undefined;
41
41
  }>;
42
42
  export type DataToken = z.infer<typeof DataToken>;
43
- export interface ValidatorConfig {
43
+ export type ValidatorConfig = {
44
44
  jwksUrl: string;
45
45
  algorithms?: string[];
46
- }
46
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meistrari/data-token",
3
3
  "type": "module",
4
- "version": "0.0.2",
4
+ "version": "0.0.4",
5
5
  "description": "Internal library to verify and decode the API Gateway data token",
6
6
  "author": "Roz <roz@meistrari.com>",
7
7
  "license": "UNLICENSED",