authenticators.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. disallowNewEnrollment: false,
  16. authId: '15',
  17. canValidateOtp: true,
  18. isBackupInterface: false,
  19. ...params,
  20. }),
  21. Sms: params => ({
  22. enrollButton: 'Enroll',
  23. name: 'Text Message',
  24. allowMultiEnrollment: false,
  25. removeButton: 'Remove',
  26. canValidateOtp: true,
  27. isEnrolled: false,
  28. configureButton: 'Info',
  29. id: 'sms',
  30. isBackupInterface: false,
  31. disallowNewEnrollment: false,
  32. description:
  33. "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.",
  34. ...params,
  35. }),
  36. U2f: params => ({
  37. lastUsedAt: null,
  38. enrollButton: 'Enroll',
  39. description:
  40. "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).",
  41. isEnrolled: true,
  42. removeButton: 'Remove',
  43. id: 'u2f',
  44. createdAt: '2018-01-30T20:56:45.932Z',
  45. configureButton: 'Configure',
  46. name: 'U2F (Universal 2nd Factor)',
  47. allowMultiEnrollment: true,
  48. disallowNewEnrollment: false,
  49. authId: '23',
  50. canValidateOtp: false,
  51. isBackupInterface: false,
  52. ...params,
  53. }),
  54. Recovery: params => ({
  55. lastUsedAt: null,
  56. enrollButton: 'Activate',
  57. description:
  58. 'Recovery codes are the only way to access your account if you lose your device and cannot receive two-factor authentication codes.',
  59. isEnrolled: true,
  60. removeButton: null,
  61. id: 'recovery',
  62. createdAt: '2018-01-30T17:24:36.570Z',
  63. configureButton: 'View Codes',
  64. name: 'Recovery Codes',
  65. allowMultiEnrollment: false,
  66. authId: '16',
  67. canValidateOtp: true,
  68. isBackupInterface: true,
  69. codes: ['ABCD-1234', 'EFGH-5678'],
  70. ...params,
  71. }),
  72. };
  73. }
  74. export function AllAuthenticators() {
  75. return Object.values(Authenticators()).map(x => x());
  76. }