2021-02-10 16:40:15 +01:00
|
|
|
window.addEventListener(
|
|
|
|
"message",
|
|
|
|
(event) => {
|
2022-09-09 09:30:51 +02:00
|
|
|
if (event.source !== window) {
|
|
|
|
return;
|
|
|
|
}
|
2020-08-11 22:25:07 +02:00
|
|
|
|
2020-08-24 16:17:15 +02:00
|
|
|
if (event.data.command && event.data.command === "authResult") {
|
2020-08-11 22:25:07 +02:00
|
|
|
chrome.runtime.sendMessage({
|
2020-08-14 22:20:16 +02:00
|
|
|
command: event.data.command,
|
2020-08-11 22:25:07 +02:00
|
|
|
code: event.data.code,
|
2020-08-14 19:48:50 +02:00
|
|
|
state: event.data.state,
|
2020-08-24 16:17:15 +02:00
|
|
|
referrer: event.source.location.hostname,
|
2020-08-11 22:25:07 +02:00
|
|
|
});
|
|
|
|
}
|
2021-03-17 22:14:26 +01:00
|
|
|
|
|
|
|
if (event.data.command && event.data.command === "webAuthnResult") {
|
|
|
|
chrome.runtime.sendMessage({
|
|
|
|
command: event.data.command,
|
|
|
|
data: event.data.data,
|
|
|
|
remember: event.data.remember,
|
|
|
|
referrer: event.source.location.hostname,
|
|
|
|
});
|
|
|
|
}
|
2020-12-09 22:30:03 +01:00
|
|
|
},
|
|
|
|
false
|
|
|
|
);
|
2021-10-18 16:41:42 +02:00
|
|
|
|
2021-10-19 11:47:25 +02:00
|
|
|
const forwardCommands = [
|
|
|
|
"promptForLogin",
|
|
|
|
"addToLockedVaultPendingNotifications",
|
|
|
|
"unlockCompleted",
|
2022-01-25 08:16:36 +01:00
|
|
|
"addedCipher",
|
2023-03-08 23:12:43 +01:00
|
|
|
"openAddEditCipher",
|
2021-10-19 11:47:25 +02:00
|
|
|
];
|
2021-10-18 16:42:32 +02:00
|
|
|
|
2021-10-19 11:47:25 +02:00
|
|
|
chrome.runtime.onMessage.addListener((event) => {
|
|
|
|
if (forwardCommands.includes(event.command)) {
|
2021-10-18 16:41:42 +02:00
|
|
|
chrome.runtime.sendMessage(event);
|
|
|
|
}
|
|
|
|
});
|