diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index ef6ea1d..d093261 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -843,3 +843,19 @@ browser.runtime.onMessage.addListener(async function(req, sender) { } } }); + +// Webauthn +const webauthn = document.createElement('script'); +webauthn.src = browser.runtime.getURL('content/webauthn.js'); +document.documentElement.appendChild(webauthn); + +window.addEventListener('message', (ev) => { + if (ev.data.action === 'webauthn-create') { + console.log('Request from: ', ev.origin); + + // Send a test response after a delay + setInterval(() => { + window.postMessage({ action: 'webauthn-create-response' }, window.location.origin); + }, 2000); + } +}); diff --git a/keepassxc-browser/manifest.json b/keepassxc-browser/manifest.json index 001c401..011c424 100755 --- a/keepassxc-browser/manifest.json +++ b/keepassxc-browser/manifest.json @@ -136,7 +136,8 @@ "css/notification.css", "css/pwgen.css", "css/username.css", - "css/totp.css" + "css/totp.css", + "content/webauthn.js" ], "permissions": [ "activeTab",