supaapps-auth 2.0.0-rc.10 → 2.0.0-rc.13

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,4 +1,4 @@
1
- import { AuthManagerEvent, Platforms, UserTokenPayload } from './types';
1
+ import { AuthManagerEvent, PlatformCheckResponse, UserTokenPayload } from './types';
2
2
  export declare class AuthManager {
3
3
  private static instance;
4
4
  private authServer;
@@ -18,7 +18,7 @@ export declare class AuthManager {
18
18
  getLoginWithGoogleUri(): string;
19
19
  isLoggedIn(): Promise<boolean>;
20
20
  getAccessToken(mustBeLoggedIn?: boolean): Promise<string>;
21
- platformCheck(email: string): Promise<Array<Platforms>>;
21
+ platformCheck(email: string): Promise<PlatformCheckResponse>;
22
22
  verifyEmail(email: string, token: string): Promise<boolean>;
23
23
  doPassReset(email: string, token: string, newPassword: string): Promise<boolean>;
24
24
  changeEmail(email: string): Promise<boolean>;
@@ -331,6 +331,7 @@ class AuthManager {
331
331
  exp: decodedToken.exp,
332
332
  scopes: decodedToken.scopes,
333
333
  realm: decodedToken.realm,
334
+ provider: decodedToken.provider,
334
335
  };
335
336
  const { data: publicKey } = yield axios_1.default.get(`${authServer}public/public_key`);
336
337
  const { data: algo } = yield axios_1.default.get(`${authServer}public/algo`);
package/dist/types.d.ts CHANGED
@@ -19,11 +19,15 @@ export interface UserTokenPayload {
19
19
  exp: number;
20
20
  scopes: string;
21
21
  realm: string;
22
+ provider: Platforms;
22
23
  }
23
24
  export interface AuthManagerEvent {
24
25
  type: AuthEventType;
25
26
  user?: UserTokenPayload;
26
27
  }
28
+ export interface PlatformCheckResponse {
29
+ platform: Platforms[];
30
+ }
27
31
  export declare enum Platforms {
28
32
  PASSWORD = "password",
29
33
  GOOGLE = "google",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supaapps-auth",
3
- "version": "2.0.0-rc.10",
3
+ "version": "2.0.0-rc.13",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,7 +4,7 @@ import {
4
4
  decode as jwtDecode,
5
5
  verify as jwtVerify,
6
6
  } from 'jsonwebtoken'; // Ensure jsonwebtoken is correctly imported
7
- import {AuthEventType, AuthManagerEvent, Platforms, UserTokenPayload} from './types';
7
+ import {AuthEventType, AuthManagerEvent, PlatformCheckResponse, UserTokenPayload} from './types';
8
8
 
9
9
  export class AuthManager {
10
10
  private static instance: AuthManager | null = null;
@@ -171,7 +171,7 @@ export class AuthManager {
171
171
  }
172
172
 
173
173
 
174
- public async platformCheck(email: string): Promise<Array<Platforms>> {
174
+ public async platformCheck(email: string): Promise<PlatformCheckResponse> {
175
175
  const response = await axios.post(
176
176
  `${this.authServer}auth/email/platform_check`,
177
177
  {
@@ -405,6 +405,7 @@ export class AuthManager {
405
405
  exp: decodedToken.exp,
406
406
  scopes: decodedToken.scopes,
407
407
  realm: decodedToken.realm,
408
+ provider: decodedToken.provider,
408
409
  }
409
410
 
410
411
  const { data: publicKey } = await axios.get(
package/src/types.ts CHANGED
@@ -21,6 +21,7 @@ export interface UserTokenPayload {
21
21
  exp: number;
22
22
  scopes: string;
23
23
  realm: string;
24
+ provider: Platforms;
24
25
  }
25
26
 
26
27
  export interface AuthManagerEvent {
@@ -28,6 +29,10 @@ export interface AuthManagerEvent {
28
29
  user?: UserTokenPayload;
29
30
  }
30
31
 
32
+ export interface PlatformCheckResponse {
33
+ platform: Platforms[];
34
+ }
35
+
31
36
  export enum Platforms {
32
37
  PASSWORD = 'password',
33
38
  GOOGLE = 'google',