gitlab-org--gitlab-foss/spec/javascripts/u2f/mock_u2f_device.js

29 lines
929 B
JavaScript
Raw Normal View History

2017-10-09 18:21:56 -04:00
/* eslint-disable prefer-rest-params, wrap-iife,
no-unused-expressions, no-return-assign, no-param-reassign*/
2017-10-09 18:21:56 -04:00
export default class MockU2FDevice {
constructor() {
this.respondToAuthenticateRequest = this.respondToAuthenticateRequest.bind(this);
this.respondToRegisterRequest = this.respondToRegisterRequest.bind(this);
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);
}
2016-07-24 16:45:11 -04:00
2017-10-09 18:21:56 -04:00
respondToRegisterRequest(params) {
return this.registerCallback(params);
}
2016-07-24 16:45:11 -04:00
2017-10-09 18:21:56 -04:00
respondToAuthenticateRequest(params) {
return this.authenticateCallback(params);
}
}