debian-mirror-gitlab/spec/javascripts/u2f/mock_u2f_device.js.coffee
2016-06-16 23:09:34 +05:30

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)