authenticators.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. export function Authenticators() {
  2. return {
  3. Totp: params => ({
  4. lastUsedAt: null,
  5. enrollButton: 'Enroll',
  6. description:
  7. 'An authenticator application that supports TOTP (like Google Authenticator or 1Password) can be used to conveniently secure your account. A new token is generated every 30 seconds.',
  8. isEnrolled: true,
  9. removeButton: 'Remove',
  10. id: 'totp',
  11. createdAt: '2018-01-30T17:24:36.554Z',
  12. configureButton: 'Info',
  13. name: 'Authenticator App',
  14. allowMultiEnrollment: false,
  15. authId: '15',
  16. canValidateOtp: true,
  17. isBackupInterface: false,
  18. ...params,
  19. }),
  20. Sms: params => ({
  21. enrollButton: 'Enroll',
  22. name: 'Text Message',
  23. allowMultiEnrollment: false,
  24. removeButton: 'Remove',
  25. canValidateOtp: true,
  26. isEnrolled: false,
  27. configureButton: 'Info',
  28. id: 'sms',
  29. isBackupInterface: false,
  30. description:
  31. "This authenticator sends you text messages for verification. It's useful as a backup method or when you do not have a phone that supports an authenticator application.",
  32. ...params,
  33. }),
  34. U2f: params => ({
  35. lastUsedAt: null,
  36. enrollButton: 'Enroll',
  37. description:
  38. "Authenticate with a U2F hardware device. This is a device like a Yubikey or something similar which supports FIDO's U2F specification. This also requires a browser which supports this system (like Google Chrome).",
  39. isEnrolled: true,
  40. removeButton: 'Remove',
  41. id: 'u2f',
  42. createdAt: '2018-01-30T20:56:45.932Z',
  43. configureButton: 'Configure',
  44. name: 'U2F (Universal 2nd Factor)',
  45. allowMultiEnrollment: true,
  46. authId: '23',
  47. canValidateOtp: false,
  48. isBackupInterface: false,
  49. ...params,
  50. }),
  51. Recovery: params => ({
  52. lastUsedAt: null,
  53. enrollButton: 'Activate',
  54. description:
  55. 'Recovery codes are the only way to access your account if you lose your device and cannot receive two-factor authentication codes.',
  56. isEnrolled: true,
  57. removeButton: null,
  58. id: 'recovery',
  59. createdAt: '2018-01-30T17:24:36.570Z',
  60. configureButton: 'View Codes',
  61. name: 'Recovery Codes',
  62. allowMultiEnrollment: false,
  63. authId: '16',
  64. canValidateOtp: true,
  65. isBackupInterface: true,
  66. codes: ['ABCD-1234', 'EFGH-5678'],
  67. ...params,
  68. }),
  69. };
  70. }
  71. export function AllAuthenticators() {
  72. return Object.values(Authenticators()).map(x => x());
  73. }