2021-12-21 15:43:35 +01:00
|
|
|
window.addEventListener(
|
|
|
|
"message",
|
|
|
|
(event) => {
|
|
|
|
if (event.source !== window) return;
|
2020-08-11 22:25:07 +02:00
|
|
|
|
2021-12-21 15:43:35 +01:00
|
|
|
if (event.data.command && event.data.command === "authResult") {
|
|
|
|
chrome.runtime.sendMessage({
|
|
|
|
command: event.data.command,
|
|
|
|
code: event.data.code,
|
|
|
|
state: event.data.state,
|
|
|
|
referrer: event.source.location.hostname,
|
|
|
|
});
|
2020-08-11 22:25:07 +02:00
|
|
|
}
|
2021-03-17 22:14:26 +01:00
|
|
|
|
2021-12-21 15:43:35 +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,
|
|
|
|
});
|
2021-03-17 22:14:26 +01:00
|
|
|
}
|
2021-12-21 15:43:35 +01:00
|
|
|
},
|
|
|
|
false
|
|
|
|
);
|
2021-10-18 16:41:42 +02:00
|
|
|
|
2021-12-21 15:43:35 +01:00
|
|
|
const forwardCommands = [
|
|
|
|
"promptForLogin",
|
|
|
|
"addToLockedVaultPendingNotifications",
|
|
|
|
"unlockCompleted",
|
|
|
|
];
|
2021-10-18 16:42:32 +02:00
|
|
|
|
2021-12-21 15:43:35 +01:00
|
|
|
chrome.runtime.onMessage.addListener((event) => {
|
|
|
|
if (forwardCommands.includes(event.command)) {
|
|
|
|
chrome.runtime.sendMessage(event);
|
|
|
|
}
|
2021-10-18 16:41:42 +02:00
|
|
|
});
|