From 6f727f740869c664e1631848108ca83e98f4766a Mon Sep 17 00:00:00 2001 From: varjolintu Date: Mon, 21 Mar 2022 17:15:02 +0200 Subject: [PATCH] First draft --- keepassxc-browser/content/webauthn.js | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 keepassxc-browser/content/webauthn.js 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!'); + } + }); +})();