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

28 lines
899 B
JavaScript
Raw Normal View History

2018-12-13 13:39:08 +05:30
/* eslint-disable no-unused-expressions, no-return-assign, no-param-reassign */
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
export default class MockU2FDevice {
constructor() {
this.respondToAuthenticateRequest = this.respondToAuthenticateRequest.bind(this);
this.respondToRegisterRequest = this.respondToRegisterRequest.bind(this);
window.u2f || (window.u2f = {});
2018-12-13 13:39:08 +05:30
window.u2f.register = (function(_this) {
return function(appId, registerRequests, signRequests, callback) {
return (_this.registerCallback = callback);
2018-03-17 18:26:18 +05:30
};
})(this);
2018-12-13 13:39:08 +05:30
window.u2f.sign = (function(_this) {
return function(appId, challenges, signRequests, callback) {
return (_this.authenticateCallback = callback);
2018-03-17 18:26:18 +05:30
};
})(this);
}
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
respondToRegisterRequest(params) {
return this.registerCallback(params);
}
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
respondToAuthenticateRequest(params) {
return this.authenticateCallback(params);
}
}