@stacksjs/auth 0.75.357 → 0.75.360

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,6 +1,7 @@
1
1
  import { requestToken } from './request-token';
2
2
  import { User } from '@stacksjs/orm';
3
3
  import type { AuthCredentials, AuthToken, NewAccessToken, PersonalAccessToken, TokenCreateOptions } from '@stacksjs/types';
4
+ import type { ImpersonationGrant } from './impersonation';
4
5
  declare type UserModel = NonNullable<Awaited<ReturnType<typeof User.find>>>;
5
6
  export declare class Auth {
6
7
  static attempt(credentials: AuthCredentials): Promise<boolean>;
@@ -24,7 +25,7 @@ export declare class Auth {
24
25
  static requestToken(credentials: AuthCredentials, clientId: number, clientSecret: string): Promise<{ token: AuthToken } | null>;
25
26
  static validateToken(token: string): Promise<boolean>;
26
27
  static getUserFromToken(token: string): Promise<UserModel | undefined>;
27
- static startImpersonation(subjectId: number, reason: string): Promise<unknown>;
28
+ static startImpersonation(subjectId: number, reason: string): Promise<ImpersonationGrant>;
28
29
  static endImpersonation(credential: string): Promise<void>;
29
30
  static currentAccessToken(): Promise<PersonalAccessToken | undefined>;
30
31
  static tokenCan(ability: string): Promise<boolean>;
@@ -5,7 +5,7 @@ declare function credentialHash(value: string): string;
5
5
  * original credential. The host must resolve it at its authentication boundary.
6
6
  */
7
7
  export declare function createImpersonationService(store: ImpersonationStore, authority: ImpersonationAuthority): {
8
- start: (subjectId: number, reason: string) => Promise<{ credential: string, session: ImpersonationSession }>;
8
+ start: (subjectId: number, reason: string) => Promise<ImpersonationGrant>;
9
9
  resolve: (credential: string, access: ImpersonationAccess) => Promise<ImpersonationSession | null>;
10
10
  end: (credential: string) => Promise<void>
11
11
  };
@@ -19,6 +19,10 @@ export declare interface ImpersonationSession {
19
19
  expiresAt: number
20
20
  endedAt: number | null
21
21
  }
22
+ export declare interface ImpersonationGrant {
23
+ credential: string
24
+ session: ImpersonationSession
25
+ }
22
26
  export declare interface ImpersonationAccess {
23
27
  method: string
24
28
  path: string
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/auth",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.357",
5
+ "version": "0.75.360",
6
6
  "description": "A more simplistic way to authenticate.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -59,19 +59,19 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@stacksjs/bun-router": "^0.1.24",
62
- "@stacksjs/cache": "0.75.357",
63
- "@stacksjs/config": "0.75.357",
64
- "@stacksjs/database": "0.75.357",
65
- "@stacksjs/email": "0.75.357",
66
- "@stacksjs/env": "0.75.357",
67
- "@stacksjs/error-handling": "0.75.357",
68
- "@stacksjs/logging": "0.75.357",
69
- "@stacksjs/orm": "0.75.357",
70
- "@stacksjs/path": "0.75.357",
71
- "@stacksjs/router": "0.75.357",
72
- "@stacksjs/security": "0.75.357",
73
- "@stacksjs/socials": "0.75.357",
74
- "@stacksjs/storage": "0.75.357",
62
+ "@stacksjs/cache": "0.75.360",
63
+ "@stacksjs/config": "0.75.360",
64
+ "@stacksjs/database": "0.75.360",
65
+ "@stacksjs/email": "0.75.360",
66
+ "@stacksjs/env": "0.75.360",
67
+ "@stacksjs/error-handling": "0.75.360",
68
+ "@stacksjs/logging": "0.75.360",
69
+ "@stacksjs/orm": "0.75.360",
70
+ "@stacksjs/path": "0.75.360",
71
+ "@stacksjs/router": "0.75.360",
72
+ "@stacksjs/security": "0.75.360",
73
+ "@stacksjs/socials": "0.75.360",
74
+ "@stacksjs/storage": "0.75.360",
75
75
  "@stacksjs/ts-auth": "^0.4.7",
76
76
  "ts-qr-codes": "^0.1.8"
77
77
  },