@absolutejs/auth 0.48.3 → 0.48.5

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.
@@ -34,6 +34,7 @@ export declare const userStatus: <UserType>({ authSessionStore, statusRoute, onS
34
34
  response: {
35
35
  400: "Cookies are missing";
36
36
  200: {
37
+ impersonator: import("..").Impersonator | undefined;
37
38
  user: NonNullable<UserType> | null;
38
39
  };
39
40
  422: {
@@ -19,8 +19,10 @@ export declare const getStatusFromSource: <UserType>({ authSessionStore, session
19
19
  readonly message: "Cookies are missing";
20
20
  };
21
21
  user: null;
22
+ impersonator?: undefined;
22
23
  } | {
23
24
  error: null;
25
+ impersonator: import("..").Impersonator | undefined;
24
26
  user: NonNullable<UserType> | null;
25
27
  }>;
26
28
  export declare const loadSessionFromSource: <UserType>({ authSessionStore, session, userSessionId, removeExpired }: {
@@ -13,7 +13,8 @@ export declare const endImpersonation: <UserType>({ authSessionStore, cookie, co
13
13
  restored: boolean;
14
14
  }>;
15
15
  export declare const isImpersonating: <UserType>(session: SessionData<UserType> | undefined) => boolean;
16
- export declare const startImpersonation: <UserType>({ authSessionStore, cookie, cookieSecure, emit, getUserId, impersonator, inMemorySession, sessionDurationMs, user }: {
16
+ export declare const startImpersonation: <UserType>({ allowNested, authSessionStore, cookie, cookieSecure, emit, getUserId, impersonator, inMemorySession, sessionDurationMs, user }: {
17
+ allowNested?: boolean;
17
18
  authSessionStore?: AuthSessionStore<UserType>;
18
19
  cookie: Cookie<UserSessionId | undefined>;
19
20
  cookieSecure?: boolean;
@@ -22,6 +23,7 @@ export declare const startImpersonation: <UserType>({ authSessionStore, cookie,
22
23
  impersonator: {
23
24
  actorEmail?: string;
24
25
  actorId: string;
26
+ readOnly?: boolean;
25
27
  reason: string;
26
28
  };
27
29
  inMemorySession: SessionRecord<UserType>;
package/dist/types.d.ts CHANGED
@@ -39,10 +39,17 @@ export type UserSessionId = `${string}-${string}-${string}-${string}-${string}`;
39
39
  /** Stamped on a session created via admin impersonation (`startImpersonation`). RFC 8693
40
40
  * actor semantics: `actorId`/`actorEmail` are the admin acting as the user, `reason` is
41
41
  * required and audited, `returnToSessionId` is the admin's own session to restore on exit.
42
- * Surfaced by userStatus so your UI can show an "impersonating" banner. */
42
+ * Surfaced by userStatus so your UI can show an "impersonating" banner.
43
+ *
44
+ * `readOnly` is the RFC 8693 §6 "down-scope the delegated session" lever, surfaced for the
45
+ * app to enforce: when true this is a GHOST/observe-only session — the app should reject
46
+ * writes (and suppress side-effects) so an admin can watch a member's account without
47
+ * disturbing them. The package only CARRIES the flag (it can't know your routes); enforce
48
+ * it in your own request guard. Absent/false = full-access acting session. */
43
49
  export type Impersonator = {
44
50
  actorEmail?: string;
45
51
  actorId: string;
52
+ readOnly?: boolean;
46
53
  reason: string;
47
54
  returnToSessionId?: UserSessionId;
48
55
  startedAt: number;
@@ -177,7 +184,8 @@ export type OnRevocationError = (({ error, authProvider }: {
177
184
  authClient?: string;
178
185
  error: unknown;
179
186
  }) => void | Promise<void>) | undefined;
180
- export type OnStatus<UserType> = (({ user }: {
187
+ export type OnStatus<UserType> = (({ impersonator, user }: {
188
+ impersonator?: Impersonator;
181
189
  user: UserType | null;
182
190
  }) => void | Promise<void>) | undefined;
183
191
  export type OnSignOut<UserType> = (({ authProvider, userSessionId, session }: {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.48.3",
2
+ "version": "0.48.5",
3
3
  "name": "@absolutejs/auth",
4
4
  "description": "An authorization library for absolutejs",
5
5
  "repository": {