@auth-gate/core 0.2.0 → 0.4.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.
package/README.md CHANGED
@@ -17,7 +17,6 @@ const client = createAuthGateClient({
17
17
  apiKey: process.env.AUTHGATE_API_KEY!,
18
18
  projectId: process.env.AUTHGATE_PROJECT_ID!,
19
19
  baseUrl: "https://authgate.dev", // or your self-hosted instance
20
- sessionSecret: process.env.SESSION_SECRET!, // min 32 characters
21
20
  });
22
21
  ```
23
22
 
@@ -148,7 +147,6 @@ client.getNonceCookieOptions();
148
147
  | `apiKey` | `string` | Yes | Your AuthGate API key |
149
148
  | `projectId` | `string` | Yes | Your AuthGate project ID |
150
149
  | `baseUrl` | `string` | Yes | AuthGate instance URL |
151
- | `sessionSecret` | `string` | Yes | Encryption secret (min 32 chars) |
152
150
  | `cookieName` | `string` | No | Session cookie name (default: `__authgate`) |
153
151
  | `sessionMaxAge` | `number` | No | Session TTL in seconds (default: `604800` / 7 days) |
154
152
  | `callbackPath` | `string` | No | OAuth callback path (default: `/api/auth/callback`) |
package/dist/index.cjs CHANGED
@@ -301,17 +301,11 @@ var InvalidStateError = class extends AuthGateError {
301
301
  var AuthGateClient = class {
302
302
  /**
303
303
  * @param config - Client configuration. See {@link AuthGateConfig}.
304
- * @throws {@link AuthGateError} if `sessionSecret` is shorter than 32 characters.
305
304
  */
306
305
  constructor(config) {
307
306
  this.encryptionKey = null;
308
307
  this.stateKey = null;
309
308
  var _a, _b, _c;
310
- if (!config.sessionSecret || config.sessionSecret.length < 32) {
311
- throw new AuthGateError(
312
- "sessionSecret must be at least 32 characters long"
313
- );
314
- }
315
309
  this.config = __spreadProps(__spreadValues({}, config), {
316
310
  cookieName: (_a = config.cookieName) != null ? _a : DEFAULT_COOKIE_NAME,
317
311
  sessionMaxAge: (_b = config.sessionMaxAge) != null ? _b : SESSION_MAX_AGE,
@@ -321,8 +315,8 @@ var AuthGateClient = class {
321
315
  }
322
316
  async deriveKeys() {
323
317
  const [encKey, stKey] = await Promise.all([
324
- deriveEncryptionKey(this.config.sessionSecret),
325
- deriveStateKey(this.config.sessionSecret)
318
+ deriveEncryptionKey(this.config.apiKey),
319
+ deriveStateKey(this.config.apiKey)
326
320
  ]);
327
321
  this.encryptionKey = encKey;
328
322
  this.stateKey = stKey;
package/dist/index.d.cts CHANGED
@@ -49,7 +49,6 @@ interface TokenVerifyResult {
49
49
  * apiKey: process.env.AUTHGATE_API_KEY!,
50
50
  * projectId: process.env.AUTHGATE_PROJECT_ID!,
51
51
  * baseUrl: "https://authgate.dev",
52
- * sessionSecret: process.env.SESSION_SECRET!, // min 32 chars
53
52
  * });
54
53
  * ```
55
54
  */
@@ -60,11 +59,6 @@ interface AuthGateConfig {
60
59
  projectId: string;
61
60
  /** Base URL of the AuthGate service (e.g. `"https://authgate.dev"`). */
62
61
  baseUrl: string;
63
- /**
64
- * Secret used to derive encryption keys for session cookies and OAuth state.
65
- * Must be at least 32 characters. Use a cryptographically random string.
66
- */
67
- sessionSecret: string;
68
62
  /**
69
63
  * Name of the session cookie.
70
64
  * @defaultValue `"__authgate"`
@@ -180,7 +174,6 @@ interface BackupCodesResponse {
180
174
  * apiKey: process.env.AUTHGATE_API_KEY!,
181
175
  * projectId: process.env.AUTHGATE_PROJECT_ID!,
182
176
  * baseUrl: "https://authgate.dev",
183
- * sessionSecret: process.env.SESSION_SECRET!,
184
177
  * });
185
178
  * ```
186
179
  */
@@ -191,7 +184,6 @@ declare class AuthGateClient {
191
184
  private keysReady;
192
185
  /**
193
186
  * @param config - Client configuration. See {@link AuthGateConfig}.
194
- * @throws {@link AuthGateError} if `sessionSecret` is shorter than 32 characters.
195
187
  */
196
188
  constructor(config: AuthGateConfig);
197
189
  private deriveKeys;
package/dist/index.d.ts CHANGED
@@ -49,7 +49,6 @@ interface TokenVerifyResult {
49
49
  * apiKey: process.env.AUTHGATE_API_KEY!,
50
50
  * projectId: process.env.AUTHGATE_PROJECT_ID!,
51
51
  * baseUrl: "https://authgate.dev",
52
- * sessionSecret: process.env.SESSION_SECRET!, // min 32 chars
53
52
  * });
54
53
  * ```
55
54
  */
@@ -60,11 +59,6 @@ interface AuthGateConfig {
60
59
  projectId: string;
61
60
  /** Base URL of the AuthGate service (e.g. `"https://authgate.dev"`). */
62
61
  baseUrl: string;
63
- /**
64
- * Secret used to derive encryption keys for session cookies and OAuth state.
65
- * Must be at least 32 characters. Use a cryptographically random string.
66
- */
67
- sessionSecret: string;
68
62
  /**
69
63
  * Name of the session cookie.
70
64
  * @defaultValue `"__authgate"`
@@ -180,7 +174,6 @@ interface BackupCodesResponse {
180
174
  * apiKey: process.env.AUTHGATE_API_KEY!,
181
175
  * projectId: process.env.AUTHGATE_PROJECT_ID!,
182
176
  * baseUrl: "https://authgate.dev",
183
- * sessionSecret: process.env.SESSION_SECRET!,
184
177
  * });
185
178
  * ```
186
179
  */
@@ -191,7 +184,6 @@ declare class AuthGateClient {
191
184
  private keysReady;
192
185
  /**
193
186
  * @param config - Client configuration. See {@link AuthGateConfig}.
194
- * @throws {@link AuthGateError} if `sessionSecret` is shorter than 32 characters.
195
187
  */
196
188
  constructor(config: AuthGateConfig);
197
189
  private deriveKeys;
package/dist/index.mjs CHANGED
@@ -267,17 +267,11 @@ var InvalidStateError = class extends AuthGateError {
267
267
  var AuthGateClient = class {
268
268
  /**
269
269
  * @param config - Client configuration. See {@link AuthGateConfig}.
270
- * @throws {@link AuthGateError} if `sessionSecret` is shorter than 32 characters.
271
270
  */
272
271
  constructor(config) {
273
272
  this.encryptionKey = null;
274
273
  this.stateKey = null;
275
274
  var _a, _b, _c;
276
- if (!config.sessionSecret || config.sessionSecret.length < 32) {
277
- throw new AuthGateError(
278
- "sessionSecret must be at least 32 characters long"
279
- );
280
- }
281
275
  this.config = __spreadProps(__spreadValues({}, config), {
282
276
  cookieName: (_a = config.cookieName) != null ? _a : DEFAULT_COOKIE_NAME,
283
277
  sessionMaxAge: (_b = config.sessionMaxAge) != null ? _b : SESSION_MAX_AGE,
@@ -287,8 +281,8 @@ var AuthGateClient = class {
287
281
  }
288
282
  async deriveKeys() {
289
283
  const [encKey, stKey] = await Promise.all([
290
- deriveEncryptionKey(this.config.sessionSecret),
291
- deriveStateKey(this.config.sessionSecret)
284
+ deriveEncryptionKey(this.config.apiKey),
285
+ deriveStateKey(this.config.apiKey)
292
286
  ]);
293
287
  this.encryptionKey = encKey;
294
288
  this.stateKey = stKey;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auth-gate/core",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {