@rebasepro/server 0.9.1-canary.09aaf62 → 0.9.1-canary.0de22e0

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.
@@ -1,5 +1,5 @@
1
1
  import { VectorSearchParams, LogicalCondition, FilterValues } from "@rebasepro/types";
2
- import { AuthResult } from "../auth/middleware";
2
+ import type { AuthResult } from "../auth/middleware";
3
3
  import { DataDriver } from "@rebasepro/types";
4
4
  import type { ApiKeyMasked } from "../auth/api-keys/api-key-types";
5
5
  /**
@@ -9,7 +9,7 @@ import type { ApiKeyMasked } from "../auth/api-keys/api-key-types";
9
9
  export type HonoEnv = {
10
10
  Variables: {
11
11
  user?: AuthResult | {
12
- userId?: string;
12
+ uid?: string;
13
13
  roles?: string[];
14
14
  };
15
15
  driver?: DataDriver;
@@ -4,9 +4,14 @@ export interface JwtConfig {
4
4
  refreshExpiresIn?: string;
5
5
  }
6
6
  export interface AccessTokenPayload {
7
- userId: string;
7
+ /**
8
+ * The user's id — the same spelling the domain model, the auth adapters and
9
+ * the RLS layer (`auth.uid()`) all use. Tokens minted before this rename
10
+ * carry `userId` instead, and older external IdPs may send `sub`;
11
+ * {@link verifyAccessToken} accepts all three and normalises to this.
12
+ */
13
+ uid: string;
8
14
  roles: string[];
9
- uid?: string;
10
15
  /** Authentication Assurance Level: aal1 = password/oauth, aal2 = MFA verified */
11
16
  aal?: "aal1" | "aal2";
12
17
  /** Email claim from the JWT, if present */
@@ -28,7 +33,7 @@ export declare function configureJwt(config: JwtConfig): void;
28
33
  /**
29
34
  * Generate an access token (short-lived, 1 hour by default)
30
35
  */
31
- export declare function generateAccessToken(userId: string, roles: string[], aal?: "aal1" | "aal2", customClaims?: Record<string, unknown>): string;
36
+ export declare function generateAccessToken(uid: string, roles: string[], aal?: "aal1" | "aal2", customClaims?: Record<string, unknown>): string;
32
37
  /**
33
38
  * Get the expiration time of an access token in milliseconds from now
34
39
  */
@@ -1,13 +1,13 @@
1
1
  import { MiddlewareHandler, Context } from "hono";
2
2
  import { DataDriver } from "@rebasepro/types";
3
3
  import { AccessTokenPayload } from "./jwt";
4
- import { HonoEnv } from "../api/types";
4
+ import type { HonoEnv } from "../api/types";
5
5
  import type { ApiKeyStore } from "./api-keys/api-key-store";
6
6
  /**
7
7
  * Result from a custom auth validator.
8
8
  * - `false`/`null`/`undefined` = not authenticated
9
9
  * - `true` = authenticated as default user
10
- * - object with `userId` or `uid` = authenticated with user info
10
+ * - object with `uid` (or legacy `userId`) = authenticated with user info
11
11
  */
12
12
  export type AuthResult = boolean | null | undefined | {
13
13
  userId?: string;