2018-10-09 15:25:53 +00:00
|
|
|
/* eslint-disable no-unused-expressions, no-return-assign, no-param-reassign */
|
2017-01-12 04:27:41 +00:00
|
|
|
|
2017-10-09 22:21:56 +00:00
|
|
|
export default class MockU2FDevice {
|
|
|
|
constructor() {
|
|
|
|
this.respondToAuthenticateRequest = this.respondToAuthenticateRequest.bind(this);
|
|
|
|
this.respondToRegisterRequest = this.respondToRegisterRequest.bind(this);
|
|
|
|
window.u2f || (window.u2f = {});
|
2018-10-17 07:13:26 +00:00
|
|
|
window.u2f.register = (function(_this) {
|
|
|
|
return function(appId, registerRequests, signRequests, callback) {
|
|
|
|
return (_this.registerCallback = callback);
|
2017-10-09 22:21:56 +00:00
|
|
|
};
|
|
|
|
})(this);
|
2018-10-17 07:13:26 +00:00
|
|
|
window.u2f.sign = (function(_this) {
|
|
|
|
return function(appId, challenges, signRequests, callback) {
|
|
|
|
return (_this.authenticateCallback = callback);
|
2017-10-09 22:21:56 +00:00
|
|
|
};
|
|
|
|
})(this);
|
|
|
|
}
|
2016-07-24 20:45:11 +00:00
|
|
|
|
2017-10-09 22:21:56 +00:00
|
|
|
respondToRegisterRequest(params) {
|
|
|
|
return this.registerCallback(params);
|
|
|
|
}
|
2016-07-24 20:45:11 +00:00
|
|
|
|
2017-10-09 22:21:56 +00:00
|
|
|
respondToAuthenticateRequest(params) {
|
|
|
|
return this.authenticateCallback(params);
|
|
|
|
}
|
|
|
|
}
|