debian-mirror-gitlab/spec/javascripts/u2f/mock_u2f_device.js

32 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-08-17 22:00:37 +05:30
/* eslint-disable space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-unused-expressions, no-return-assign, no-param-reassign, max-len */
2016-09-13 17:45:13 +05:30
(function() {
this.MockU2FDevice = (function() {
function MockU2FDevice() {
2017-09-10 17:25:29 +05:30
this.respondToAuthenticateRequest = this.respondToAuthenticateRequest.bind(this);
this.respondToRegisterRequest = this.respondToRegisterRequest.bind(this);
2016-09-13 17:45:13 +05:30
window.u2f || (window.u2f = {});
window.u2f.register = (function(_this) {
return function(appId, registerRequests, signRequests, callback) {
return _this.registerCallback = callback;
};
})(this);
window.u2f.sign = (function(_this) {
return function(appId, challenges, signRequests, callback) {
return _this.authenticateCallback = callback;
};
})(this);
}
MockU2FDevice.prototype.respondToRegisterRequest = function(params) {
return this.registerCallback(params);
};
MockU2FDevice.prototype.respondToAuthenticateRequest = function(params) {
return this.authenticateCallback(params);
};
return MockU2FDevice;
})();
2017-08-17 22:00:37 +05:30
}).call(window);