@krutai/auth 0.1.1 → 0.1.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 +62 -6
- package/dist/index.d.ts +62 -6
- package/dist/index.js +51570 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51564 -11
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -0
- package/dist/react.d.ts +1 -0
- package/dist/react.js +1648 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +1645 -0
- package/dist/react.mjs.map +1 -0
- package/package.json +9 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as better_auth from 'better-auth';
|
|
2
2
|
import { BetterAuthOptions, betterAuth } from 'better-auth';
|
|
3
|
-
export { BetterAuthOptions } from 'better-auth';
|
|
4
|
-
export { ApiKeyValidationError, createApiKeyChecker, validateApiKeyFormat, validateApiKeyWithService } from 'krutai';
|
|
3
|
+
export { BetterAuthOptions, betterAuth } from 'better-auth';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Configuration options for KrutAuth
|
|
@@ -122,15 +121,72 @@ declare class KrutAuth {
|
|
|
122
121
|
getSession(): Promise<better_auth.Auth<better_auth.BetterAuthOptions>>;
|
|
123
122
|
}
|
|
124
123
|
|
|
124
|
+
/**
|
|
125
|
+
* API Key Validation Module
|
|
126
|
+
*
|
|
127
|
+
* Centralized API key validation for @krutai/auth.
|
|
128
|
+
* This is bundled directly into @krutai/auth so no separate `krutai` package install is needed.
|
|
129
|
+
*/
|
|
130
|
+
/**
|
|
131
|
+
* Custom error for API key validation failures
|
|
132
|
+
*/
|
|
133
|
+
declare class ApiKeyValidationError extends Error {
|
|
134
|
+
constructor(message: string);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Validates the format of an API key
|
|
138
|
+
* @param apiKey - The API key to validate
|
|
139
|
+
* @throws {ApiKeyValidationError} If the API key format is invalid
|
|
140
|
+
*/
|
|
141
|
+
declare function validateApiKeyFormat(apiKey: string): void;
|
|
142
|
+
/**
|
|
143
|
+
* Validates an API key with the KrutAI service
|
|
144
|
+
* @param apiKey - The API key to validate
|
|
145
|
+
* @returns Promise that resolves to true if valid, false otherwise
|
|
146
|
+
*/
|
|
147
|
+
declare function validateApiKeyWithService(apiKey: string): Promise<boolean>;
|
|
148
|
+
/**
|
|
149
|
+
* Creates a validated API key checker function
|
|
150
|
+
* @param apiKey - The API key to validate
|
|
151
|
+
* @returns A function that checks if the API key is valid
|
|
152
|
+
*/
|
|
153
|
+
declare function createApiKeyChecker(apiKey: string): {
|
|
154
|
+
/**
|
|
155
|
+
* Validates the API key (cached after first call)
|
|
156
|
+
*/
|
|
157
|
+
validate(): Promise<boolean>;
|
|
158
|
+
/**
|
|
159
|
+
* Resets the validation cache
|
|
160
|
+
*/
|
|
161
|
+
reset(): void;
|
|
162
|
+
};
|
|
163
|
+
|
|
125
164
|
/**
|
|
126
165
|
* @krutai/auth - Authentication package for KrutAI
|
|
127
166
|
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
167
|
+
* Everything is bundled — no need to separately install `krutai` or `better-auth`.
|
|
168
|
+
*
|
|
169
|
+
* @example Server-side (Next.js API route / server component)
|
|
170
|
+
* ```typescript
|
|
171
|
+
* import { betterAuth } from "@krutai/auth";
|
|
172
|
+
*
|
|
173
|
+
* export const auth = betterAuth({ ... });
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @example Client-side (React / Next.js client component)
|
|
177
|
+
* ```typescript
|
|
178
|
+
* import { createAuthClient } from "@krutai/auth/react";
|
|
179
|
+
*
|
|
180
|
+
* export const authClient = createAuthClient({
|
|
181
|
+
* baseURL: process.env.NEXT_PUBLIC_APP_URL ?? "http://localhost:3000",
|
|
182
|
+
* });
|
|
183
|
+
*
|
|
184
|
+
* export const { signIn, signUp, signOut, useSession } = authClient;
|
|
185
|
+
* ```
|
|
130
186
|
*
|
|
131
187
|
* @packageDocumentation
|
|
132
188
|
*/
|
|
133
189
|
|
|
134
|
-
declare const VERSION = "0.1.
|
|
190
|
+
declare const VERSION = "0.1.2";
|
|
135
191
|
|
|
136
|
-
export { type AuthSession, KrutAuth, type KrutAuthConfig, VERSION };
|
|
192
|
+
export { ApiKeyValidationError, type AuthSession, KrutAuth, type KrutAuthConfig, VERSION, createApiKeyChecker, validateApiKeyFormat, validateApiKeyWithService };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as better_auth from 'better-auth';
|
|
2
2
|
import { BetterAuthOptions, betterAuth } from 'better-auth';
|
|
3
|
-
export { BetterAuthOptions } from 'better-auth';
|
|
4
|
-
export { ApiKeyValidationError, createApiKeyChecker, validateApiKeyFormat, validateApiKeyWithService } from 'krutai';
|
|
3
|
+
export { BetterAuthOptions, betterAuth } from 'better-auth';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Configuration options for KrutAuth
|
|
@@ -122,15 +121,72 @@ declare class KrutAuth {
|
|
|
122
121
|
getSession(): Promise<better_auth.Auth<better_auth.BetterAuthOptions>>;
|
|
123
122
|
}
|
|
124
123
|
|
|
124
|
+
/**
|
|
125
|
+
* API Key Validation Module
|
|
126
|
+
*
|
|
127
|
+
* Centralized API key validation for @krutai/auth.
|
|
128
|
+
* This is bundled directly into @krutai/auth so no separate `krutai` package install is needed.
|
|
129
|
+
*/
|
|
130
|
+
/**
|
|
131
|
+
* Custom error for API key validation failures
|
|
132
|
+
*/
|
|
133
|
+
declare class ApiKeyValidationError extends Error {
|
|
134
|
+
constructor(message: string);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Validates the format of an API key
|
|
138
|
+
* @param apiKey - The API key to validate
|
|
139
|
+
* @throws {ApiKeyValidationError} If the API key format is invalid
|
|
140
|
+
*/
|
|
141
|
+
declare function validateApiKeyFormat(apiKey: string): void;
|
|
142
|
+
/**
|
|
143
|
+
* Validates an API key with the KrutAI service
|
|
144
|
+
* @param apiKey - The API key to validate
|
|
145
|
+
* @returns Promise that resolves to true if valid, false otherwise
|
|
146
|
+
*/
|
|
147
|
+
declare function validateApiKeyWithService(apiKey: string): Promise<boolean>;
|
|
148
|
+
/**
|
|
149
|
+
* Creates a validated API key checker function
|
|
150
|
+
* @param apiKey - The API key to validate
|
|
151
|
+
* @returns A function that checks if the API key is valid
|
|
152
|
+
*/
|
|
153
|
+
declare function createApiKeyChecker(apiKey: string): {
|
|
154
|
+
/**
|
|
155
|
+
* Validates the API key (cached after first call)
|
|
156
|
+
*/
|
|
157
|
+
validate(): Promise<boolean>;
|
|
158
|
+
/**
|
|
159
|
+
* Resets the validation cache
|
|
160
|
+
*/
|
|
161
|
+
reset(): void;
|
|
162
|
+
};
|
|
163
|
+
|
|
125
164
|
/**
|
|
126
165
|
* @krutai/auth - Authentication package for KrutAI
|
|
127
166
|
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
167
|
+
* Everything is bundled — no need to separately install `krutai` or `better-auth`.
|
|
168
|
+
*
|
|
169
|
+
* @example Server-side (Next.js API route / server component)
|
|
170
|
+
* ```typescript
|
|
171
|
+
* import { betterAuth } from "@krutai/auth";
|
|
172
|
+
*
|
|
173
|
+
* export const auth = betterAuth({ ... });
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @example Client-side (React / Next.js client component)
|
|
177
|
+
* ```typescript
|
|
178
|
+
* import { createAuthClient } from "@krutai/auth/react";
|
|
179
|
+
*
|
|
180
|
+
* export const authClient = createAuthClient({
|
|
181
|
+
* baseURL: process.env.NEXT_PUBLIC_APP_URL ?? "http://localhost:3000",
|
|
182
|
+
* });
|
|
183
|
+
*
|
|
184
|
+
* export const { signIn, signUp, signOut, useSession } = authClient;
|
|
185
|
+
* ```
|
|
130
186
|
*
|
|
131
187
|
* @packageDocumentation
|
|
132
188
|
*/
|
|
133
189
|
|
|
134
|
-
declare const VERSION = "0.1.
|
|
190
|
+
declare const VERSION = "0.1.2";
|
|
135
191
|
|
|
136
|
-
export { type AuthSession, KrutAuth, type KrutAuthConfig, VERSION };
|
|
192
|
+
export { ApiKeyValidationError, type AuthSession, KrutAuth, type KrutAuthConfig, VERSION, createApiKeyChecker, validateApiKeyFormat, validateApiKeyWithService };
|