diff --git a/keepassxc-browser/content/webauthn.js b/keepassxc-browser/content/webauthn.js new file mode 100644 index 0000000..ea68b8a --- /dev/null +++ b/keepassxc-browser/content/webauthn.js @@ -0,0 +1,30 @@ +'use strict'; + +(async () => { + + + const webauthnCredentials = { + async create(options) { + console.log('Overridden create'); + + //await browser.runtime.sendMessage({ action: 'request_autotype', args: [ window.location.hostname ] }); + window.postMessage({ action: 'webauthn-create' }, window.location.origin); + await waitForCreateResponse(); + }, + async get(options) { + console.log('Overridden get'); + } + }; + + try { + Object.assign(navigator.credentials, webauthnCredentials); + } catch (err) { + console.log(err); + } + + window.addEventListener('message', (ev) => { + if (ev.data.action === 'webauthn-create-response') { + console.log('Response received!'); + } + }); +})();