2019-10-31 14:06:53 -04:00
|
|
|
/* eslint-disable no-unused-expressions */
|
2017-01-11 23:27:41 -05:00
|
|
|
|
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 = {});
|
2019-10-31 14:06:53 -04:00
|
|
|
window.u2f.register = (appId, registerRequests, signRequests, callback) => {
|
|
|
|
this.registerCallback = callback;
|
|
|
|
};
|
|
|
|
window.u2f.sign = (appId, challenges, signRequests, callback) => {
|
|
|
|
this.authenticateCallback = callback;
|
|
|
|
};
|
2017-10-09 18:21:56 -04:00
|
|
|
}
|
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);
|
|
|
|
}
|
|
|
|
}
|