2019-12-26 22:10:19 +05:30
|
|
|
/* eslint-disable no-unused-expressions */
|
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 = {});
|
2019-12-26 22:10:19 +05:30
|
|
|
window.u2f.register = (appId, registerRequests, signRequests, callback) => {
|
|
|
|
this.registerCallback = callback;
|
|
|
|
};
|
|
|
|
window.u2f.sign = (appId, challenges, signRequests, callback) => {
|
|
|
|
this.authenticateCallback = callback;
|
|
|
|
};
|
2018-03-17 18:26:18 +05:30
|
|
|
}
|
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);
|
|
|
|
}
|
|
|
|
}
|