@silexpert/core 1.3.185 → 1.3.186-1

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.
Files changed (96) hide show
  1. package/dist/cjs/api/resources/LoginApproval.d.ts +18 -0
  2. package/dist/cjs/api/resources/LoginApproval.d.ts.map +1 -0
  3. package/dist/cjs/api/resources/LoginApproval.js +20 -0
  4. package/dist/cjs/api/resources/LoginApproval.js.map +1 -0
  5. package/dist/cjs/api/resources/Mfa.d.ts +1 -0
  6. package/dist/cjs/api/resources/Mfa.d.ts.map +1 -1
  7. package/dist/cjs/api/resources/Mfa.js +4 -0
  8. package/dist/cjs/api/resources/Mfa.js.map +1 -1
  9. package/dist/cjs/types/Enum/LoginApprovalStatus.d.ts +14 -0
  10. package/dist/cjs/types/Enum/LoginApprovalStatus.d.ts.map +1 -0
  11. package/dist/cjs/types/Enum/LoginApprovalStatus.js +18 -0
  12. package/dist/cjs/types/Enum/LoginApprovalStatus.js.map +1 -0
  13. package/dist/cjs/types/Enum/MfaMode.d.ts +12 -0
  14. package/dist/cjs/types/Enum/MfaMode.d.ts.map +1 -0
  15. package/dist/cjs/types/Enum/MfaMode.js +16 -0
  16. package/dist/cjs/types/Enum/MfaMode.js.map +1 -0
  17. package/dist/cjs/types/Interface/api/authentification/AuthenticationResponse.d.ts +10 -0
  18. package/dist/cjs/types/Interface/api/authentification/AuthenticationResponse.d.ts.map +1 -1
  19. package/dist/cjs/types/Interface/api/authentification/AuthenticationResponse.js.map +1 -1
  20. package/dist/cjs/types/Interface/api/authentification/FinalizeMobileApprovalDto.d.ts +4 -0
  21. package/dist/cjs/types/Interface/api/authentification/FinalizeMobileApprovalDto.d.ts.map +1 -0
  22. package/dist/cjs/types/Interface/api/authentification/FinalizeMobileApprovalDto.js +21 -0
  23. package/dist/cjs/types/Interface/api/authentification/FinalizeMobileApprovalDto.js.map +1 -0
  24. package/dist/cjs/types/Interface/api/authentification/SetMobileApprovalDto.d.ts +5 -0
  25. package/dist/cjs/types/Interface/api/authentification/SetMobileApprovalDto.d.ts.map +1 -0
  26. package/dist/cjs/types/Interface/api/authentification/SetMobileApprovalDto.js +27 -0
  27. package/dist/cjs/types/Interface/api/authentification/SetMobileApprovalDto.js.map +1 -0
  28. package/dist/cjs/types/Interface/api/authentification/loginApproval.d.ts +66 -0
  29. package/dist/cjs/types/Interface/api/authentification/loginApproval.d.ts.map +1 -0
  30. package/dist/cjs/types/Interface/api/authentification/loginApproval.js +26 -0
  31. package/dist/cjs/types/Interface/api/authentification/loginApproval.js.map +1 -0
  32. package/dist/cjs/types/Interface/models/ILoginApproval.d.ts +31 -0
  33. package/dist/cjs/types/Interface/models/ILoginApproval.d.ts.map +1 -0
  34. package/dist/cjs/types/Interface/models/ILoginApproval.js +3 -0
  35. package/dist/cjs/types/Interface/models/ILoginApproval.js.map +1 -0
  36. package/dist/cjs/types/Interface/models/IUser.d.ts +2 -0
  37. package/dist/cjs/types/Interface/models/IUser.d.ts.map +1 -1
  38. package/dist/cjs/types/Interface/models/IUser.js.map +1 -1
  39. package/dist/cjs/types/index.d.ts +6 -0
  40. package/dist/cjs/types/index.d.ts.map +1 -1
  41. package/dist/cjs/types/index.js +6 -0
  42. package/dist/cjs/types/index.js.map +1 -1
  43. package/dist/mjs/api/resources/LoginApproval.d.ts +18 -0
  44. package/dist/mjs/api/resources/LoginApproval.d.ts.map +1 -0
  45. package/dist/mjs/api/resources/LoginApproval.js +16 -0
  46. package/dist/mjs/api/resources/LoginApproval.js.map +1 -0
  47. package/dist/mjs/api/resources/Mfa.d.ts +1 -0
  48. package/dist/mjs/api/resources/Mfa.d.ts.map +1 -1
  49. package/dist/mjs/api/resources/Mfa.js +4 -0
  50. package/dist/mjs/api/resources/Mfa.js.map +1 -1
  51. package/dist/mjs/types/Enum/LoginApprovalStatus.d.ts +14 -0
  52. package/dist/mjs/types/Enum/LoginApprovalStatus.d.ts.map +1 -0
  53. package/dist/mjs/types/Enum/LoginApprovalStatus.js +15 -0
  54. package/dist/mjs/types/Enum/LoginApprovalStatus.js.map +1 -0
  55. package/dist/mjs/types/Enum/MfaMode.d.ts +12 -0
  56. package/dist/mjs/types/Enum/MfaMode.d.ts.map +1 -0
  57. package/dist/mjs/types/Enum/MfaMode.js +13 -0
  58. package/dist/mjs/types/Enum/MfaMode.js.map +1 -0
  59. package/dist/mjs/types/Interface/api/authentification/AuthenticationResponse.d.ts +10 -0
  60. package/dist/mjs/types/Interface/api/authentification/AuthenticationResponse.d.ts.map +1 -1
  61. package/dist/mjs/types/Interface/api/authentification/AuthenticationResponse.js.map +1 -1
  62. package/dist/mjs/types/Interface/api/authentification/FinalizeMobileApprovalDto.d.ts +4 -0
  63. package/dist/mjs/types/Interface/api/authentification/FinalizeMobileApprovalDto.d.ts.map +1 -0
  64. package/dist/mjs/types/Interface/api/authentification/FinalizeMobileApprovalDto.js +18 -0
  65. package/dist/mjs/types/Interface/api/authentification/FinalizeMobileApprovalDto.js.map +1 -0
  66. package/dist/mjs/types/Interface/api/authentification/SetMobileApprovalDto.d.ts +5 -0
  67. package/dist/mjs/types/Interface/api/authentification/SetMobileApprovalDto.d.ts.map +1 -0
  68. package/dist/mjs/types/Interface/api/authentification/SetMobileApprovalDto.js +25 -0
  69. package/dist/mjs/types/Interface/api/authentification/SetMobileApprovalDto.js.map +1 -0
  70. package/dist/mjs/types/Interface/api/authentification/loginApproval.d.ts +66 -0
  71. package/dist/mjs/types/Interface/api/authentification/loginApproval.d.ts.map +1 -0
  72. package/dist/mjs/types/Interface/api/authentification/loginApproval.js +23 -0
  73. package/dist/mjs/types/Interface/api/authentification/loginApproval.js.map +1 -0
  74. package/dist/mjs/types/Interface/models/ILoginApproval.d.ts +31 -0
  75. package/dist/mjs/types/Interface/models/ILoginApproval.d.ts.map +1 -0
  76. package/dist/mjs/types/Interface/models/ILoginApproval.js +2 -0
  77. package/dist/mjs/types/Interface/models/ILoginApproval.js.map +1 -0
  78. package/dist/mjs/types/Interface/models/IUser.d.ts +2 -0
  79. package/dist/mjs/types/Interface/models/IUser.d.ts.map +1 -1
  80. package/dist/mjs/types/Interface/models/IUser.js.map +1 -1
  81. package/dist/mjs/types/index.d.ts +6 -0
  82. package/dist/mjs/types/index.d.ts.map +1 -1
  83. package/dist/mjs/types/index.js +6 -0
  84. package/dist/mjs/types/index.js.map +1 -1
  85. package/package.json +1 -1
  86. package/ts/api/resources/LoginApproval.ts +20 -0
  87. package/ts/api/resources/Mfa.ts +6 -0
  88. package/ts/types/Enum/LoginApprovalStatus.ts +13 -0
  89. package/ts/types/Enum/MfaMode.ts +11 -0
  90. package/ts/types/Interface/api/authentification/AuthenticationResponse.ts +10 -0
  91. package/ts/types/Interface/api/authentification/FinalizeMobileApprovalDto.ts +6 -0
  92. package/ts/types/Interface/api/authentification/SetMobileApprovalDto.ts +11 -0
  93. package/ts/types/Interface/api/authentification/loginApproval.ts +75 -0
  94. package/ts/types/Interface/models/ILoginApproval.ts +31 -0
  95. package/ts/types/Interface/models/IUser.ts +2 -0
  96. package/ts/types/index.ts +6 -0
@@ -0,0 +1,20 @@
1
+ import { Resource } from '../Resource';
2
+ import { ILoginApprovalStatusResponse } from '../../types/Interface/api/authentification/loginApproval';
3
+
4
+ export class LoginApproval extends Resource {
5
+ approve(requestId: string, deviceId: string): Promise<{ message: string; status: string }> {
6
+ return this.axios.$post(`/auth/approvals/${requestId}/approve`, { deviceId });
7
+ }
8
+
9
+ deny(requestId: string, deviceId: string): Promise<{ message: string; status: string }> {
10
+ return this.axios.$post(`/auth/approvals/${requestId}/deny`, { deviceId });
11
+ }
12
+
13
+ getStatus(requestId: string): Promise<ILoginApprovalStatusResponse> {
14
+ return this.axios.$get(`/auth/approvals/${requestId}/status`);
15
+ }
16
+
17
+ cleanup(): Promise<{ deleted: number; message: string }> {
18
+ return this.axios.$post('/auth/approvals/cleanup');
19
+ }
20
+ }
@@ -26,4 +26,10 @@ export class UserMfa extends Resource {
26
26
  // Si userId est fourni, l'envoyer en query param, sinon vérifier l'user connecté
27
27
  return this.axios.$get('/mfa/is-enabled', userId ? { params: { userId } } : undefined);
28
28
  }
29
+
30
+ ///// Mobile Approval MFA /////
31
+
32
+ setMobileApproval(userId: number, enable: boolean): Promise<void> {
33
+ return this.axios.$post('/mfa/mobile-approval', { userId, enable });
34
+ }
29
35
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Statuts possibles d'une demande d'approbation de connexion mobile
3
+ */
4
+ export enum LoginApprovalStatus {
5
+ /** En attente de validation par le mobile */
6
+ PENDING = 'pending',
7
+ /** Approuvée par l'utilisateur sur son mobile */
8
+ APPROVED = 'approved',
9
+ /** Refusée par l'utilisateur sur son mobile */
10
+ DENIED = 'denied',
11
+ /** Expirée (timeout dépassé sans action) */
12
+ EXPIRED = 'expired',
13
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Modes de double authentification disponibles
3
+ */
4
+ export enum MfaMode {
5
+ /** Pas de MFA activée */
6
+ NONE = 'none',
7
+ /** Authentification via code TOTP (Google Authenticator, etc.) */
8
+ TOTP = 'totp',
9
+ /** Validation via notification sur l'application mobile */
10
+ MOBILE_APPROVAL = 'mobile_approval',
11
+ }
@@ -1,6 +1,16 @@
1
1
  export interface IAuthenticationResponse {
2
+ /** TOTP MFA requis (classique avec code à 6 chiffres) */
2
3
  requiresMfa?: boolean;
4
+ /** Mobile approval MFA requis (validation sur l'app mobile) */
5
+ requiresMobileApproval?: boolean;
6
+ /** ID de la demande d'approbation (pour polling/tracking) */
7
+ requestId?: string;
8
+ /** Date d'expiration de la demande */
9
+ expiresAt?: Date;
10
+ /** ID de l'utilisateur */
3
11
  userId?: number;
12
+ /** Message informatif */
4
13
  message?: string;
14
+ /** Token JWT si authentification réussie */
5
15
  token?: string;
6
16
  }
@@ -0,0 +1,6 @@
1
+ import { IsString } from 'class-validator';
2
+
3
+ export class FinalizeMobileApprovalDto {
4
+ @IsString()
5
+ requestId: string;
6
+ }
@@ -0,0 +1,11 @@
1
+ import { IsBoolean, IsInt } from 'class-validator';
2
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
3
+
4
+ export class SetMobileApprovalDto {
5
+ @IsInt()
6
+ userId: number;
7
+
8
+ @IsBoolean()
9
+ @ToBoolean()
10
+ enable: boolean;
11
+ }
@@ -0,0 +1,75 @@
1
+ import { LoginApprovalStatus } from '../../../Enum/LoginApprovalStatus';
2
+ import { IsString } from 'class-validator';
3
+ import { ApiProperty } from '../../../../';
4
+
5
+ /**
6
+ * Payload de l'événement socket envoyé au mobile lors d'une demande de connexion
7
+ */
8
+ export interface ILoginApprovalRequestEvent {
9
+ /** ID unique de la demande */
10
+ requestId: string;
11
+ /** Date d'expiration */
12
+ expiresAt: Date;
13
+ /** ID de l'utilisateur */
14
+ userId: number;
15
+ /** Métadonnées (IP, navigateur, localisation) */
16
+ metadata?: {
17
+ ip?: string;
18
+ userAgent?: string;
19
+ location?: string;
20
+ };
21
+ }
22
+
23
+ export interface IApproveOrDenyResponse {
24
+ message: string;
25
+ status: LoginApprovalStatus;
26
+ }
27
+
28
+ /**
29
+ * Payload de l'événement socket envoyé au Web lors d'un changement de statut
30
+ */
31
+ export interface ILoginApprovalStatusEvent {
32
+ /** ID de la demande */
33
+ requestId: string;
34
+ /** Nouveau statut */
35
+ status: LoginApprovalStatus;
36
+ /** Date de la transition */
37
+ timestamp: Date;
38
+ }
39
+
40
+ /**
41
+ * Réponse renvoyée au Web lorsque mobile MFA est requis
42
+ */
43
+ export interface ILoginApprovalResponse {
44
+ /** Indique qu'une validation mobile est nécessaire */
45
+ requiresMobileApproval: true;
46
+ /** ID de la demande pour polling/tracking */
47
+ requestId: string;
48
+ /** Date d'expiration de la demande */
49
+ expiresAt: Date;
50
+ /** ID utilisateur */
51
+ userId: number;
52
+ }
53
+
54
+ /**
55
+ * Réponse du statut d'une demande d'approbation
56
+ */
57
+ export interface ILoginApprovalStatusResponse {
58
+ /** ID de la demande */
59
+ requestId: string;
60
+ /** Statut actuel */
61
+ status: LoginApprovalStatus;
62
+ /** Date d'expiration */
63
+ expiresAt: Date;
64
+ /** Token JWT si status = approved */
65
+ token?: string;
66
+ }
67
+
68
+ /**
69
+ * DTO pour approuver/refuser une demande depuis le mobile
70
+ */
71
+ export class IApproveOrDenyRequest {
72
+ @ApiProperty()
73
+ @IsString()
74
+ deviceId: string;
75
+ }
@@ -0,0 +1,31 @@
1
+ import { LoginApprovalStatus } from '../../Enum/LoginApprovalStatus';
2
+
3
+ /**
4
+ * Interface représentant une demande d'approbation de connexion mobile
5
+ */
6
+ export interface ILoginApproval {
7
+ /** Identifiant unique (UUID) */
8
+ id: string;
9
+ /** ID de l'utilisateur demandant la connexion */
10
+ idUser: number;
11
+ /** Statut actuel de la demande */
12
+ status: LoginApprovalStatus;
13
+ /** Date d'expiration de la demande (généralement 2-3 min après création) */
14
+ expiresAt: Date;
15
+ /** Date d'approbation (si status = approved) */
16
+ approvedAt?: Date;
17
+ /** Date de refus (si status = denied) */
18
+ deniedAt?: Date;
19
+ /** Device ID du mobile ayant approuvé/refusé */
20
+ deviceIdUsed?: string;
21
+ /** IP de la connexion Web à l'origine de la demande */
22
+ ip?: string;
23
+ /** User-Agent du navigateur Web */
24
+ userAgent?: string;
25
+ /** Métadonnées additionnelles (géoloc, risk score, etc.) */
26
+ metadata?: Record<string, any>;
27
+ /** Date de création */
28
+ createdAt: Date;
29
+ /** Date de mise à jour */
30
+ updatedAt: Date;
31
+ }
@@ -23,6 +23,7 @@ import { IUserBrand } from './IUserBrand';
23
23
  import { ICollaboraterDetail } from './ICollaboraterDetail';
24
24
  import { IUserTimeSlot } from './IUserTimeSlot';
25
25
  import { IUserTeam } from './IUserTeam';
26
+ import { MfaMode } from '../../Enum/MfaMode';
26
27
 
27
28
  // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
28
29
  type isAny<T> = T | any;
@@ -52,6 +53,7 @@ export interface IUser {
52
53
  prefix?: string | null;
53
54
  tokenLostPassword?: string | null;
54
55
  twoFactorEnabled?: boolean | null;
56
+ mfaMode?: MfaMode | null;
55
57
  tokenApi?: string | null;
56
58
  tokenNotification?: string | null;
57
59
  tokenSocket?: string | null;
package/ts/types/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from './Interface/models/ICallHistory';
3
3
  export * from './Interface/models/IBusinessLineUser';
4
4
  export * from './Interface/models/IVisualizedInformation';
5
5
  export * from './Interface/models/IApiError';
6
+ export * from './Interface/models/ILoginApproval';
6
7
  export * from './Interface/models/ISms';
7
8
  export * from './Interface/models/IAccessToken';
8
9
  export * from './Interface/models/IAccountDetail';
@@ -289,6 +290,7 @@ export * from './Interface/models/ILoanFile';
289
290
  export * from './Interface/models/ICommercialMail';
290
291
  export * from './Interface/models/ICommercialOffer';
291
292
  export * from './Interface/models/IRegistration';
293
+ export * from './Interface/api/mfa/mfa';
292
294
  export * from './Interface/models/IVatRegimeHistory';
293
295
  export * from './Interface/models/ICustomerAcceptance';
294
296
  export * from './Interface/models/IUnpaidCallHistory';
@@ -341,6 +343,8 @@ export * from './Enum/Feature';
341
343
  export * from './Enum/AutomaticRegistration';
342
344
  export * from './Enum/IntermediateManagementRebate';
343
345
  export * from './Enum/Das';
346
+ export * from './Enum/LoginApprovalStatus';
347
+ export * from './Enum/MfaMode';
344
348
  export * from './Enum/ChangeLog';
345
349
  export * from './Enum/VisualizedInformation';
346
350
  export * from './Enum/NafCode';
@@ -565,6 +569,7 @@ export * from './Enum/Revenue';
565
569
  // Interfaces API
566
570
  export * from './Interface/api/authentification/AuthenticationResponse';
567
571
  export * from './Interface/api/exercice/ReadExercice';
572
+ export * from './Interface/api/authentification/AuthenticationResponse';
568
573
  export * from './Interface/api/balanceSheet/consistency/Read';
569
574
  export * from './Interface/api/kilometricAllowance/ReadKilometricAllowance';
570
575
  export * from './Interface/api/cashAndExpense/Query';
@@ -1058,6 +1063,7 @@ export * from './Interface/api/changelog/Create';
1058
1063
  export * from './Interface/api/authentification/ReadAuthenticateCollaborater';
1059
1064
  export * from './Interface/api/authentification/ResetPassword';
1060
1065
  export * from './Interface/api/authentification/ForgotPassword';
1066
+ export * from './Interface/api/authentification/loginApproval';
1061
1067
  export * from './Interface/api/society/Export';
1062
1068
  export * from './Interface/api/society/State';
1063
1069
  export * from './Interface/api/businessSector/Create';