@silexpert/core 1.3.156 → 1.3.157-2

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 (116) hide show
  1. package/dist/cjs/api/resources/Mfa.d.ts +19 -0
  2. package/dist/cjs/api/resources/Mfa.d.ts.map +1 -0
  3. package/dist/cjs/api/resources/Mfa.js +27 -0
  4. package/dist/cjs/api/resources/Mfa.js.map +1 -0
  5. package/dist/cjs/api/resources.d.ts +2 -0
  6. package/dist/cjs/api/resources.d.ts.map +1 -1
  7. package/dist/cjs/api/resources.js +2 -0
  8. package/dist/cjs/api/resources.js.map +1 -1
  9. package/dist/cjs/types/Interface/api/authentification/AuthenticationResponse.d.ts +7 -0
  10. package/dist/cjs/types/Interface/api/authentification/AuthenticationResponse.d.ts.map +1 -0
  11. package/dist/cjs/types/Interface/api/authentification/AuthenticationResponse.js +3 -0
  12. package/dist/cjs/types/Interface/api/authentification/AuthenticationResponse.js.map +1 -0
  13. package/dist/cjs/types/Interface/api/mfa/DisableMfa.d.ts +4 -0
  14. package/dist/cjs/types/Interface/api/mfa/DisableMfa.d.ts.map +1 -0
  15. package/dist/cjs/types/Interface/api/mfa/DisableMfa.js +22 -0
  16. package/dist/cjs/types/Interface/api/mfa/DisableMfa.js.map +1 -0
  17. package/dist/cjs/types/Interface/api/mfa/SetupInit.d.ts +5 -0
  18. package/dist/cjs/types/Interface/api/mfa/SetupInit.d.ts.map +1 -0
  19. package/dist/cjs/types/Interface/api/mfa/SetupInit.js +27 -0
  20. package/dist/cjs/types/Interface/api/mfa/SetupInit.js.map +1 -0
  21. package/dist/cjs/types/Interface/api/mfa/SetupVerify.d.ts +5 -0
  22. package/dist/cjs/types/Interface/api/mfa/SetupVerify.d.ts.map +1 -0
  23. package/dist/cjs/types/Interface/api/mfa/SetupVerify.js +27 -0
  24. package/dist/cjs/types/Interface/api/mfa/SetupVerify.js.map +1 -0
  25. package/dist/cjs/types/Interface/api/mfa/VerifyCode.d.ts +5 -0
  26. package/dist/cjs/types/Interface/api/mfa/VerifyCode.d.ts.map +1 -0
  27. package/dist/cjs/types/Interface/api/mfa/VerifyCode.js +27 -0
  28. package/dist/cjs/types/Interface/api/mfa/VerifyCode.js.map +1 -0
  29. package/dist/cjs/types/Interface/api/mfa/VerifyRecoveryCode.d.ts +5 -0
  30. package/dist/cjs/types/Interface/api/mfa/VerifyRecoveryCode.d.ts.map +1 -0
  31. package/dist/cjs/types/Interface/api/mfa/VerifyRecoveryCode.js +27 -0
  32. package/dist/cjs/types/Interface/api/mfa/VerifyRecoveryCode.js.map +1 -0
  33. package/dist/cjs/types/Interface/api/mfa/mfa.d.ts +19 -0
  34. package/dist/cjs/types/Interface/api/mfa/mfa.d.ts.map +1 -0
  35. package/dist/cjs/types/Interface/api/mfa/mfa.js +3 -0
  36. package/dist/cjs/types/Interface/api/mfa/mfa.js.map +1 -0
  37. package/dist/cjs/types/Interface/models/IUser.d.ts +1 -0
  38. package/dist/cjs/types/Interface/models/IUser.d.ts.map +1 -1
  39. package/dist/cjs/types/Interface/models/IUser.js.map +1 -1
  40. package/dist/cjs/types/Interface/models/IUserMfa.d.ts +12 -0
  41. package/dist/cjs/types/Interface/models/IUserMfa.d.ts.map +1 -0
  42. package/dist/cjs/types/Interface/models/IUserMfa.js +3 -0
  43. package/dist/cjs/types/Interface/models/IUserMfa.js.map +1 -0
  44. package/dist/cjs/types/Interface/models/IUserMfaRecoveryCode.d.ts +9 -0
  45. package/dist/cjs/types/Interface/models/IUserMfaRecoveryCode.d.ts.map +1 -0
  46. package/dist/cjs/types/Interface/models/IUserMfaRecoveryCode.js +3 -0
  47. package/dist/cjs/types/Interface/models/IUserMfaRecoveryCode.js.map +1 -0
  48. package/dist/cjs/types/index.d.ts +1 -0
  49. package/dist/cjs/types/index.d.ts.map +1 -1
  50. package/dist/cjs/types/index.js +1 -0
  51. package/dist/cjs/types/index.js.map +1 -1
  52. package/dist/mjs/api/resources/Mfa.d.ts +19 -0
  53. package/dist/mjs/api/resources/Mfa.d.ts.map +1 -0
  54. package/dist/mjs/api/resources/Mfa.js +23 -0
  55. package/dist/mjs/api/resources/Mfa.js.map +1 -0
  56. package/dist/mjs/api/resources.d.ts +2 -0
  57. package/dist/mjs/api/resources.d.ts.map +1 -1
  58. package/dist/mjs/api/resources.js +2 -0
  59. package/dist/mjs/api/resources.js.map +1 -1
  60. package/dist/mjs/types/Interface/api/authentification/AuthenticationResponse.d.ts +7 -0
  61. package/dist/mjs/types/Interface/api/authentification/AuthenticationResponse.d.ts.map +1 -0
  62. package/dist/mjs/types/Interface/api/authentification/AuthenticationResponse.js +2 -0
  63. package/dist/mjs/types/Interface/api/authentification/AuthenticationResponse.js.map +1 -0
  64. package/dist/mjs/types/Interface/api/mfa/DisableMfa.d.ts +4 -0
  65. package/dist/mjs/types/Interface/api/mfa/DisableMfa.d.ts.map +1 -0
  66. package/dist/mjs/types/Interface/api/mfa/DisableMfa.js +19 -0
  67. package/dist/mjs/types/Interface/api/mfa/DisableMfa.js.map +1 -0
  68. package/dist/mjs/types/Interface/api/mfa/SetupInit.d.ts +5 -0
  69. package/dist/mjs/types/Interface/api/mfa/SetupInit.d.ts.map +1 -0
  70. package/dist/mjs/types/Interface/api/mfa/SetupInit.js +25 -0
  71. package/dist/mjs/types/Interface/api/mfa/SetupInit.js.map +1 -0
  72. package/dist/mjs/types/Interface/api/mfa/SetupVerify.d.ts +5 -0
  73. package/dist/mjs/types/Interface/api/mfa/SetupVerify.d.ts.map +1 -0
  74. package/dist/mjs/types/Interface/api/mfa/SetupVerify.js +25 -0
  75. package/dist/mjs/types/Interface/api/mfa/SetupVerify.js.map +1 -0
  76. package/dist/mjs/types/Interface/api/mfa/VerifyCode.d.ts +5 -0
  77. package/dist/mjs/types/Interface/api/mfa/VerifyCode.d.ts.map +1 -0
  78. package/dist/mjs/types/Interface/api/mfa/VerifyCode.js +25 -0
  79. package/dist/mjs/types/Interface/api/mfa/VerifyCode.js.map +1 -0
  80. package/dist/mjs/types/Interface/api/mfa/VerifyRecoveryCode.d.ts +5 -0
  81. package/dist/mjs/types/Interface/api/mfa/VerifyRecoveryCode.d.ts.map +1 -0
  82. package/dist/mjs/types/Interface/api/mfa/VerifyRecoveryCode.js +25 -0
  83. package/dist/mjs/types/Interface/api/mfa/VerifyRecoveryCode.js.map +1 -0
  84. package/dist/mjs/types/Interface/api/mfa/mfa.d.ts +19 -0
  85. package/dist/mjs/types/Interface/api/mfa/mfa.d.ts.map +1 -0
  86. package/dist/mjs/types/Interface/api/mfa/mfa.js +2 -0
  87. package/dist/mjs/types/Interface/api/mfa/mfa.js.map +1 -0
  88. package/dist/mjs/types/Interface/models/IUser.d.ts +1 -0
  89. package/dist/mjs/types/Interface/models/IUser.d.ts.map +1 -1
  90. package/dist/mjs/types/Interface/models/IUser.js.map +1 -1
  91. package/dist/mjs/types/Interface/models/IUserMfa.d.ts +12 -0
  92. package/dist/mjs/types/Interface/models/IUserMfa.d.ts.map +1 -0
  93. package/dist/mjs/types/Interface/models/IUserMfa.js +2 -0
  94. package/dist/mjs/types/Interface/models/IUserMfa.js.map +1 -0
  95. package/dist/mjs/types/Interface/models/IUserMfaRecoveryCode.d.ts +9 -0
  96. package/dist/mjs/types/Interface/models/IUserMfaRecoveryCode.d.ts.map +1 -0
  97. package/dist/mjs/types/Interface/models/IUserMfaRecoveryCode.js +2 -0
  98. package/dist/mjs/types/Interface/models/IUserMfaRecoveryCode.js.map +1 -0
  99. package/dist/mjs/types/index.d.ts +1 -0
  100. package/dist/mjs/types/index.d.ts.map +1 -1
  101. package/dist/mjs/types/index.js +1 -0
  102. package/dist/mjs/types/index.js.map +1 -1
  103. package/package.json +1 -1
  104. package/ts/api/resources/Mfa.ts +29 -0
  105. package/ts/api/resources.ts +2 -0
  106. package/ts/types/Interface/api/authentification/AuthenticationResponse.ts +6 -0
  107. package/ts/types/Interface/api/mfa/DisableMfa.ts +7 -0
  108. package/ts/types/Interface/api/mfa/SetupInit.ts +11 -0
  109. package/ts/types/Interface/api/mfa/SetupVerify.ts +11 -0
  110. package/ts/types/Interface/api/mfa/VerifyCode.ts +11 -0
  111. package/ts/types/Interface/api/mfa/VerifyRecoveryCode.ts +11 -0
  112. package/ts/types/Interface/api/mfa/mfa.ts +21 -0
  113. package/ts/types/Interface/models/IUser.ts +1 -0
  114. package/ts/types/Interface/models/IUserMfa.ts +11 -0
  115. package/ts/types/Interface/models/IUserMfaRecoveryCode.ts +8 -0
  116. package/ts/types/index.ts +1 -0
@@ -0,0 +1,29 @@
1
+ import { MfaSetupInitResult, MfaSetupVerifyResult } from '../../types/Interface/api/mfa/mfa';
2
+ import { Resource } from '../Resource';
3
+
4
+ export class UserMfa extends Resource {
5
+ setupInit(userId: number, userEmail: string): Promise<MfaSetupInitResult> {
6
+ return this.axios.$post('/mfa/setup/init', { userId, userEmail });
7
+ }
8
+
9
+ setupVerify(userId: number, code: string): Promise<MfaSetupVerifyResult> {
10
+ return this.axios.$post('/mfa/setup/verify', { userId, code });
11
+ }
12
+
13
+ disable(userId: number): Promise<boolean> {
14
+ return this.axios.$post('/mfa/disable', { userId });
15
+ }
16
+
17
+ verifyCode(userId: number, code: string): Promise<{ success: boolean; token?: string }> {
18
+ return this.axios.$post('/mfa/verify/code', { userId, code });
19
+ }
20
+
21
+ verifyRecoveryCode(userId: number, recoveryCode: string): Promise<{ success: boolean; token?: string }> {
22
+ return this.axios.$post('/mfa/verify/recovery-code', { userId, recoveryCode });
23
+ }
24
+
25
+ isMfaEnabled(userId?: number): Promise<{ isEnabled: boolean }> {
26
+ // Si userId est fourni, l'envoyer en query param, sinon vérifier l'user connecté
27
+ return this.axios.$get('/mfa/is-enabled', userId ? { params: { userId } } : undefined);
28
+ }
29
+ }
@@ -181,6 +181,7 @@ import { Gdpr } from './resources/Gdpr';
181
181
  import { Sellsy } from './resources/Sellsy';
182
182
  import { BankDedup } from './resources/BankDedup';
183
183
  import { StripePurchase } from './resources/StripePurchase';
184
+ import { UserMfa } from './resources/Mfa';
184
185
  import { DashboardLayout } from './resources/DashboardLayout';
185
186
  import { DocumentRequest } from './resources/DocumentRequest';
186
187
  import { BalanceSheetReport } from './resources/BalanceSheetReport';
@@ -321,6 +322,7 @@ export const resources = {
321
322
  visualizedInformation: VisualizedInformation,
322
323
  fusion: Fusion,
323
324
  salesContract: SalesContract,
325
+ userMfa: UserMfa,
324
326
  leadsToPartners: LeadsToPartners,
325
327
  changeLog: ChangeLog,
326
328
  constitutionHistory: ConstitutionHistory,
@@ -0,0 +1,6 @@
1
+ export interface IAuthenticationResponse {
2
+ requiresMfa?: boolean;
3
+ userId?: number;
4
+ message?: string;
5
+ token?: string;
6
+ }
@@ -0,0 +1,7 @@
1
+ import { IsInt, IsNotEmpty } from 'class-validator';
2
+
3
+ export class MfaDisable {
4
+ @IsNotEmpty()
5
+ @IsInt()
6
+ userId: number;
7
+ }
@@ -0,0 +1,11 @@
1
+ import { IsEmail, IsInt, IsNotEmpty, IsString } from 'class-validator';
2
+
3
+ export class MfaSetupInit {
4
+ @IsNotEmpty()
5
+ @IsInt()
6
+ userId: number;
7
+
8
+ @IsEmail()
9
+ @IsString()
10
+ userEmail: string;
11
+ }
@@ -0,0 +1,11 @@
1
+ import { IsInt, IsNotEmpty, IsString } from 'class-validator';
2
+
3
+ export class MfaSetupVerify {
4
+ @IsNotEmpty()
5
+ @IsInt()
6
+ userId: number;
7
+
8
+ @IsNotEmpty()
9
+ @IsString()
10
+ code: string;
11
+ }
@@ -0,0 +1,11 @@
1
+ import { IsInt, IsNotEmpty, IsString, Length } from 'class-validator';
2
+
3
+ export class MfaVerifyCode {
4
+ @IsNotEmpty()
5
+ @IsInt()
6
+ userId: number;
7
+
8
+ @IsString()
9
+ @Length(6, 6)
10
+ code: string;
11
+ }
@@ -0,0 +1,11 @@
1
+ import { IsInt, IsNotEmpty, IsString } from 'class-validator';
2
+
3
+ export class MfaVerifyRecoveryCode {
4
+ @IsNotEmpty()
5
+ @IsInt()
6
+ userId: number;
7
+
8
+ @IsString()
9
+ @IsNotEmpty()
10
+ recoveryCode: string;
11
+ }
@@ -0,0 +1,21 @@
1
+ export interface MfaSetupInitResult {
2
+ otpauthUri: string;
3
+ tempSecret: string;
4
+ label: string;
5
+ }
6
+
7
+ export interface MfaSetupVerifyResult {
8
+ success: boolean;
9
+ recoveryCodes: string[];
10
+ }
11
+
12
+ export interface MfaAuthenticationResponse {
13
+ requiresMfa: boolean;
14
+ userId?: number;
15
+ token?: string;
16
+ }
17
+
18
+ export interface MfaVerificationResponse {
19
+ success: boolean;
20
+ token?: string;
21
+ }
@@ -51,6 +51,7 @@ export interface IUser {
51
51
  textMessageNumber?: string | null;
52
52
  prefix?: string | null;
53
53
  tokenLostPassword?: string | null;
54
+ twoFactorEnabled?: boolean | null;
54
55
  tokenApi?: string | null;
55
56
  tokenNotification?: string | null;
56
57
  tokenSocket?: string | null;
@@ -0,0 +1,11 @@
1
+ export interface IUserMfa {
2
+ idUserMfa: number;
3
+ idUser: number;
4
+ method: 'totp' | 'sms' | 'email';
5
+ secretEnc: string;
6
+ tempSecretEnc: string;
7
+ verifiedAt: Date;
8
+ isPrimary: boolean;
9
+ createdAt?: Date;
10
+ updatedAt?: Date;
11
+ }
@@ -0,0 +1,8 @@
1
+ export interface IUserMfaRecoveryCode {
2
+ id: number;
3
+ idUserMfa: number;
4
+ recoveryCodeEnc: string; // haché, jamais en clair
5
+ usedAt: Date | null; // nullable
6
+ createdAt?: Date;
7
+ updatedAt?: Date;
8
+ }
package/ts/types/index.ts CHANGED
@@ -557,6 +557,7 @@ export * from './Enum/PartneredAccountantServiceTypeId';
557
557
  export * from './Enum/PaymentAttempt';
558
558
 
559
559
  // Interfaces API
560
+ export * from './Interface/api/authentification/AuthenticationResponse';
560
561
  export * from './Interface/api/exercice/ReadExercice';
561
562
  export * from './Interface/api/balanceSheet/consistency/Read';
562
563
  export * from './Interface/api/kilometricAllowance/ReadKilometricAllowance';