Skip to content

Commit 225a77a

Browse files
metsmamrts
authored andcommitted
Create consent page
WE2-761 Signed-off-by: Raul Metsma <[email protected]>
1 parent 87d7c47 commit 225a77a

File tree

13 files changed

+280
-3
lines changed

13 files changed

+280
-3
lines changed

package-lock.json

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"@typescript-eslint/eslint-plugin": "^5.4.0",
2626
"@typescript-eslint/parser": "^5.4.0",
2727
"archiver": "^5.3.0",
28+
"bootstrap": "^5.3.0-alpha1",
2829
"eslint": "^8.2.0",
2930
"fs-extra": "^10.0.0",
3031
"glob": "^7.2.0",

scripts/build.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const targets = {
1616
async clean() {
1717
rem(
1818
"Cleaning the dist directory"
19-
)
19+
);
2020
await rm("./dist");
2121
},
2222

@@ -48,12 +48,12 @@ const targets = {
4848

4949
rem(
5050
"Preparing the Firefox dist directory"
51-
)
51+
);
5252
await cp("./dist/src", "./dist/firefox");
5353

5454
rem(
5555
"Preparing the Safari dist directory"
56-
)
56+
);
5757
await cp("./dist/src", "./dist/safari");
5858
await cp("./dist/safari/background-safari", "./dist/safari/background");
5959
await rm("./dist/safari/background-safari");
@@ -83,6 +83,13 @@ const targets = {
8383
await cp("./static/icons", "./dist/firefox/icons");
8484
await cp("./static/icons", "./dist/safari");
8585

86+
rem(
87+
"Copying static pages"
88+
);
89+
await cp("./static/_locales", "./dist/firefox/_locales");
90+
await cp("./static/views", "./dist/firefox/views");
91+
await cp("./node_modules/bootstrap/dist/css/bootstrap.min.css", "./dist/firefox/views/bootstrap.min.css");
92+
8693
rem(
8794
"Preparing the Chrome dist directory for:",
8895
"- Google Chrome",

src/background/background.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ import getSigningCertificate from "./actions/getSigningCertificate";
3232
import sign from "./actions/sign";
3333
import status from "./actions/status";
3434

35+
async function showConsent() {
36+
const url = browser.runtime.getURL("views/installed.html");
37+
return await browser.tabs.create({ url, active: true });
38+
}
39+
3540
async function onAction(message: ExtensionRequest, sender: MessageSender): Promise<void | object> {
3641
switch (message.action) {
3742
case Action.AUTHENTICATE:
@@ -103,6 +108,13 @@ async function onTokenSigningAction(message: TokenSigningMessage, sender: Messag
103108
}
104109
}
105110

111+
browser.runtime.onInstalled.addListener(async ({ reason, temporary }) => {
112+
if (temporary) return;
113+
if (reason == "install") {
114+
await showConsent();
115+
}
116+
});
117+
106118
browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
107119
if ((message as ExtensionRequest).action) {
108120
onAction(message, sender).then(sendResponse);

src/models/Browser/Runtime.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121
*/
2222

2323
export default interface Runtime {
24+
/**
25+
* Fired when the extension is first installed, when the extension is updated to a new version, and when the browser is
26+
* updated to a new version.
27+
*
28+
* Note that runtime.onInstalled is not the same as management.onInstalled. The runtime.onInstalled event is fired only
29+
* for your extension. The browser.management.onInstalled event is fired for any extensions.
30+
*
31+
* @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onInstalled
32+
*/
33+
onInstalled: {
34+
addListener: (callback: OnInstalledCallback) => void;
35+
};
36+
2437
/**
2538
* A string representing the extension ID.
2639
*
@@ -126,6 +139,16 @@ export interface Port {
126139
sender?: any;
127140
}
128141

142+
export type OnInstallReason = "install" | "update" | "chrome_update" | "shared_module_update";
143+
144+
export interface OnInstalledDetails {
145+
id?: string;
146+
previousVersion?: string;
147+
reason: OnInstallReason;
148+
temporary: boolean;
149+
}
150+
151+
export type OnInstalledCallback = (details: OnInstalledDetails, sender: MessageSender, sendResponse?: any) => Promise<any> | void | boolean;
129152
export type OnMessageCallback = (message: any, sender: MessageSender, sendResponse?: any) => Promise<any> | void | boolean;
130153

131154
export interface MessageSender {

src/models/Browser/Tabs.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,35 @@
2020
* SOFTWARE.
2121
*/
2222

23+
export type CreateProperties = {
24+
active?: boolean,
25+
index?: number,
26+
openerTabId?: number,
27+
pinned?: boolean,
28+
selected?: boolean,
29+
url?: string,
30+
windowId?: number,
31+
};
32+
33+
export type CreateCallback = (tab: object /* Tab */) => void;
34+
2335
export default interface Tabs {
2436

2537
/**
2638
* A special ID value given to tabs that are not browser tabs (for example, tabs in devtools windows).
2739
*/
2840
TAB_ID_NONE: number;
2941

42+
/**
43+
* Creates a new tab.
44+
*
45+
* @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/create
46+
*/
47+
create: (
48+
createProperties: CreateProperties,
49+
callback?: CreateCallback
50+
) => Promise<object /* Tab */>;
51+
3052
/**
3153
* Sends a single message from the extension's background scripts (or other privileged scripts,
3254
* such as popup scripts or options page scripts) to any content scripts or extension pages/iframes

static/_locales/en/messages.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"title": {
3+
"message": "Web eID Data Protection Terms",
4+
"description": "Title"
5+
},
6+
"content": {
7+
"message": "Web eID transmits the following data that personally identifies you to the e-service:<ul><li>the user`s certificate for authentication or signing;</li><li>URL of the website origin for authentication.</li></ul>The transfer of personal data is necessary for the functioning of authentication and digital signing. Transmitted data is not stored. If you do not agree to the transfer of data then we recommend you to remove the Web eID extension.<br />Full details about the personal data we transmit and what we do with it are provided in our <a href=\"$URL$\" target=\"_blank\">Data Protection Terms</a>.",
8+
"description": "Content",
9+
"placeholders": {
10+
"url" : {
11+
"content" : "$1",
12+
"example" : "https://addons.mozilla.org/en-US/firefox/addon/web-eid-webextension/privacy/"
13+
}
14+
}
15+
},
16+
"error": {
17+
"message": "To remove the Web eID extension, uninstall ID-software. You can find instructions from <a href=\"https://id.ee/en/\" target=\"_blank\">id.ee</a> website.",
18+
"description": "Uninstall error"
19+
},
20+
"agree": {
21+
"message": "Accept the terms",
22+
"description": "Agree button."
23+
},
24+
"uninstall": {
25+
"message": "Remove Web eID",
26+
"description": "Uninstall button."
27+
}
28+
}

static/_locales/et/messages.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"title": {
3+
"message": "Web eID andmekaitsetingimused",
4+
"description": "Title"
5+
},
6+
"content": {
7+
"message": "Web eID edastab e-teenusele järgmised teie isikut identifitseerivad andmed:<ul><li>kasutaja sertifikaat autentimiseks või allkirjastamiseks;</li><li>veebisaidi aadress (URL) autentimiseks.</li></ul>Isikuandmete edastamine on vajalik autentimise ja digiallkirjastamise toimimiseks. Edastatavaid andmeid ei sälilitata. Kui te ei nõustu andmete edastamisega, siis soovitame teil Web eID laienduse eemaldada.<br />Täpsem info isikuandmete edastamise ja nende kasutamise kohta on leitav <a href=\"$URL$\" target=\"_blank\">andmekaitsetingimustest</a>.",
8+
"description": "Content",
9+
"placeholders": {
10+
"url" : {
11+
"content" : "$1",
12+
"example" : "https://addons.mozilla.org/en-US/firefox/addon/web-eid-webextension/privacy/"
13+
}
14+
}
15+
},
16+
"error": {
17+
"message": "Web eID laienduse eemaldamiseks kustutage ID-tarkvara. Täpsemad juhised on leitavad <a href=\"https://id.ee\" target=\"_blank\">id.ee</a> veebilehelt.",
18+
"description": "Uninstall error"
19+
},
20+
"agree": {
21+
"message": "Nõustun tingimustega",
22+
"description": "Agree button."
23+
},
24+
"uninstall": {
25+
"message": "Eemalda Web eID",
26+
"description": "Uninstall button."
27+
}
28+
}

static/_locales/ru/messages.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"title": {
3+
"message": "Web eID условия защиты данных",
4+
"description": "Title"
5+
},
6+
"content": {
7+
"message": "Web eID передает электронной услуге следующие персональные идентификационные данные:<ul><li>сертификат пользователя для аутентификации или подписи;</li><li>адрес веб-сайта (URL) для аутентификации.</li></ul>Передача персональных данных необходима для работы аутентификации и цифровой подписи. Передаваемые данные не сохраняются. Если вы не согласны на передачу данных, рекомендуем удалить расширение Web eID.<br />Более подробную информацию о передаче персональных данных и их использовании можно найти из <a href=\"$URL$\" target=\"_blank\">условий защиты данных</a>.",
8+
"description": "Content",
9+
"placeholders": {
10+
"url" : {
11+
"content" : "$1",
12+
"example" : "https://addons.mozilla.org/en-US/firefox/addon/web-eid-webextension/privacy/"
13+
}
14+
}
15+
},
16+
"error": {
17+
"message": "Чтобы удалить расширение Web eID, удалите программное обеспечение ID. Подробные инструкции можно найти на веб-сайте <a href=\"https://id.ee/ru/\" target=\"_blank\">id.ee</a>.",
18+
"description": "Uninstall error"
19+
},
20+
"agree": {
21+
"message": "Соглашаюсь с условиями",
22+
"description": "Agree button."
23+
},
24+
"uninstall": {
25+
"message": "Удалить Web eID",
26+
"description": "Uninstall button."
27+
}
28+
}

static/firefox/manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"name": "Web eID",
44
"version": "{{package.version}}",
55
"description": "Use your electronic identification card for secure authentication and digital signing.",
6+
"default_locale": "en",
67
"browser_specific_settings": {
78
"gecko": {
89
"id": "{e68418bc-f2b0-4459-a9ea-3e72b6751b07}"

0 commit comments

Comments
 (0)