@donotlb/keypal 0.1.0

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.
@@ -0,0 +1,87 @@
1
+ import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
2
+
3
+ /**
4
+ * Drizzle ORM integration for keypal
5
+ *
6
+ * Provides PostgreSQL storage adapter and schema definitions for API key management.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { DrizzleStore, apikey } from 'keypal/drizzle'
11
+ * import { drizzle } from 'drizzle-orm/node-postgres'
12
+ * import { Pool } from 'pg'
13
+ *
14
+ * const pool = new Pool({ connectionString: process.env.DATABASE_URL })
15
+ * const db = drizzle(pool)
16
+ *
17
+ * const store = new DrizzleStore({ db, table: apikey })
18
+ * ```
19
+ */
20
+ /**
21
+ * Drizzle schema definition for API key storage
22
+ *
23
+ * Table columns:
24
+ * - id: Unique identifier (TEXT PRIMARY KEY)
25
+ * - keyHash: SHA-256 hash of the API key (TEXT, indexed)
26
+ * - metadata: Additional key metadata (JSONB)
27
+ */
28
+ declare const apikey: drizzle_orm_pg_core.PgTableWithColumns<{
29
+ name: "apikey";
30
+ schema: undefined;
31
+ columns: {
32
+ id: drizzle_orm_pg_core.PgColumn<{
33
+ name: "id";
34
+ tableName: "apikey";
35
+ dataType: "string";
36
+ columnType: "PgText";
37
+ data: string;
38
+ driverParam: string;
39
+ notNull: true;
40
+ hasDefault: false;
41
+ isPrimaryKey: true;
42
+ isAutoincrement: false;
43
+ hasRuntimeDefault: false;
44
+ enumValues: [string, ...string[]];
45
+ baseColumn: never;
46
+ identity: undefined;
47
+ generated: undefined;
48
+ }, {}, {}>;
49
+ keyHash: drizzle_orm_pg_core.PgColumn<{
50
+ name: "key_hash";
51
+ tableName: "apikey";
52
+ dataType: "string";
53
+ columnType: "PgText";
54
+ data: string;
55
+ driverParam: string;
56
+ notNull: true;
57
+ hasDefault: false;
58
+ isPrimaryKey: false;
59
+ isAutoincrement: false;
60
+ hasRuntimeDefault: false;
61
+ enumValues: [string, ...string[]];
62
+ baseColumn: never;
63
+ identity: undefined;
64
+ generated: undefined;
65
+ }, {}, {}>;
66
+ metadata: drizzle_orm_pg_core.PgColumn<{
67
+ name: "metadata";
68
+ tableName: "apikey";
69
+ dataType: "json";
70
+ columnType: "PgJsonb";
71
+ data: unknown;
72
+ driverParam: unknown;
73
+ notNull: true;
74
+ hasDefault: false;
75
+ isPrimaryKey: false;
76
+ isAutoincrement: false;
77
+ hasRuntimeDefault: false;
78
+ enumValues: undefined;
79
+ baseColumn: never;
80
+ identity: undefined;
81
+ generated: undefined;
82
+ }, {}, {}>;
83
+ };
84
+ dialect: "pg";
85
+ }>;
86
+
87
+ export { apikey };
@@ -0,0 +1,87 @@
1
+ import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
2
+
3
+ /**
4
+ * Drizzle ORM integration for keypal
5
+ *
6
+ * Provides PostgreSQL storage adapter and schema definitions for API key management.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { DrizzleStore, apikey } from 'keypal/drizzle'
11
+ * import { drizzle } from 'drizzle-orm/node-postgres'
12
+ * import { Pool } from 'pg'
13
+ *
14
+ * const pool = new Pool({ connectionString: process.env.DATABASE_URL })
15
+ * const db = drizzle(pool)
16
+ *
17
+ * const store = new DrizzleStore({ db, table: apikey })
18
+ * ```
19
+ */
20
+ /**
21
+ * Drizzle schema definition for API key storage
22
+ *
23
+ * Table columns:
24
+ * - id: Unique identifier (TEXT PRIMARY KEY)
25
+ * - keyHash: SHA-256 hash of the API key (TEXT, indexed)
26
+ * - metadata: Additional key metadata (JSONB)
27
+ */
28
+ declare const apikey: drizzle_orm_pg_core.PgTableWithColumns<{
29
+ name: "apikey";
30
+ schema: undefined;
31
+ columns: {
32
+ id: drizzle_orm_pg_core.PgColumn<{
33
+ name: "id";
34
+ tableName: "apikey";
35
+ dataType: "string";
36
+ columnType: "PgText";
37
+ data: string;
38
+ driverParam: string;
39
+ notNull: true;
40
+ hasDefault: false;
41
+ isPrimaryKey: true;
42
+ isAutoincrement: false;
43
+ hasRuntimeDefault: false;
44
+ enumValues: [string, ...string[]];
45
+ baseColumn: never;
46
+ identity: undefined;
47
+ generated: undefined;
48
+ }, {}, {}>;
49
+ keyHash: drizzle_orm_pg_core.PgColumn<{
50
+ name: "key_hash";
51
+ tableName: "apikey";
52
+ dataType: "string";
53
+ columnType: "PgText";
54
+ data: string;
55
+ driverParam: string;
56
+ notNull: true;
57
+ hasDefault: false;
58
+ isPrimaryKey: false;
59
+ isAutoincrement: false;
60
+ hasRuntimeDefault: false;
61
+ enumValues: [string, ...string[]];
62
+ baseColumn: never;
63
+ identity: undefined;
64
+ generated: undefined;
65
+ }, {}, {}>;
66
+ metadata: drizzle_orm_pg_core.PgColumn<{
67
+ name: "metadata";
68
+ tableName: "apikey";
69
+ dataType: "json";
70
+ columnType: "PgJsonb";
71
+ data: unknown;
72
+ driverParam: unknown;
73
+ notNull: true;
74
+ hasDefault: false;
75
+ isPrimaryKey: false;
76
+ isAutoincrement: false;
77
+ hasRuntimeDefault: false;
78
+ enumValues: undefined;
79
+ baseColumn: never;
80
+ identity: undefined;
81
+ generated: undefined;
82
+ }, {}, {}>;
83
+ };
84
+ dialect: "pg";
85
+ }>;
86
+
87
+ export { apikey };
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @donotlb/keypal v0.1.0
3
+ * A TypeScript library for secure API key management with cryptographic hashing, expiration, scopes, and pluggable storage
4
+ * © 2026 "donotlb" <donotlb@gmail.com>
5
+ * Released under the MIT License
6
+ * https://github.com/donotlb/keypal#readme
7
+ */import{pgTable as t,jsonb as y,text as e,index as i,unique as k}from"drizzle-orm/pg-core";const n=t("apikey",{id:e().primaryKey().notNull(),keyHash:e("key_hash").notNull(),metadata:y("metadata").notNull()},a=>[i("apikey_key_hash_idx").on(a.keyHash),k("apikey_key_hash_unique").on(a.keyHash)]);export{n as apikey};