@appwrite.io/console 0.6.0-rc.14 → 0.6.0-rc.15

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 (37) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/sdk.js +217 -70
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +218 -71
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/dist/iife/sdk.js +217 -70
  7. package/docs/examples/account/{add-authenticator.md → create-mfa-authenticator.md} +3 -3
  8. package/docs/examples/account/{create-challenge.md → create-mfa-challenge.md} +3 -3
  9. package/docs/examples/account/create-mfa-recovery-codes.md +11 -0
  10. package/docs/examples/account/{verify-authenticator.md → delete-mfa-authenticator.md} +3 -3
  11. package/docs/examples/account/get-mfa-recovery-codes.md +11 -0
  12. package/docs/examples/account/{list-factors.md → list-mfa-factors.md} +1 -1
  13. package/docs/examples/account/{delete-authenticator.md → update-mfa-authenticator.md} +3 -3
  14. package/docs/examples/account/{update-challenge.md → update-mfa-challenge.md} +1 -1
  15. package/docs/examples/account/update-mfa-recovery-codes.md +11 -0
  16. package/docs/examples/users/create-mfa-recovery-codes.md +13 -0
  17. package/docs/examples/users/{delete-authenticator.md → delete-mfa-authenticator.md} +3 -3
  18. package/docs/examples/users/get-mfa-recovery-codes.md +13 -0
  19. package/docs/examples/users/{list-factors.md → list-mfa-factors.md} +1 -1
  20. package/docs/examples/users/update-mfa-recovery-codes.md +13 -0
  21. package/package.json +1 -1
  22. package/src/client.ts +1 -1
  23. package/src/enums/{authentication-factor.ts → factor.ts} +4 -3
  24. package/src/enums/type.ts +3 -0
  25. package/src/index.ts +2 -2
  26. package/src/models.ts +13 -8
  27. package/src/services/account.ts +130 -59
  28. package/src/services/users.ts +88 -10
  29. package/types/enums/factor.d.ts +6 -0
  30. package/types/enums/type.d.ts +3 -0
  31. package/types/index.d.ts +2 -2
  32. package/types/models.d.ts +13 -8
  33. package/types/services/account.d.ts +69 -25
  34. package/types/services/users.d.ts +45 -6
  35. package/src/enums/authenticator-type.ts +0 -3
  36. package/types/enums/authentication-factor.d.ts +0 -5
  37. package/types/enums/authenticator-type.d.ts +0 -3
package/src/models.ts CHANGED
@@ -1186,10 +1186,6 @@ export namespace Models {
1186
1186
  * Multi factor authentication status.
1187
1187
  */
1188
1188
  mfa: boolean;
1189
- /**
1190
- * TOTP status.
1191
- */
1192
- totp: boolean;
1193
1189
  /**
1194
1190
  * User preferences as a key-value object
1195
1191
  */
@@ -1424,6 +1420,10 @@ export namespace Models {
1424
1420
  * Secret used to authenticate the user. Only included if the request was made with an API key
1425
1421
  */
1426
1422
  secret: string;
1423
+ /**
1424
+ * Most recent date in ISO 8601 format when the session successfully passed MFA challenge.
1425
+ */
1426
+ mfaUpdatedAt: string;
1427
1427
  }
1428
1428
  /**
1429
1429
  * Identity
@@ -3240,13 +3240,18 @@ export namespace Models {
3240
3240
  expire: string;
3241
3241
  }
3242
3242
  /**
3243
- * MFAType
3243
+ * MFA Recovery Codes
3244
3244
  */
3245
- export type MfaType = {
3245
+ export type MfaRecoveryCodes = {
3246
3246
  /**
3247
- * Backup codes.
3247
+ * Recovery codes.
3248
3248
  */
3249
- backups: string[];
3249
+ recoveryCodes: string[];
3250
+ }
3251
+ /**
3252
+ * MFAType
3253
+ */
3254
+ export type MfaType = {
3250
3255
  /**
3251
3256
  * Secret token used for TOTP factor.
3252
3257
  */
@@ -2,8 +2,8 @@ import { Service } from '../service';
2
2
  import { AppwriteException, Client } from '../client';
3
3
  import type { Models } from '../models';
4
4
  import type { UploadProgress, Payload } from '../client';
5
- import { AuthenticationFactor } from '../enums/authentication-factor';
6
- import { AuthenticatorType } from '../enums/authenticator-type';
5
+ import { Type } from '../enums/type';
6
+ import { Factor } from '../enums/factor';
7
7
  import { OAuthProvider } from '../enums/o-auth-provider';
8
8
 
9
9
  export class Account extends Service {
@@ -267,15 +267,110 @@ export class Account extends Service {
267
267
  }, payload);
268
268
  }
269
269
 
270
+ /**
271
+ * Add Authenticator
272
+ *
273
+ * Add an authenticator app to be used as an MFA factor. Verify the
274
+ * authenticator using the [verify
275
+ * authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
276
+ * method.
277
+ *
278
+ * @param {Type} type
279
+ * @throws {AppwriteException}
280
+ * @returns {Promise}
281
+ */
282
+ async createMfaAuthenticator(type: Type): Promise<Models.MfaType> {
283
+ if (typeof type === 'undefined') {
284
+ throw new AppwriteException('Missing required parameter: "type"');
285
+ }
286
+
287
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
288
+ const payload: Payload = {};
289
+
290
+ const uri = new URL(this.client.config.endpoint + apiPath);
291
+ return await this.client.call('post', uri, {
292
+ 'content-type': 'application/json',
293
+ }, payload);
294
+ }
295
+
296
+ /**
297
+ * Verify Authenticator
298
+ *
299
+ * Verify an authenticator app after adding it using the [add
300
+ * authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
301
+ * method.
302
+ *
303
+ * @param {Type} type
304
+ * @param {string} otp
305
+ * @throws {AppwriteException}
306
+ * @returns {Promise}
307
+ */
308
+ async updateMfaAuthenticator<Preferences extends Models.Preferences>(type: Type, otp: string): Promise<Models.User<Preferences>> {
309
+ if (typeof type === 'undefined') {
310
+ throw new AppwriteException('Missing required parameter: "type"');
311
+ }
312
+
313
+ if (typeof otp === 'undefined') {
314
+ throw new AppwriteException('Missing required parameter: "otp"');
315
+ }
316
+
317
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
318
+ const payload: Payload = {};
319
+
320
+ if (typeof otp !== 'undefined') {
321
+ payload['otp'] = otp;
322
+ }
323
+
324
+ const uri = new URL(this.client.config.endpoint + apiPath);
325
+ return await this.client.call('put', uri, {
326
+ 'content-type': 'application/json',
327
+ }, payload);
328
+ }
329
+
330
+ /**
331
+ * Delete Authenticator
332
+ *
333
+ * Delete an authenticator for a user by ID.
334
+ *
335
+ * @param {Type} type
336
+ * @param {string} otp
337
+ * @throws {AppwriteException}
338
+ * @returns {Promise}
339
+ */
340
+ async deleteMfaAuthenticator<Preferences extends Models.Preferences>(type: Type, otp: string): Promise<Models.User<Preferences>> {
341
+ if (typeof type === 'undefined') {
342
+ throw new AppwriteException('Missing required parameter: "type"');
343
+ }
344
+
345
+ if (typeof otp === 'undefined') {
346
+ throw new AppwriteException('Missing required parameter: "otp"');
347
+ }
348
+
349
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
350
+ const payload: Payload = {};
351
+
352
+ if (typeof otp !== 'undefined') {
353
+ payload['otp'] = otp;
354
+ }
355
+
356
+ const uri = new URL(this.client.config.endpoint + apiPath);
357
+ return await this.client.call('delete', uri, {
358
+ 'content-type': 'application/json',
359
+ }, payload);
360
+ }
361
+
270
362
  /**
271
363
  * Create 2FA Challenge
272
364
  *
365
+ * Begin the process of MFA verification after sign-in. Finish the flow with
366
+ * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
367
+ * method.
273
368
  *
274
- * @param {AuthenticationFactor} factor
369
+ * @param {Factor} factor
275
370
  * @throws {AppwriteException}
276
371
  * @returns {Promise}
277
372
  */
278
- async createChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge> {
373
+ async createMfaChallenge(factor: Factor): Promise<Models.MfaChallenge> {
279
374
  if (typeof factor === 'undefined') {
280
375
  throw new AppwriteException('Missing required parameter: "factor"');
281
376
  }
@@ -296,14 +391,18 @@ export class Account extends Service {
296
391
  /**
297
392
  * Create MFA Challenge (confirmation)
298
393
  *
299
- * Complete the MFA challenge by providing the one-time password.
394
+ * Complete the MFA challenge by providing the one-time password. Finish the
395
+ * process of MFA verification by providing the one-time password. To begin
396
+ * the flow, use
397
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
398
+ * method.
300
399
  *
301
400
  * @param {string} challengeId
302
401
  * @param {string} otp
303
402
  * @throws {AppwriteException}
304
403
  * @returns {Promise}
305
404
  */
306
- async updateChallenge(challengeId: string, otp: string): Promise<{}> {
405
+ async updateMfaChallenge(challengeId: string, otp: string): Promise<{}> {
307
406
  if (typeof challengeId === 'undefined') {
308
407
  throw new AppwriteException('Missing required parameter: "challengeId"');
309
408
  }
@@ -337,7 +436,7 @@ export class Account extends Service {
337
436
  * @throws {AppwriteException}
338
437
  * @returns {Promise}
339
438
  */
340
- async listFactors(): Promise<Models.MfaFactors> {
439
+ async listMfaFactors(): Promise<Models.MfaFactors> {
341
440
  const apiPath = '/account/mfa/factors';
342
441
  const payload: Payload = {};
343
442
 
@@ -348,93 +447,65 @@ export class Account extends Service {
348
447
  }
349
448
 
350
449
  /**
351
- * Add Authenticator
450
+ * Get MFA Recovery Codes
352
451
  *
353
- * Add an authenticator app to be used as an MFA factor. Verify the
354
- * authenticator using the [verify
355
- * authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
356
- * method.
452
+ * Get recovery codes that can be used as backup for MFA flow. Before getting
453
+ * codes, they must be generated using
454
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
455
+ * method. An OTP challenge is required to read recovery codes.
357
456
  *
358
- * @param {AuthenticatorType} type
359
457
  * @throws {AppwriteException}
360
458
  * @returns {Promise}
361
459
  */
362
- async addAuthenticator(type: AuthenticatorType): Promise<Models.MfaType> {
363
- if (typeof type === 'undefined') {
364
- throw new AppwriteException('Missing required parameter: "type"');
365
- }
366
-
367
- const apiPath = '/account/mfa/{type}'.replace('{type}', type);
460
+ async getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
461
+ const apiPath = '/account/mfa/recovery-codes';
368
462
  const payload: Payload = {};
369
463
 
370
464
  const uri = new URL(this.client.config.endpoint + apiPath);
371
- return await this.client.call('post', uri, {
465
+ return await this.client.call('get', uri, {
372
466
  'content-type': 'application/json',
373
467
  }, payload);
374
468
  }
375
469
 
376
470
  /**
377
- * Verify Authenticator
471
+ * Create MFA Recovery Codes
378
472
  *
379
- * Verify an authenticator app after adding it using the [add
380
- * authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
473
+ * Generate recovery codes as backup for MFA flow. It's recommended to
474
+ * generate and show then immediately after user successfully adds their
475
+ * authehticator. Recovery codes can be used as a MFA verification type in
476
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
381
477
  * method.
382
478
  *
383
- * @param {AuthenticatorType} type
384
- * @param {string} otp
385
479
  * @throws {AppwriteException}
386
480
  * @returns {Promise}
387
481
  */
388
- async verifyAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
389
- if (typeof type === 'undefined') {
390
- throw new AppwriteException('Missing required parameter: "type"');
391
- }
392
-
393
- if (typeof otp === 'undefined') {
394
- throw new AppwriteException('Missing required parameter: "otp"');
395
- }
396
-
397
- const apiPath = '/account/mfa/{type}'.replace('{type}', type);
482
+ async createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
483
+ const apiPath = '/account/mfa/recovery-codes';
398
484
  const payload: Payload = {};
399
485
 
400
- if (typeof otp !== 'undefined') {
401
- payload['otp'] = otp;
402
- }
403
-
404
486
  const uri = new URL(this.client.config.endpoint + apiPath);
405
- return await this.client.call('put', uri, {
487
+ return await this.client.call('post', uri, {
406
488
  'content-type': 'application/json',
407
489
  }, payload);
408
490
  }
409
491
 
410
492
  /**
411
- * Delete Authenticator
493
+ * Regenerate MFA Recovery Codes
412
494
  *
413
- * Delete an authenticator for a user by ID.
495
+ * Regenerate recovery codes that can be used as backup for MFA flow. Before
496
+ * regenerating codes, they must be first generated using
497
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
498
+ * method. An OTP challenge is required to regenreate recovery codes.
414
499
  *
415
- * @param {AuthenticatorType} type
416
- * @param {string} otp
417
500
  * @throws {AppwriteException}
418
501
  * @returns {Promise}
419
502
  */
420
- async deleteAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
421
- if (typeof type === 'undefined') {
422
- throw new AppwriteException('Missing required parameter: "type"');
423
- }
424
-
425
- if (typeof otp === 'undefined') {
426
- throw new AppwriteException('Missing required parameter: "otp"');
427
- }
428
-
429
- const apiPath = '/account/mfa/{type}'.replace('{type}', type);
503
+ async updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
504
+ const apiPath = '/account/mfa/recovery-codes';
430
505
  const payload: Payload = {};
431
506
 
432
- if (typeof otp !== 'undefined') {
433
- payload['otp'] = otp;
434
- }
435
-
436
507
  const uri = new URL(this.client.config.endpoint + apiPath);
437
- return await this.client.call('delete', uri, {
508
+ return await this.client.call('patch', uri, {
438
509
  'content-type': 'application/json',
439
510
  }, payload);
440
511
  }
@@ -4,7 +4,7 @@ import type { Models } from '../models';
4
4
  import type { UploadProgress, Payload } from '../client';
5
5
  import { PasswordHash } from '../enums/password-hash';
6
6
  import { UserUsageRange } from '../enums/user-usage-range';
7
- import { AuthenticatorType } from '../enums/authenticator-type';
7
+ import { Type } from '../enums/type';
8
8
  import { MessagingProviderType } from '../enums/messaging-provider-type';
9
9
 
10
10
  export class Users extends Service {
@@ -815,6 +815,34 @@ export class Users extends Service {
815
815
  }, payload);
816
816
  }
817
817
 
818
+ /**
819
+ * Delete Authenticator
820
+ *
821
+ * Delete an authenticator app.
822
+ *
823
+ * @param {string} userId
824
+ * @param {Type} type
825
+ * @throws {AppwriteException}
826
+ * @returns {Promise}
827
+ */
828
+ async deleteMfaAuthenticator<Preferences extends Models.Preferences>(userId: string, type: Type): Promise<Models.User<Preferences>> {
829
+ if (typeof userId === 'undefined') {
830
+ throw new AppwriteException('Missing required parameter: "userId"');
831
+ }
832
+
833
+ if (typeof type === 'undefined') {
834
+ throw new AppwriteException('Missing required parameter: "type"');
835
+ }
836
+
837
+ const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type);
838
+ const payload: Payload = {};
839
+
840
+ const uri = new URL(this.client.config.endpoint + apiPath);
841
+ return await this.client.call('delete', uri, {
842
+ 'content-type': 'application/json',
843
+ }, payload);
844
+ }
845
+
818
846
  /**
819
847
  * List Factors
820
848
  *
@@ -824,7 +852,7 @@ export class Users extends Service {
824
852
  * @throws {AppwriteException}
825
853
  * @returns {Promise}
826
854
  */
827
- async listFactors(userId: string): Promise<Models.MfaFactors> {
855
+ async listMfaFactors(userId: string): Promise<Models.MfaFactors> {
828
856
  if (typeof userId === 'undefined') {
829
857
  throw new AppwriteException('Missing required parameter: "userId"');
830
858
  }
@@ -839,29 +867,79 @@ export class Users extends Service {
839
867
  }
840
868
 
841
869
  /**
842
- * Delete Authenticator
870
+ * Get MFA Recovery Codes
843
871
  *
844
- * Delete an authenticator app.
872
+ * Get recovery codes that can be used as backup for MFA flow by User ID.
873
+ * Before getting codes, they must be generated using
874
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
875
+ * method.
845
876
  *
846
877
  * @param {string} userId
847
- * @param {AuthenticatorType} type
848
878
  * @throws {AppwriteException}
849
879
  * @returns {Promise}
850
880
  */
851
- async deleteAuthenticator<Preferences extends Models.Preferences>(userId: string, type: AuthenticatorType): Promise<Models.User<Preferences>> {
881
+ async getMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes> {
852
882
  if (typeof userId === 'undefined') {
853
883
  throw new AppwriteException('Missing required parameter: "userId"');
854
884
  }
855
885
 
856
- if (typeof type === 'undefined') {
857
- throw new AppwriteException('Missing required parameter: "type"');
886
+ const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
887
+ const payload: Payload = {};
888
+
889
+ const uri = new URL(this.client.config.endpoint + apiPath);
890
+ return await this.client.call('get', uri, {
891
+ 'content-type': 'application/json',
892
+ }, payload);
893
+ }
894
+
895
+ /**
896
+ * Regenerate MFA Recovery Codes
897
+ *
898
+ * Regenerate recovery codes that can be used as backup for MFA flow by User
899
+ * ID. Before regenerating codes, they must be first generated using
900
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
901
+ * method.
902
+ *
903
+ * @param {string} userId
904
+ * @throws {AppwriteException}
905
+ * @returns {Promise}
906
+ */
907
+ async updateMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes> {
908
+ if (typeof userId === 'undefined') {
909
+ throw new AppwriteException('Missing required parameter: "userId"');
858
910
  }
859
911
 
860
- const apiPath = '/users/{userId}/mfa/{type}'.replace('{userId}', userId).replace('{type}', type);
912
+ const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
861
913
  const payload: Payload = {};
862
914
 
863
915
  const uri = new URL(this.client.config.endpoint + apiPath);
864
- return await this.client.call('delete', uri, {
916
+ return await this.client.call('put', uri, {
917
+ 'content-type': 'application/json',
918
+ }, payload);
919
+ }
920
+
921
+ /**
922
+ * Create MFA Recovery Codes
923
+ *
924
+ * Generate recovery codes used as backup for MFA flow for User ID. Recovery
925
+ * codes can be used as a MFA verification type in
926
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
927
+ * method by client SDK.
928
+ *
929
+ * @param {string} userId
930
+ * @throws {AppwriteException}
931
+ * @returns {Promise}
932
+ */
933
+ async createMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes> {
934
+ if (typeof userId === 'undefined') {
935
+ throw new AppwriteException('Missing required parameter: "userId"');
936
+ }
937
+
938
+ const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
939
+ const payload: Payload = {};
940
+
941
+ const uri = new URL(this.client.config.endpoint + apiPath);
942
+ return await this.client.call('patch', uri, {
865
943
  'content-type': 'application/json',
866
944
  }, payload);
867
945
  }
@@ -0,0 +1,6 @@
1
+ export declare enum Factor {
2
+ Email = "email",
3
+ Phone = "phone",
4
+ Totp = "totp",
5
+ Recoverycode = "recoverycode"
6
+ }
@@ -0,0 +1,3 @@
1
+ export declare enum Type {
2
+ Totp = "totp"
3
+ }
package/types/index.d.ts CHANGED
@@ -22,8 +22,8 @@ export type { QueryTypes, QueryTypesList } from './query';
22
22
  export { Permission } from './permission';
23
23
  export { Role } from './role';
24
24
  export { ID } from './id';
25
- export { AuthenticationFactor } from './enums/authentication-factor';
26
- export { AuthenticatorType } from './enums/authenticator-type';
25
+ export { Type } from './enums/type';
26
+ export { Factor } from './enums/factor';
27
27
  export { OAuthProvider } from './enums/o-auth-provider';
28
28
  export { Browser } from './enums/browser';
29
29
  export { CreditCard } from './enums/credit-card';
package/types/models.d.ts CHANGED
@@ -1186,10 +1186,6 @@ export declare namespace Models {
1186
1186
  * Multi factor authentication status.
1187
1187
  */
1188
1188
  mfa: boolean;
1189
- /**
1190
- * TOTP status.
1191
- */
1192
- totp: boolean;
1193
1189
  /**
1194
1190
  * User preferences as a key-value object
1195
1191
  */
@@ -1424,6 +1420,10 @@ export declare namespace Models {
1424
1420
  * Secret used to authenticate the user. Only included if the request was made with an API key
1425
1421
  */
1426
1422
  secret: string;
1423
+ /**
1424
+ * Most recent date in ISO 8601 format when the session successfully passed MFA challenge.
1425
+ */
1426
+ mfaUpdatedAt: string;
1427
1427
  };
1428
1428
  /**
1429
1429
  * Identity
@@ -3240,13 +3240,18 @@ export declare namespace Models {
3240
3240
  expire: string;
3241
3241
  };
3242
3242
  /**
3243
- * MFAType
3243
+ * MFA Recovery Codes
3244
3244
  */
3245
- type MfaType = {
3245
+ type MfaRecoveryCodes = {
3246
3246
  /**
3247
- * Backup codes.
3247
+ * Recovery codes.
3248
3248
  */
3249
- backups: string[];
3249
+ recoveryCodes: string[];
3250
+ };
3251
+ /**
3252
+ * MFAType
3253
+ */
3254
+ type MfaType = {
3250
3255
  /**
3251
3256
  * Secret token used for TOTP factor.
3252
3257
  */
@@ -1,8 +1,8 @@
1
1
  import { Service } from '../service';
2
2
  import { Client } from '../client';
3
3
  import type { Models } from '../models';
4
- import { AuthenticationFactor } from '../enums/authentication-factor';
5
- import { AuthenticatorType } from '../enums/authenticator-type';
4
+ import { Type } from '../enums/type';
5
+ import { Factor } from '../enums/factor';
6
6
  import { OAuthProvider } from '../enums/o-auth-provider';
7
7
  export declare class Account extends Service {
8
8
  constructor(client: Client);
@@ -115,26 +115,70 @@ export declare class Account extends Service {
115
115
  * @returns {Promise}
116
116
  */
117
117
  updateMFA<Preferences extends Models.Preferences>(mfa: boolean): Promise<Models.User<Preferences>>;
118
+ /**
119
+ * Add Authenticator
120
+ *
121
+ * Add an authenticator app to be used as an MFA factor. Verify the
122
+ * authenticator using the [verify
123
+ * authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
124
+ * method.
125
+ *
126
+ * @param {Type} type
127
+ * @throws {AppwriteException}
128
+ * @returns {Promise}
129
+ */
130
+ createMfaAuthenticator(type: Type): Promise<Models.MfaType>;
131
+ /**
132
+ * Verify Authenticator
133
+ *
134
+ * Verify an authenticator app after adding it using the [add
135
+ * authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
136
+ * method.
137
+ *
138
+ * @param {Type} type
139
+ * @param {string} otp
140
+ * @throws {AppwriteException}
141
+ * @returns {Promise}
142
+ */
143
+ updateMfaAuthenticator<Preferences extends Models.Preferences>(type: Type, otp: string): Promise<Models.User<Preferences>>;
144
+ /**
145
+ * Delete Authenticator
146
+ *
147
+ * Delete an authenticator for a user by ID.
148
+ *
149
+ * @param {Type} type
150
+ * @param {string} otp
151
+ * @throws {AppwriteException}
152
+ * @returns {Promise}
153
+ */
154
+ deleteMfaAuthenticator<Preferences extends Models.Preferences>(type: Type, otp: string): Promise<Models.User<Preferences>>;
118
155
  /**
119
156
  * Create 2FA Challenge
120
157
  *
158
+ * Begin the process of MFA verification after sign-in. Finish the flow with
159
+ * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
160
+ * method.
121
161
  *
122
- * @param {AuthenticationFactor} factor
162
+ * @param {Factor} factor
123
163
  * @throws {AppwriteException}
124
164
  * @returns {Promise}
125
165
  */
126
- createChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
166
+ createMfaChallenge(factor: Factor): Promise<Models.MfaChallenge>;
127
167
  /**
128
168
  * Create MFA Challenge (confirmation)
129
169
  *
130
- * Complete the MFA challenge by providing the one-time password.
170
+ * Complete the MFA challenge by providing the one-time password. Finish the
171
+ * process of MFA verification by providing the one-time password. To begin
172
+ * the flow, use
173
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
174
+ * method.
131
175
  *
132
176
  * @param {string} challengeId
133
177
  * @param {string} otp
134
178
  * @throws {AppwriteException}
135
179
  * @returns {Promise}
136
180
  */
137
- updateChallenge(challengeId: string, otp: string): Promise<{}>;
181
+ updateMfaChallenge(challengeId: string, otp: string): Promise<{}>;
138
182
  /**
139
183
  * List Factors
140
184
  *
@@ -143,44 +187,44 @@ export declare class Account extends Service {
143
187
  * @throws {AppwriteException}
144
188
  * @returns {Promise}
145
189
  */
146
- listFactors(): Promise<Models.MfaFactors>;
190
+ listMfaFactors(): Promise<Models.MfaFactors>;
147
191
  /**
148
- * Add Authenticator
192
+ * Get MFA Recovery Codes
149
193
  *
150
- * Add an authenticator app to be used as an MFA factor. Verify the
151
- * authenticator using the [verify
152
- * authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
153
- * method.
194
+ * Get recovery codes that can be used as backup for MFA flow. Before getting
195
+ * codes, they must be generated using
196
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
197
+ * method. An OTP challenge is required to read recovery codes.
154
198
  *
155
- * @param {AuthenticatorType} type
156
199
  * @throws {AppwriteException}
157
200
  * @returns {Promise}
158
201
  */
159
- addAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
202
+ getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
160
203
  /**
161
- * Verify Authenticator
204
+ * Create MFA Recovery Codes
162
205
  *
163
- * Verify an authenticator app after adding it using the [add
164
- * authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
206
+ * Generate recovery codes as backup for MFA flow. It's recommended to
207
+ * generate and show then immediately after user successfully adds their
208
+ * authehticator. Recovery codes can be used as a MFA verification type in
209
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
165
210
  * method.
166
211
  *
167
- * @param {AuthenticatorType} type
168
- * @param {string} otp
169
212
  * @throws {AppwriteException}
170
213
  * @returns {Promise}
171
214
  */
172
- verifyAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
215
+ createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
173
216
  /**
174
- * Delete Authenticator
217
+ * Regenerate MFA Recovery Codes
175
218
  *
176
- * Delete an authenticator for a user by ID.
219
+ * Regenerate recovery codes that can be used as backup for MFA flow. Before
220
+ * regenerating codes, they must be first generated using
221
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
222
+ * method. An OTP challenge is required to regenreate recovery codes.
177
223
  *
178
- * @param {AuthenticatorType} type
179
- * @param {string} otp
180
224
  * @throws {AppwriteException}
181
225
  * @returns {Promise}
182
226
  */
183
- deleteAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
227
+ updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
184
228
  /**
185
229
  * Update name
186
230
  *