128549f10b
- Move the `TwoFactorAuthsController`'s `new` action to `show`, since the page is not used to create a single "two factor auth" anymore. We can have a single 2FA authenticator app, along with any number of U2F devices, in any combination, so the page will be accessed after the first "two factor auth" is created. - Add the `u2f` javascript library, which provides an API to the browser's U2F implementation. - Add tests for the JS components
15 lines
438 B
CoffeeScript
15 lines
438 B
CoffeeScript
class @MockU2FDevice
|
|
constructor: () ->
|
|
window.u2f ||= {}
|
|
|
|
window.u2f.register = (appId, registerRequests, signRequests, callback) =>
|
|
@registerCallback = callback
|
|
|
|
window.u2f.sign = (appId, challenges, signRequests, callback) =>
|
|
@authenticateCallback = callback
|
|
|
|
respondToRegisterRequest: (params) =>
|
|
@registerCallback(params)
|
|
|
|
respondToAuthenticateRequest: (params) =>
|
|
@authenticateCallback(params)
|