├── .babelrc
├── .browserslistrc
├── .env.example
├── .eslintignore
├── .eslintrc.json
├── .github
├── FUNDING.yml
└── ISSUE_TEMPLATE
│ ├── bug-report.yml
│ ├── config.yml
│ ├── feature-request.yml
│ └── question.yml
├── .gitignore
├── .nvmrc
├── .stylelintignore
├── .stylelintrc
├── .vscode
└── settings.json
├── 2FAS - Two factor authentication
├── 2FAS - Two Factor Authentication.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── 2FAS - Two Factor Authentication (macOS).xcscheme
├── Shared (Extension)
│ └── SafariWebExtensionHandler.swift
├── macOS (App)
│ ├── 2FAS - Two factor authentication.entitlements
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AccentColor.colorset
│ │ │ └── Contents.json
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── ios-marketing-icon-1024@1x.png
│ │ │ ├── ipad-icon-20@1x.png
│ │ │ ├── ipad-icon-20@2x.png
│ │ │ ├── ipad-icon-29@1x.png
│ │ │ ├── ipad-icon-29@2x.png
│ │ │ ├── ipad-icon-40@1x.png
│ │ │ ├── ipad-icon-40@2x.png
│ │ │ ├── ipad-icon-76@2x.png
│ │ │ ├── ipad-icon-83.5@2x.png
│ │ │ ├── iphone-icon-20@2x.png
│ │ │ ├── iphone-icon-20@3x.png
│ │ │ ├── iphone-icon-29@2x.png
│ │ │ ├── iphone-icon-29@3x.png
│ │ │ ├── iphone-icon-40@2x.png
│ │ │ ├── iphone-icon-40@3x.png
│ │ │ ├── iphone-icon-60@2x.png
│ │ │ ├── iphone-icon-60@3x.png
│ │ │ ├── mac-icon-128@1x.png
│ │ │ ├── mac-icon-128@2x.png
│ │ │ ├── mac-icon-16@1x.png
│ │ │ ├── mac-icon-16@2x.png
│ │ │ ├── mac-icon-256@1x.png
│ │ │ ├── mac-icon-256@2x.png
│ │ │ ├── mac-icon-32@1x.png
│ │ │ ├── mac-icon-32@2x.png
│ │ │ ├── mac-icon-512@1x.png
│ │ │ └── mac-icon-512@2x.png
│ │ ├── Arrow.imageset
│ │ │ ├── Contents.json
│ │ │ └── Group 2.pdf
│ │ ├── Contents.json
│ │ ├── DescriptionText.colorset
│ │ │ └── Contents.json
│ │ ├── LargeIcon.imageset
│ │ │ ├── Contents.json
│ │ │ └── icon128.png
│ │ ├── LinesBackground.colorset
│ │ │ └── Contents.json
│ │ ├── LogoText2.imageset
│ │ │ ├── Contents.json
│ │ │ └── Vector-3.pdf
│ │ ├── LogoTextA.imageset
│ │ │ ├── Contents.json
│ │ │ └── Vector-2.pdf
│ │ ├── LogoTextF.imageset
│ │ │ ├── Contents.json
│ │ │ └── Vector-1.pdf
│ │ ├── LogoTextS.imageset
│ │ │ ├── Contents.json
│ │ │ └── Vector.pdf
│ │ ├── MainBackground.colorset
│ │ │ └── Contents.json
│ │ ├── MainText.colorset
│ │ │ └── Contents.json
│ │ ├── Sygnet.imageset
│ │ │ ├── Contents.json
│ │ │ └── Sygnet.pdf
│ │ ├── Theme.colorset
│ │ │ └── Contents.json
│ │ └── ThemeLight.colorset
│ │ │ └── Contents.json
│ ├── BrowserExtensionApp.swift
│ ├── ContentView.swift
│ ├── Fonts
│ │ ├── Montserrat-Bold.ttf
│ │ └── Montserrat-Regular.ttf
│ ├── Info.plist
│ ├── Localizable.xcstrings
│ └── Presenter.swift
└── macOS (Extension)
│ ├── 2FAS - Two factor authentication.entitlements
│ └── Info.plist
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── logsCodes.txt
├── open-source-licenses.html
├── open-source-licenses.json
├── package.json
├── scssLint.yml
├── src
├── _locales
│ └── en
│ │ ├── general.json
│ │ ├── installPage.json
│ │ ├── manifest.json
│ │ ├── months.json
│ │ ├── notifications.json
│ │ ├── optionsPage.json
│ │ └── token.json
├── background
│ ├── background.js
│ ├── events
│ │ ├── handleConfigurationRequest.js
│ │ ├── handleLoginRequest.js
│ │ └── index.js
│ ├── functions
│ │ ├── Crypt.js
│ │ ├── ab2b64.js
│ │ ├── b642ab.js
│ │ ├── browserAction.js
│ │ ├── browserActionConfigured.js
│ │ ├── checkIconTitleText.js
│ │ ├── checkSafariStorage.js
│ │ ├── checkTabCS.js
│ │ ├── closeRequest.js
│ │ ├── closeWSChannel.js
│ │ ├── createContextMenus.js
│ │ ├── createFirefoxOptionsMenu.js
│ │ ├── dummyGetLocalStorage.js
│ │ ├── generateDefaultStorage.js
│ │ ├── getBrowserInfo.js
│ │ ├── getOSName.js
│ │ ├── handleFrontElement.js
│ │ ├── index.js
│ │ ├── initBEAction.js
│ │ ├── onCommand.js
│ │ ├── onConnect.js
│ │ ├── onContextMenuClick.js
│ │ ├── onInstalled.js
│ │ ├── onMessage.js
│ │ ├── onStartup.js
│ │ ├── openBrowserPage.js
│ │ ├── openInstallPage.js
│ │ ├── sendMessageToAllFrames.js
│ │ ├── sendNotificationInfo.js
│ │ ├── setIcon.js
│ │ ├── subscribeChannel.js
│ │ ├── update
│ │ │ ├── index.js
│ │ │ ├── updateBrowserExtension.js
│ │ │ ├── updateIncognitoAccess.js
│ │ │ └── verifyStorageIntegrity.js
│ │ ├── updateBrowserInfo.js
│ │ ├── wsTabChanged.js
│ │ └── wsTabClosed.js
│ └── tabs
│ │ ├── index.js
│ │ ├── onTabActivated.js
│ │ ├── onTabRemoved.js
│ │ └── onTabUpdated.js
├── config.js
├── content
│ ├── content_script.js
│ ├── events
│ │ └── contentOnMessage.js
│ ├── functions
│ │ ├── addFormElementsNumber.js
│ │ ├── clearAfterInputToken.js
│ │ ├── clearFormElementsNumber.js
│ │ ├── clickSubmit.js
│ │ ├── closeNotificationInfo.js
│ │ ├── getActiveElement.js
│ │ ├── getFormElements.js
│ │ ├── getFormSubmitElements.js
│ │ ├── getTabData.js
│ │ ├── getTokenInput.js
│ │ ├── index.js
│ │ ├── inputToken.js
│ │ ├── isInFrame.js
│ │ ├── loadFonts.js
│ │ ├── neverShowNotificationInfo.js
│ │ ├── notification.js
│ │ ├── openOptionsPage.js
│ │ ├── portSetup.js
│ │ ├── showNotificationInfo.js
│ │ └── tokenNotification.js
│ └── styles
│ │ └── content_script.scss
├── defaultAutoSubmitExcludedDomains.js
├── fonts
│ ├── montserrat-v25-latin-600.woff2
│ ├── montserrat-v25-latin-700.woff2
│ └── montserrat-v25-latin-regular.woff2
├── global-styles
│ ├── _buttons.scss
│ ├── _fonts.scss
│ ├── _global.scss
│ ├── _input.scss
│ ├── _shortcut.scss
│ └── _variables.scss
├── images
│ ├── app_store.svg
│ ├── close.svg
│ ├── copy-icon.svg
│ ├── cover-intro.png
│ ├── google_play.svg
│ ├── icons
│ │ ├── icon128.png
│ │ ├── icon128_1.png
│ │ ├── icon128_1gray.png
│ │ ├── icon128_2.png
│ │ ├── icon128_2gray.png
│ │ ├── icon128gray.png
│ │ ├── icon128safari.png
│ │ ├── icon16.png
│ │ ├── icon16_1.png
│ │ ├── icon16_1gray.png
│ │ ├── icon16_2.png
│ │ ├── icon16_2gray.png
│ │ ├── icon16gray.png
│ │ ├── icon16safari.png
│ │ ├── icon32.png
│ │ ├── icon32_1.png
│ │ ├── icon32_1gray.png
│ │ ├── icon32_2.png
│ │ ├── icon32_2gray.png
│ │ ├── icon32gray.png
│ │ ├── icon32safari.png
│ │ ├── icon48.png
│ │ ├── icon48_1.png
│ │ ├── icon48_1gray.png
│ │ ├── icon48_2.png
│ │ ├── icon48_2gray.png
│ │ ├── icon48gray.png
│ │ ├── icon48safari.png
│ │ ├── icon96.png
│ │ ├── icon96_1.png
│ │ ├── icon96_1gray.png
│ │ ├── icon96_2.png
│ │ ├── icon96_2gray.png
│ │ ├── icon96gray.png
│ │ └── icon96safari.png
│ ├── install-page
│ │ ├── open-tutorial-dark.png
│ │ ├── open-tutorial-dark@2x.png
│ │ ├── open-tutorial-dark@3x.png
│ │ ├── open-tutorial.png
│ │ ├── open-tutorial@2x.png
│ │ ├── open-tutorial@3x.png
│ │ ├── pin-ext-dark.png
│ │ ├── pin-ext-dark@2x.png
│ │ ├── pin-ext-dark@3x.png
│ │ ├── pin-ext-firefox-dark.png
│ │ ├── pin-ext-firefox-dark@2x.png
│ │ ├── pin-ext-firefox-dark@3x.png
│ │ ├── pin-ext-firefox.png
│ │ ├── pin-ext-firefox@2x.png
│ │ ├── pin-ext-firefox@3x.png
│ │ ├── pin-ext.png
│ │ ├── pin-ext@2x.png
│ │ └── pin-ext@3x.png
│ ├── logo-dark.svg
│ ├── logo.svg
│ ├── notification-close.svg
│ ├── notification-logo.svg
│ ├── page-icons
│ │ ├── add.svg
│ │ ├── close.svg
│ │ ├── disconnect.svg
│ │ ├── newpage.svg
│ │ ├── settings.svg
│ │ └── trash.svg
│ ├── phone-dark.png
│ ├── phone-dark@2x.png
│ ├── phone-dark@3x.png
│ ├── phone.png
│ ├── phone@2x.png
│ ├── phone@3x.png
│ ├── pin-info
│ │ ├── chrome-dark.svg
│ │ ├── chrome.svg
│ │ ├── edge-dark.svg
│ │ ├── edge.svg
│ │ ├── firefox-dark.svg
│ │ ├── firefox.svg
│ │ ├── opera-step-1-dark.svg
│ │ ├── opera-step-1.svg
│ │ ├── opera-step-2-dark.svg
│ │ ├── opera-step-2.svg
│ │ ├── safari-step-1-dark.svg
│ │ ├── safari-step-1.svg
│ │ ├── safari-step-2-dark.svg
│ │ └── safari-step-2.svg
│ ├── qr-border.svg
│ ├── qr-phone-dark.png
│ ├── qr-phone-dark@2x.png
│ ├── qr-phone-dark@3x.png
│ ├── qr-phone.png
│ ├── qr-phone@2x.png
│ ├── qr-phone@3x.png
│ └── shield-logo.svg
├── installPage
│ ├── functions
│ │ ├── configurationComplete.js
│ │ ├── generateQRCode.js
│ │ ├── index.js
│ │ ├── installContainerHandlers.js
│ │ ├── qrTimeout.js
│ │ ├── setQRCode.js
│ │ └── showIntegrityError.js
│ ├── installPage.html
│ ├── installPage.js
│ ├── installPage.scss
│ └── styles
│ │ ├── _configured.scss
│ │ ├── _container.scss
│ │ └── _integrityError.scss
├── localStorage
│ ├── clearLocalStorage.js
│ ├── index.js
│ ├── loadFromLocalStorage.js
│ ├── removeFromLocalStorage.js
│ └── saveToLocalStorage.js
├── manifest
│ ├── chrome.json
│ ├── edge.json
│ ├── firefox.json
│ ├── opera.json
│ └── safari.json
├── notification
│ ├── functions
│ │ ├── index.js
│ │ ├── sendFrontEndPushAction.js
│ │ ├── showFrontEndPush.js
│ │ ├── showNativePush.js
│ │ └── showNativePushWithoutTimeout.js
│ └── index.js
├── optionsPage
│ ├── functions
│ │ ├── confirmModalBackdropClick.js
│ │ ├── domainModalBackdropClick.js
│ │ ├── domainModalFormSubmit.js
│ │ ├── generateDevicesList.js
│ │ ├── generateDomainsList.js
│ │ ├── generateEmptyDeviceRow.js
│ │ ├── generateEmptyDomainRow.js
│ │ ├── generateEmptyShortcutBox.js
│ │ ├── generateShortcutBox.js
│ │ ├── generateShortcutLink.js
│ │ ├── handleAdvancedHeaderClick.js
│ │ ├── handleAutoSubmitChange.js
│ │ ├── handleContextMenuChange.js
│ │ ├── handleHamburgerClick.js
│ │ ├── handleImportDefaultExcludedDomains.js
│ │ ├── handleLoggingChange.js
│ │ ├── handleMenuLink.js
│ │ ├── handlePinInfo.js
│ │ ├── handlePinInfoNext.js
│ │ ├── handlePinInfoPrev.js
│ │ ├── handlePushChange.js
│ │ ├── handleSafariReset.js
│ │ ├── hideConfirmModal.js
│ │ ├── hideDomainModal.js
│ │ ├── index.js
│ │ ├── removeDevice.js
│ │ ├── removeDeviceFromDOM.js
│ │ ├── removeDomain.js
│ │ ├── removeDomainFromDOM.js
│ │ ├── sendTestNotification.js
│ │ ├── setAdvanced.js
│ │ ├── setAutoSubmitSwitch.js
│ │ ├── setContextMenuToggle.js
│ │ ├── setExtName.js
│ │ ├── setExtNameUpdateForm.js
│ │ ├── setExtVersion.js
│ │ ├── setHamburger.js
│ │ ├── setIconSelect.js
│ │ ├── setImportDefaultExcludedDomains.js
│ │ ├── setLoggingToggle.js
│ │ ├── setMenuLinks.js
│ │ ├── setModalsListeners.js
│ │ ├── setPinInfo.js
│ │ ├── setPinInfoBtns.js
│ │ ├── setPushRadio.js
│ │ ├── setShortcutBox.js
│ │ ├── showConfirmModal.js
│ │ ├── showDomainModal.js
│ │ └── showIntegrityError.js
│ ├── optionsPage.html
│ ├── optionsPage.js
│ ├── optionsPage.scss
│ └── styles
│ │ ├── _content.scss
│ │ ├── _integrityError.scss
│ │ ├── _menu.scss
│ │ ├── _modal.scss
│ │ ├── _pinInfo.scss
│ │ ├── _pushConfig.scss
│ │ └── _socialIcons.scss
├── partials
│ ├── DOMElements
│ │ ├── createElement.js
│ │ ├── createImageElement.js
│ │ ├── createSVGElement.js
│ │ ├── createTextElement.js
│ │ └── index.js
│ ├── buttonsTexts.js
│ ├── delay.js
│ ├── extNameUpdate.js
│ ├── extPageOnMessage.js
│ ├── formSubmitSecondSelectors.js
│ ├── formSubmitSelectors.js
│ ├── handleTargetBlank.js
│ ├── hidePreloader.js
│ ├── i18n.js
│ ├── ignoreButtonSelectors.js
│ ├── ignoreButtonTexts.js
│ ├── index.js
│ ├── inputsSelectors.js
│ ├── months.js
│ ├── onTabFocused.js
│ ├── openShortcutEdit.js
│ ├── runTasksWithDelay.js
│ ├── sendMessageToTab.js
│ ├── storageValidation.js
│ ├── storeLog.js
│ ├── uniqueOnly.js
│ └── wait.js
├── sdk
│ └── index.js
├── selectors.js
└── views
│ ├── configureViews
│ ├── normal.html
│ └── safari.html
│ ├── menuViews
│ ├── normal.html
│ └── safari.html
│ ├── optionsPageConfirmModal.html
│ ├── optionsPageDomainModal.html
│ ├── optionsViews
│ ├── firefox.html
│ ├── normal.html
│ └── safari.html
│ └── pinInfoViews
│ ├── chrome.html
│ ├── edge.html
│ ├── firefox.html
│ ├── opera.html
│ └── safari.html
└── webpack
├── development.config.js
├── development
├── background.dev.config.js
├── contentScript.dev.config.js
├── installPage.dev.config.js
└── optionsPage.dev.config.js
├── production.config.js
├── production
├── background.prod.config.js
├── contentScript.prod.config.js
├── installPage.prod.config.js
└── optionsPage.prod.config.js
└── utils
├── browserRegExps.js
├── checkBuildDirectoryExists.js
├── config.js
├── dotenvConfig.js
├── export
├── .gitkeep
└── messages.json
├── generateLocales.js
├── global.js
├── locoExport.js
└── locoImport.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [["@babel/env", {
3 | "targets": {
4 | "browsers": ["> 1%", "last 2 versions", "safari >= 16", "not ie > 0", "not dead"]
5 | },
6 | "modules": "commonjs"
7 | }]],
8 | "env": {
9 | "production": {
10 | "plugins": [
11 | "@babel/plugin-transform-runtime",
12 | "transform-remove-debugger",
13 | "transform-minify-booleans"
14 | ]
15 | }
16 | },
17 | "ignore": [
18 | "2FAS - Two factor authentication/**/*.js"
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | safari >= 16
4 | not ie > 0
5 | not dead
6 |
--------------------------------------------------------------------------------
/.env.example:
--------------------------------------------------------------------------------
1 | # API URL for REST requests (default: https://api2.2fas.com)
2 | API_URL=https://api2.2fas.com
3 | # Websocket URL (default: wss://ws.2fas.com)
4 | WS_URL=wss://ws.2fas.com
5 | # [ONLY FOR 2FAS TEAM] Key for localise.biz
6 | LOCO_KEY=EMPTY
7 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | build/**/*
2 | public/**/*
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["standard"],
3 | "parser": "@babel/eslint-parser",
4 | "rules": {
5 | "no-tabs": "off",
6 | "semi": "off",
7 | "indent": ["warn", 2, { "SwitchCase": 1 }],
8 | "no-useless-escape": "off",
9 | "no-trailing-spaces": ["error", { "skipBlankLines": true }],
10 | "no-irregular-whitespace": "off"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | custom: ['https://2fas.com/donate']
4 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Help center
4 | url: https://2fas.com/help-center/
5 | about: Check out our extensive FaQ and video guides!
6 | - name: Discord
7 | url: https://discord.gg/q4cP6qh2g5
8 | about: Need support or have a question? Our Discord members are there to help!
9 | - name: Reddit
10 | url: https://www.reddit.com/r/2fas_com/
11 | about: Get support and discuss 2FAS with our Reddit community!
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature-request.yml:
--------------------------------------------------------------------------------
1 | name: ⭐ Feature request
2 | description: Request a feature or enhancement.
3 | title: 'feat: '
4 | labels: ['Feature']
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | Before creating a feature request, please ensure that it is not a duplicate of an existing feature request. You can review existing feature requests [here](https://github.com/twofas/2fas-browser-extension/labels/Feature).
10 | - type: textarea
11 | attributes:
12 | label: Feature description
13 | description: |
14 | - Describe the feature in detail
15 | - Add images, videos, links, examples, etc. if necessary
16 | validations:
17 | required: true
18 | - type: textarea
19 | attributes:
20 | label: Motivation
21 | description: Why should this feature be implemented?
22 | validations:
23 | required: true
24 | - type: checkboxes
25 | id: acknowledgements
26 | attributes:
27 | label: Acknowledgements
28 | description: Your feature request will be closed if you don't follow the checklist below.
29 | options:
30 | - label: This issue is not a duplicate of an existing feature request.
31 | required: true
32 | - label: I have chosen an appropriate title.
33 | required: true
34 | - label: All requested information has been provided properly.
35 | required: true
36 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/question.yml:
--------------------------------------------------------------------------------
1 | name: ❓ Question
2 | description: Ask a question to the developers.
3 | labels: ['Question']
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | Before asking a question, please ensure that it has not already been asked. You can review existing questions [here](https://github.com/twofas/2fas-browser-extension/labels/Question).
9 | - type: textarea
10 | attributes:
11 | label: Question
12 | description: |
13 | - Explain your question clearly and in detail
14 | - Add images and videos if necessary
15 | validations:
16 | required: true
17 | - type: checkboxes
18 | id: acknowledgements
19 | attributes:
20 | label: Acknowledgements
21 | description: Your question will be closed if you don't follow the checklist below.
22 | options:
23 | - label: This issue is not a duplicate of an existing question.
24 | required: true
25 | - label: I have chosen an appropriate title.
26 | required: true
27 | - label: All requested information has been provided properly.
28 | required: true
29 |
--------------------------------------------------------------------------------
/.nvmrc:
--------------------------------------------------------------------------------
1 | v22.12.0
2 |
--------------------------------------------------------------------------------
/.stylelintignore:
--------------------------------------------------------------------------------
1 | 2FAS - Two factor authentication/**/*.css
2 | build/**/*
3 | public/**/*
--------------------------------------------------------------------------------
/.stylelintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "stylelint-config-recommended-scss",
3 | "rules": {
4 | "color-no-invalid-hex": true,
5 | "font-family-no-duplicate-names": true,
6 | "function-calc-no-unspaced-operator": true,
7 | "function-linear-gradient-no-nonstandard-direction": true,
8 | "unit-no-unknown": true,
9 | "shorthand-property-no-redundant-values": true,
10 | "keyframe-declaration-no-important": true,
11 | "block-no-empty": true,
12 | "at-rule-no-unknown": null,
13 | "no-unknown-animations": null,
14 | "no-empty-source": null,
15 | "declaration-block-single-line-max-declarations": 1,
16 | "color-hex-length": "short",
17 | "function-url-quotes": "always",
18 | "length-zero-no-unit": true,
19 | "value-keyword-case": "lower",
20 | "no-descending-specificity": null,
21 | "no-invalid-position-at-import-rule": null,
22 | "scss/comment-no-empty": null,
23 | "at-rule-empty-line-before": [
24 | "always", {
25 | "ignore": ["after-comment"],
26 | "ignoreAtRules": [
27 | "if",
28 | "else",
29 | "else if",
30 | "return",
31 | "warn",
32 | "for",
33 | "import",
34 | "mixin",
35 | "extend",
36 | "include",
37 | "media",
38 | "content",
39 | "keyframes",
40 | "-ms-keyframes",
41 | "-moz-keyframes",
42 | "-webkit-keyframes"
43 | ]
44 | }
45 | ]
46 | }
47 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.inlineSuggest.showToolbar": "always"
3 | }
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/2FAS - Two Factor Authentication.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/2FAS - Two Factor Authentication.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/Shared (Extension)/SafariWebExtensionHandler.swift:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | import SafariServices
21 | import os.log
22 |
23 | let SFExtensionMessageKey = "message"
24 |
25 | class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
26 |
27 | func beginRequest(with context: NSExtensionContext) {
28 | let item = context.inputItems[0] as! NSExtensionItem
29 | let message = item.userInfo?[SFExtensionMessageKey]
30 | os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@", message as! CVarArg)
31 |
32 | let response = NSExtensionItem()
33 | response.userInfo = [ SFExtensionMessageKey: [ "Response to": message ] ]
34 |
35 | context.completeRequest(returningItems: [response], completionHandler: nil)
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/2FAS - Two factor authentication.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.files.user-selected.read-only
8 |
9 | com.apple.security.network.client
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // 2FAS - Two Factor Authentication (macOS)
4 | //
5 | // Created by Zbigniew Cisiński on 11/10/2023.
6 | //
7 |
8 | import AppKit
9 |
10 | final class AppDelegate: NSObject, NSApplicationDelegate {
11 | func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
12 | true
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "color" : {
5 | "color-space" : "srgb",
6 | "components" : {
7 | "alpha" : "1.000",
8 | "blue" : "0.137",
9 | "green" : "0.110",
10 | "red" : "0.929"
11 | }
12 | },
13 | "idiom" : "universal"
14 | },
15 | {
16 | "appearances" : [
17 | {
18 | "appearance" : "luminosity",
19 | "value" : "dark"
20 | }
21 | ],
22 | "color" : {
23 | "color-space" : "srgb",
24 | "components" : {
25 | "alpha" : "1.000",
26 | "blue" : "0.137",
27 | "green" : "0.110",
28 | "red" : "0.898"
29 | }
30 | },
31 | "idiom" : "universal"
32 | }
33 | ],
34 | "info" : {
35 | "author" : "xcode",
36 | "version" : 1
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ios-marketing-icon-1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ios-marketing-icon-1024@1x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-20@1x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-20@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-29@1x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-29@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-40@1x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-40@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-76@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/ipad-icon-83.5@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-20@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-20@3x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-29@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-29@3x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-40@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-40@3x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-60@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/iphone-icon-60@3x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-128@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-128@1x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-128@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-128@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-16@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-16@1x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-16@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-16@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-256@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-256@1x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-256@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-256@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-32@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-32@1x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-32@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-32@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-512@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-512@1x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-512@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/AppIcon.appiconset/mac-icon-512@2x.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/Arrow.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "Group 2.pdf",
5 | "idiom" : "universal"
6 | }
7 | ],
8 | "info" : {
9 | "author" : "xcode",
10 | "version" : 1
11 | },
12 | "properties" : {
13 | "template-rendering-intent" : "original"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/DescriptionText.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "color" : {
5 | "color-space" : "srgb",
6 | "components" : {
7 | "alpha" : "1.000",
8 | "blue" : "0x81",
9 | "green" : "0x7A",
10 | "red" : "0x79"
11 | }
12 | },
13 | "idiom" : "universal"
14 | }
15 | ],
16 | "info" : {
17 | "author" : "xcode",
18 | "version" : 1
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/LargeIcon.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "icon128.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/LargeIcon.imageset/icon128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/LargeIcon.imageset/icon128.png
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/LinesBackground.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "color" : {
5 | "color-space" : "srgb",
6 | "components" : {
7 | "alpha" : "1.000",
8 | "blue" : "0xEE",
9 | "green" : "0xEE",
10 | "red" : "0xEE"
11 | }
12 | },
13 | "idiom" : "universal"
14 | },
15 | {
16 | "appearances" : [
17 | {
18 | "appearance" : "luminosity",
19 | "value" : "dark"
20 | }
21 | ],
22 | "color" : {
23 | "color-space" : "srgb",
24 | "components" : {
25 | "alpha" : "1.000",
26 | "blue" : "0x3E",
27 | "green" : "0x38",
28 | "red" : "0x36"
29 | }
30 | },
31 | "idiom" : "universal"
32 | }
33 | ],
34 | "info" : {
35 | "author" : "xcode",
36 | "version" : 1
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/LogoText2.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "Vector-3.pdf",
5 | "idiom" : "universal"
6 | }
7 | ],
8 | "info" : {
9 | "author" : "xcode",
10 | "version" : 1
11 | },
12 | "properties" : {
13 | "template-rendering-intent" : "template"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/LogoTextA.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "Vector-2.pdf",
5 | "idiom" : "universal"
6 | }
7 | ],
8 | "info" : {
9 | "author" : "xcode",
10 | "version" : 1
11 | },
12 | "properties" : {
13 | "template-rendering-intent" : "template"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/LogoTextA.imageset/Vector-2.pdf:
--------------------------------------------------------------------------------
1 | %PDF-1.7
2 |
3 | 1 0 obj
4 | << >>
5 | endobj
6 |
7 | 2 0 obj
8 | << /Length 3 0 R >>
9 | stream
10 | /DeviceRGB CS
11 | /DeviceRGB cs
12 | q
13 | 1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
14 | 1.000000 1.000000 1.000000 scn
15 | 52.960163 -0.000267 m
16 | 69.460213 -0.000267 l
17 | 43.040134 50.759766 l
18 | 26.420073 50.759766 l
19 | 0.000000 -0.000267 l
20 | 16.500044 -0.000267 l
21 | 21.420057 9.439743 l
22 | 48.080143 9.439743 l
23 | 53.000156 -0.000267 l
24 | 52.960163 -0.000267 l
25 | h
26 | 27.480089 21.159754 m
27 | 34.720100 35.059757 l
28 | 41.960129 21.159754 l
29 | 27.500078 21.159754 l
30 | 27.480089 21.159754 l
31 | h
32 | f
33 | n
34 | Q
35 |
36 | endstream
37 | endobj
38 |
39 | 3 0 obj
40 | 456
41 | endobj
42 |
43 | 4 0 obj
44 | << /Annots []
45 | /Type /Page
46 | /MediaBox [ 0.000000 0.000000 69.459961 50.759766 ]
47 | /Resources 1 0 R
48 | /Contents 2 0 R
49 | /Parent 5 0 R
50 | >>
51 | endobj
52 |
53 | 5 0 obj
54 | << /Kids [ 4 0 R ]
55 | /Count 1
56 | /Type /Pages
57 | >>
58 | endobj
59 |
60 | 6 0 obj
61 | << /Pages 5 0 R
62 | /Type /Catalog
63 | >>
64 | endobj
65 |
66 | xref
67 | 0 7
68 | 0000000000 65535 f
69 | 0000000010 00000 n
70 | 0000000034 00000 n
71 | 0000000546 00000 n
72 | 0000000568 00000 n
73 | 0000000741 00000 n
74 | 0000000815 00000 n
75 | trailer
76 | << /ID [ (some) (id) ]
77 | /Root 6 0 R
78 | /Size 7
79 | >>
80 | startxref
81 | 874
82 | %%EOF
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/LogoTextF.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "Vector-1.pdf",
5 | "idiom" : "universal"
6 | }
7 | ],
8 | "info" : {
9 | "author" : "xcode",
10 | "version" : 1
11 | },
12 | "properties" : {
13 | "template-rendering-intent" : "template"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/LogoTextF.imageset/Vector-1.pdf:
--------------------------------------------------------------------------------
1 | %PDF-1.7
2 |
3 | 1 0 obj
4 | << >>
5 | endobj
6 |
7 | 2 0 obj
8 | << /Length 3 0 R >>
9 | stream
10 | /DeviceRGB CS
11 | /DeviceRGB cs
12 | q
13 | 1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
14 | 1.000000 1.000000 1.000000 scn
15 | 52.840160 39.040215 m
16 | 52.840160 50.740234 l
17 | 7.620019 50.740234 l
18 | 0.000000 50.740234 l
19 | 0.000000 0.000191 l
20 | 15.260042 0.000191 l
21 | 15.260042 17.780205 l
22 | 47.260139 17.780205 l
23 | 47.260139 29.500214 l
24 | 15.260042 29.500214 l
25 | 15.260042 39.040215 l
26 | 52.840160 39.040215 l
27 | h
28 | f
29 | n
30 | Q
31 |
32 | endstream
33 | endobj
34 |
35 | 3 0 obj
36 | 386
37 | endobj
38 |
39 | 4 0 obj
40 | << /Annots []
41 | /Type /Page
42 | /MediaBox [ 0.000000 0.000000 52.839844 50.740234 ]
43 | /Resources 1 0 R
44 | /Contents 2 0 R
45 | /Parent 5 0 R
46 | >>
47 | endobj
48 |
49 | 5 0 obj
50 | << /Kids [ 4 0 R ]
51 | /Count 1
52 | /Type /Pages
53 | >>
54 | endobj
55 |
56 | 6 0 obj
57 | << /Pages 5 0 R
58 | /Type /Catalog
59 | >>
60 | endobj
61 |
62 | xref
63 | 0 7
64 | 0000000000 65535 f
65 | 0000000010 00000 n
66 | 0000000034 00000 n
67 | 0000000476 00000 n
68 | 0000000498 00000 n
69 | 0000000671 00000 n
70 | 0000000745 00000 n
71 | trailer
72 | << /ID [ (some) (id) ]
73 | /Root 6 0 R
74 | /Size 7
75 | >>
76 | startxref
77 | 804
78 | %%EOF
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/LogoTextS.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "Vector.pdf",
5 | "idiom" : "universal"
6 | }
7 | ],
8 | "info" : {
9 | "author" : "xcode",
10 | "version" : 1
11 | },
12 | "properties" : {
13 | "template-rendering-intent" : "template"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/MainBackground.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "color" : {
5 | "color-space" : "srgb",
6 | "components" : {
7 | "alpha" : "1.000",
8 | "blue" : "0xFF",
9 | "green" : "0xFF",
10 | "red" : "0xFF"
11 | }
12 | },
13 | "idiom" : "universal"
14 | },
15 | {
16 | "appearances" : [
17 | {
18 | "appearance" : "luminosity",
19 | "value" : "dark"
20 | }
21 | ],
22 | "color" : {
23 | "color-space" : "srgb",
24 | "components" : {
25 | "alpha" : "1.000",
26 | "blue" : "0x1B",
27 | "green" : "0x16",
28 | "red" : "0x15"
29 | }
30 | },
31 | "idiom" : "universal"
32 | }
33 | ],
34 | "info" : {
35 | "author" : "xcode",
36 | "version" : 1
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/MainText.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "color" : {
5 | "color-space" : "srgb",
6 | "components" : {
7 | "alpha" : "1.000",
8 | "blue" : "0x00",
9 | "green" : "0x00",
10 | "red" : "0x00"
11 | }
12 | },
13 | "idiom" : "universal"
14 | },
15 | {
16 | "appearances" : [
17 | {
18 | "appearance" : "luminosity",
19 | "value" : "dark"
20 | }
21 | ],
22 | "color" : {
23 | "color-space" : "srgb",
24 | "components" : {
25 | "alpha" : "1.000",
26 | "blue" : "0xFF",
27 | "green" : "0xFF",
28 | "red" : "0xFE"
29 | }
30 | },
31 | "idiom" : "universal"
32 | }
33 | ],
34 | "info" : {
35 | "author" : "xcode",
36 | "version" : 1
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/Sygnet.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "Sygnet.pdf",
5 | "idiom" : "universal"
6 | }
7 | ],
8 | "info" : {
9 | "author" : "xcode",
10 | "version" : 1
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/Theme.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "color" : {
5 | "color-space" : "srgb",
6 | "components" : {
7 | "alpha" : "1.000",
8 | "blue" : "0x24",
9 | "green" : "0x1C",
10 | "red" : "0xED"
11 | }
12 | },
13 | "idiom" : "universal"
14 | }
15 | ],
16 | "info" : {
17 | "author" : "xcode",
18 | "version" : 1
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Assets.xcassets/ThemeLight.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "color" : {
5 | "color-space" : "srgb",
6 | "components" : {
7 | "alpha" : "1.000",
8 | "blue" : "0x15",
9 | "green" : "0x00",
10 | "red" : "0xCE"
11 | }
12 | },
13 | "idiom" : "universal"
14 | },
15 | {
16 | "appearances" : [
17 | {
18 | "appearance" : "luminosity",
19 | "value" : "dark"
20 | }
21 | ],
22 | "color" : {
23 | "color-space" : "srgb",
24 | "components" : {
25 | "alpha" : "1.000",
26 | "blue" : "0.480",
27 | "green" : "0.450",
28 | "red" : "1.000"
29 | }
30 | },
31 | "idiom" : "universal"
32 | }
33 | ],
34 | "info" : {
35 | "author" : "xcode",
36 | "version" : 1
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/BrowserExtensionApp.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BrowserExtensionApp.swift
3 | // 2FAS - Two Factor Authentication (macOS)
4 | //
5 | // Created by Zbigniew Cisiński on 11/10/2023.
6 | //
7 |
8 | import SwiftUI
9 |
10 | @main
11 | struct BrowserExtensionApp: App {
12 | private let width: CGFloat = 846
13 | private let height: CGFloat = 646
14 | @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
15 |
16 | var body: some Scene {
17 | WindowGroup {
18 | ZStack {
19 | Rectangle()
20 | .foregroundColor(Color.mainBackground)
21 | .frame(maxWidth: .infinity, maxHeight: .infinity)
22 |
23 | ContentView(presenter: Presenter())
24 | .frame(
25 | minWidth: width,
26 | idealWidth: width,
27 | maxWidth: width,
28 | minHeight: height,
29 | idealHeight: height,
30 | maxHeight: height,
31 | alignment: .center
32 | )
33 | .padding(0)
34 | .clipped()
35 | }
36 | }
37 | .windowStyle(.titleBar)
38 | .windowConfiguration(width: width, height: height)
39 | }
40 | }
41 |
42 | extension Scene {
43 | func windowConfiguration(width: CGFloat, height: CGFloat) -> some Scene {
44 | if #available(macOS 13.0, *) {
45 | return self
46 | .defaultSize(CGSize(width: width, height: height))
47 | .windowResizability(.contentMinSize)
48 | .defaultPosition(.center)
49 | }
50 | else {
51 | return self
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Fonts/Montserrat-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Fonts/Montserrat-Bold.ttf
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Fonts/Montserrat-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/2FAS - Two factor authentication/macOS (App)/Fonts/Montserrat-Regular.ttf
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (App)/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ATSApplicationFontsPath
6 | .
7 | ITSAppUsesNonExemptEncryption
8 |
9 | SFSafariWebExtensionConverterVersion
10 | 13.4.1
11 | UIApplicationSceneManifest
12 |
13 | UIApplicationSupportsMultipleScenes
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (Extension)/2FAS - Two factor authentication.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.files.user-selected.read-only
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/2FAS - Two factor authentication/macOS (Extension)/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSExtension
6 |
7 | NSExtensionPointIdentifier
8 | com.apple.Safari.web-extension
9 | NSExtensionPrincipalClass
10 | $(PRODUCT_MODULE_NAME).SafariWebExtensionHandler
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security
2 |
3 | At 2FAS, the security is a top priority. If you encounter a potential security issue please report it following the guidelines below.
4 |
5 | ## Reporting Security Issues
6 |
7 | If you believe you've discovered a security vulnerability in our Browser Extension, please do not post it publicly on GitHub. Instead, contact our security team directly by emailing [security@2fas.com](mailto:security@2fas.com). If possible, please encrypt your message using our PGP key ([here](https://keys.openpgp.org/search?q=security%402fas.com))
8 |
9 | To help us address the issue quickly, please include the following information:
10 |
11 | - The specific product affected (e.g., iOS app, Android app, Browser Extension, API server, etc.)
12 | - Type of issue (e.g., unauthorized data access, privilege escalation, etc.)
13 | - Detailed steps to reproduce the issue
14 | - Any relevant details about the affected environment (e.g., device model, OS version)
15 | - Potential impact and any proof-of-concept code, if available
16 |
17 | You should expect a response within 72 hours. If you don't receive a confirmation, please follow up to ensure we received your report.
18 |
19 | ## Communication Language
20 |
21 | We prefer all communications to be in English.
22 |
23 | ## Policy
24 |
25 | 2FAS adheres to the principles of Coordinated Vulnerability Disclosure.
26 |
--------------------------------------------------------------------------------
/src/_locales/en/installPage.json:
--------------------------------------------------------------------------------
1 | {
2 | "installTitle": "2FAS Browser Extension | Configuration",
3 | "installH1": "To start, you need to pair this extension with the 2FAS Auth mobile application.",
4 | "installAppInstalled": "I've installed the app",
5 | "installScan": "Scan this code with your 2FAS Auth mobile app",
6 | "installStep1": "Open the 2FAS Auth mobile app",
7 | "installStep2": "Go to Settings → Browser Extension",
8 | "installStep3": "Tap \"Pair with web browser\" and scan the QR code",
9 | "installSuccessHeader": "2FAS Browser Extension is successfully paired with your 2FAS Auth app",
10 | "installSuccessSubheader": "Now you can quickly autofill Two-Factor forms with mobile app confirmation.",
11 | "installStart": "Learn how it works",
12 | "installGoToSettings": "Go to settings",
13 | "installQuestions": "Any questions? Read our",
14 | "installBackToStep1": "Back to step 1",
15 | "installQRTimeoutText": "The QR code has expired",
16 | "installQRTimeoutButton": "Click here to regenerate"
17 | }
--------------------------------------------------------------------------------
/src/_locales/en/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "appDesc": "2FAS Browser Extension is simple, private, and secure: 1 click, 1 tap, and your token is automatically entered!",
3 | "shortcutDesc": "Send a request to 2FAS"
4 | }
--------------------------------------------------------------------------------
/src/_locales/en/months.json:
--------------------------------------------------------------------------------
1 | {
2 | "january": "January",
3 | "february": "February",
4 | "march": "March",
5 | "april": "April",
6 | "may": "May",
7 | "june": "June",
8 | "july": "July",
9 | "august": "August",
10 | "september": "September",
11 | "october": "October",
12 | "november": "November",
13 | "december": "December"
14 | }
--------------------------------------------------------------------------------
/src/_locales/en/token.json:
--------------------------------------------------------------------------------
1 | {
2 | "tokenHeader": "Your token",
3 | "tokenCopy": "Copy",
4 | "tokenCopied": "Copied",
5 | "tokenDescription": "Copy the token and paste it in the input field. The token will expire in 30 seconds."
6 | }
7 |
--------------------------------------------------------------------------------
/src/background/events/index.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | exports.handleConfigurationRequest = require('./handleConfigurationRequest');
21 | exports.handleLoginRequest = require('./handleLoginRequest');
22 |
--------------------------------------------------------------------------------
/src/background/functions/ab2b64.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | /* global btoa */
21 | const ab2b64 = arrayBuffer => {
22 | return btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)));
23 | };
24 |
25 | module.exports = ab2b64;
26 |
--------------------------------------------------------------------------------
/src/background/functions/b642ab.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | /* global atob */
21 | const b642ab = base64string => {
22 | return Uint8Array.from(atob(base64string), c => c.charCodeAt(0));
23 | }
24 |
25 | module.exports = b642ab;
26 |
--------------------------------------------------------------------------------
/src/background/functions/checkIconTitleText.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 | const showNativePush = require('../../notification/functions/showNativePush');
22 | const config = require('../../config');
23 |
24 | const checkIconTitleText = async tabID => {
25 | if (
26 | !tabID ||
27 | parseInt(tabID, 10) < 0
28 | ) {
29 | return true;
30 | }
31 |
32 | if (process.env.EXT_PLATFORM === 'Safari') {
33 | return true;
34 | }
35 |
36 | const badgeText = await browser.action.getTitle({ tabId: tabID });
37 |
38 | if (badgeText === browser.i18n.getMessage('inActiveTabInfo')) {
39 | showNativePush(config.Texts.Error.InactiveTab, true);
40 | return false;
41 | }
42 |
43 | return true;
44 | };
45 |
46 | module.exports = checkIconTitleText;
47 |
--------------------------------------------------------------------------------
/src/background/functions/closeWSChannel.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const closeWSChannel = channel => {
21 | if (channel.ws.readyState === 1) {
22 | channel.ws.close();
23 | }
24 | };
25 |
26 | module.exports = closeWSChannel;
27 |
--------------------------------------------------------------------------------
/src/background/functions/createFirefoxOptionsMenu.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const createFirefoxOptionsMenu = () => {
23 | if (process.env.EXT_PLATFORM === 'Firefox') {
24 | browser.contextMenus.create({
25 | title: browser.i18n.getMessage('options'),
26 | id: 'twofas-firefox-options-menu',
27 | contexts: ['action'],
28 | enabled: true,
29 | type: 'normal',
30 | visible: true
31 | });
32 | }
33 | };
34 |
35 | module.exports = createFirefoxOptionsMenu;
36 |
--------------------------------------------------------------------------------
/src/background/functions/dummyGetLocalStorage.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const loadFromLocalStorage = require('../../localStorage/loadFromLocalStorage');
21 |
22 | const dummyGetLocalStorage = () => {
23 | return loadFromLocalStorage('extensionID')
24 | .then(storage => {
25 | storage = null;
26 | });
27 | };
28 |
29 | module.exports = dummyGetLocalStorage;
30 |
--------------------------------------------------------------------------------
/src/background/functions/getOSName.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | /* global navigator */
21 | const browser = require('webextension-polyfill');
22 |
23 | const getOSName = () => {
24 | let osName = browser.i18n.getMessage('unknownOS');
25 |
26 | if (navigator.userAgentData) {
27 | osName = navigator.userAgentData.platform;
28 | } else {
29 | if (navigator.userAgent.indexOf('Windows') !== -1) {
30 | osName = 'Windows';
31 | }
32 |
33 | if (navigator.userAgent.indexOf('Mac') !== -1) {
34 | osName = 'macOS';
35 | }
36 |
37 | if (navigator.userAgent.indexOf('X11') !== -1) {
38 | osName = 'UNIX';
39 | }
40 |
41 | if (navigator.userAgent.indexOf('Linux') !== -1) {
42 | osName = 'Linux';
43 | }
44 | }
45 |
46 | return osName;
47 | };
48 |
49 | module.exports = getOSName;
50 |
--------------------------------------------------------------------------------
/src/background/functions/onCommand.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 | const browserAction = require('./browserAction');
22 |
23 | const onCommand = command => {
24 | switch (command) {
25 | case 'tokenRequest':
26 | case 'tokenRequestSecondary': {
27 | return browser
28 | .tabs
29 | .query({ active: true, currentWindow: true })
30 | .then(tabs => browserAction(tabs[0]));
31 | }
32 |
33 | default: return false;
34 | }
35 | };
36 |
37 | module.exports = onCommand;
38 |
--------------------------------------------------------------------------------
/src/background/functions/onContextMenuClick.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 | const browserAction = require('./browserAction');
22 | const openBrowserPage = require('./openBrowserPage');
23 |
24 | const onContextMenuClick = (info, tab) => {
25 | if (info?.menuItemId === 'twofas-firefox-options-menu') {
26 | return openBrowserPage(browser.runtime.getURL('/optionsPage/optionsPage.html'));
27 | }
28 |
29 | if (info?.menuItemId === 'twofas-context-menu') {
30 | return browserAction(tab);
31 | }
32 | };
33 |
34 | module.exports = onContextMenuClick;
35 |
--------------------------------------------------------------------------------
/src/background/functions/openBrowserPage.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const openBrowserPage = url => {
23 | return browser.tabs.create({ url });
24 | };
25 |
26 | module.exports = openBrowserPage;
27 |
--------------------------------------------------------------------------------
/src/background/functions/openInstallPage.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const openInstallPage = () => {
23 | return browser.tabs.create({ url: 'installPage/installPage.html' });
24 | };
25 |
26 | module.exports = openInstallPage;
27 |
--------------------------------------------------------------------------------
/src/background/functions/sendMessageToAllFrames.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const sendMessageToAllFrames = async (tabId, message) => {
23 | let frames;
24 |
25 | try {
26 | frames = await browser.webNavigation.getAllFrames({ tabId });
27 | } catch {
28 | return false;
29 | }
30 |
31 | return Promise.all(
32 | frames.map(frame => browser.tabs.sendMessage(tabId, message, { frameId: frame.frameId }).catch(() => false))
33 | );
34 | };
35 |
36 | module.exports = sendMessageToAllFrames;
37 |
--------------------------------------------------------------------------------
/src/background/functions/sendNotificationInfo.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const config = require('../../config');
21 | const storeLog = require('../../partials/storeLog');
22 | const loadFromLocalStorage = require('../../localStorage/loadFromLocalStorage');
23 | const TwoFasNotification = require('../../notification');
24 | const sendMessageToTab = require('../../partials/sendMessageToTab');
25 |
26 | const sendNotificationInfo = tab => {
27 | return loadFromLocalStorage(['nativePush'])
28 | .then(storage => {
29 | if (!storage.nativePush) {
30 | return Promise.resolve();
31 | }
32 |
33 | return sendMessageToTab(tab?.id, { action: 'notificationInfo' });
34 | })
35 | .catch(async err => {
36 | await storeLog('error', 10, err, tab?.url);
37 | return TwoFasNotification.show(config.Texts.Error.UndefinedError, tab?.id);
38 | });
39 | };
40 |
41 | module.exports = sendNotificationInfo;
42 |
--------------------------------------------------------------------------------
/src/background/functions/update/index.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | exports.updateBrowserExtension = require('./updateBrowserExtension');
21 | exports.updateIncognitoAccess = require('./updateIncognitoAccess');
22 | exports.verifyStorageIntegrity = require('./verifyStorageIntegrity');
23 |
--------------------------------------------------------------------------------
/src/background/functions/update/verifyStorageIntegrity.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const loadFromLocalStorage = require('../../../localStorage/loadFromLocalStorage');
21 | const generateDefaultStorage = require('../generateDefaultStorage');
22 | const storeLog = require('../../../partials/storeLog');
23 |
24 | const verifyStorageIntegrity = browserInfo => {
25 | return loadFromLocalStorage(['keys', 'extensionID'])
26 | .then(storage => {
27 | if (
28 | !storage.keys ||
29 | !storage?.keys?.publicKey ||
30 | !storage?.keys?.privateKey ||
31 | !storage?.extensionID
32 | ) {
33 | return generateDefaultStorage(browserInfo);
34 | }
35 |
36 | return true;
37 | })
38 | .catch(err => storeLog('error', 29, err, 'verifyStorageIntegrity'));
39 | };
40 |
41 | module.exports = verifyStorageIntegrity;
42 |
--------------------------------------------------------------------------------
/src/background/functions/updateBrowserInfo.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const storeLog = require('../../partials/storeLog');
21 | const { updateBrowserExtension, updateIncognitoAccess, verifyStorageIntegrity } = require('./update');
22 |
23 | const updateBrowserInfo = browserInfo => {
24 | return verifyStorageIntegrity(browserInfo)
25 | .then(() => updateBrowserExtension(browserInfo))
26 | .then(updateIncognitoAccess)
27 | .catch(err => storeLog('error', 6, err, 'updateBrowserInfo'));
28 | };
29 |
30 | module.exports = updateBrowserInfo;
31 |
--------------------------------------------------------------------------------
/src/background/functions/wsTabChanged.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const closeWSChannel = require('./closeWSChannel');
21 |
22 | const wsTabChanged = (tabIDChanged, changeInfo, tabIDws, channel, timeoutID) => {
23 | if (!changeInfo.url || !changeInfo.status === 'complete' || !changeInfo.status === 'loading') {
24 | return false;
25 | }
26 |
27 | if (tabIDChanged === tabIDws) {
28 | clearTimeout(timeoutID);
29 | closeWSChannel(channel);
30 | }
31 | };
32 |
33 | module.exports = wsTabChanged;
34 |
--------------------------------------------------------------------------------
/src/background/functions/wsTabClosed.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const closeWSChannel = require('./closeWSChannel');
21 |
22 | const wsTabClosed = (tabIDChanged, tabIDws, channel, timeoutID) => {
23 | if (tabIDChanged === tabIDws) {
24 | clearTimeout(timeoutID);
25 | closeWSChannel(channel);
26 | }
27 | };
28 |
29 | module.exports = wsTabClosed;
30 |
--------------------------------------------------------------------------------
/src/background/tabs/index.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | exports.onTabActivated = require('./onTabActivated');
21 | exports.onTabRemoved = require('./onTabRemoved');
22 | exports.onTabUpdated = require('./onTabUpdated');
23 |
--------------------------------------------------------------------------------
/src/background/tabs/onTabActivated.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const checkTabCS = require('../functions/checkTabCS');
21 |
22 | const onTabActivated = ({ tabId }) => {
23 | return checkTabCS(tabId);
24 | };
25 |
26 | module.exports = onTabActivated;
27 |
--------------------------------------------------------------------------------
/src/content/functions/addFormElementsNumber.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const addFormElementsNumber = elements => {
21 | let i = 0;
22 |
23 | if (!Array.isArray(elements) || elements?.length <= 0) {
24 | return false;
25 | }
26 |
27 | elements.map(element => {
28 | if (element?.dataset?.twofasElementNumber) {
29 | return false;
30 | }
31 |
32 | element.dataset.twofasElementNumber = i;
33 | i++;
34 | return element;
35 | });
36 | };
37 |
38 | module.exports = addFormElementsNumber;
39 |
--------------------------------------------------------------------------------
/src/content/functions/clearAfterInputToken.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const { loadFromLocalStorage, saveToLocalStorage } = require('../../localStorage')
21 |
22 | const clearAfterInputToken = (inputElement, tabID) => {
23 | // CLEAR INPUT
24 | if (inputElement) {
25 | if (typeof inputElement?.removeAttribute === 'function') {
26 | inputElement.removeAttribute('data-twofas-input');
27 | }
28 | }
29 |
30 | // CLEAR STORAGE
31 | return loadFromLocalStorage([`tabData-${tabID}`])
32 | .then(storage => {
33 | if (storage[`tabData-${tabID}`] && storage[`tabData-${tabID}`].lastFocusedInput) {
34 | delete storage[`tabData-${tabID}`].lastFocusedInput;
35 | return saveToLocalStorage({ [`tabData-${tabID}`]: storage[`tabData-${tabID}`] });
36 | }
37 |
38 | return true;
39 | })
40 | .catch(() => {});
41 | };
42 |
43 | module.exports = clearAfterInputToken;
44 |
--------------------------------------------------------------------------------
/src/content/functions/clearFormElementsNumber.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const clearFormElementsNumber = () => {
21 | const elements = Array.from(document.querySelectorAll('*[data-twofas-element-number]'));
22 | elements.forEach(element => {
23 | if (typeof element?.removeAttribute === 'function') {
24 | element.removeAttribute('data-twofas-element-number');
25 | }
26 | });
27 | };
28 |
29 | module.exports = clearFormElementsNumber;
30 |
--------------------------------------------------------------------------------
/src/content/functions/closeNotificationInfo.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const closeNotificationInfo = n => {
21 | n.notification.classList.remove('visible');
22 |
23 | setTimeout(() => {
24 | n.notification.classList.add('hidden');
25 | n = null;
26 | }, 300);
27 | };
28 |
29 | module.exports = closeNotificationInfo;
30 |
--------------------------------------------------------------------------------
/src/content/functions/getTokenInput.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const getTokenInputs = inputID => {
21 | if (!inputID) {
22 | return false;
23 | }
24 |
25 | return document.querySelector(`*[data-twofas-input="${inputID}"]`);
26 | };
27 |
28 | module.exports = getTokenInputs;
29 |
--------------------------------------------------------------------------------
/src/content/functions/isInFrame.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const isInFrame = () => {
21 | return window.self !== window.top;
22 | };
23 |
24 | module.exports = isInFrame;
25 |
--------------------------------------------------------------------------------
/src/content/functions/neverShowNotificationInfo.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const config = require('../../config');
21 | const closeNotificationInfo = require('./closeNotificationInfo');
22 | const saveToLocalStorage = require('../../localStorage/saveToLocalStorage');
23 | const storeLog = require('../../partials/storeLog');
24 | const TwoFasNotification = require('../../notification');
25 |
26 | const neverShowNotificationInfo = n => {
27 | return saveToLocalStorage({ notifications: true })
28 | .then(() => closeNotificationInfo(n))
29 | .catch(async err => {
30 | await storeLog('error', 18, err);
31 | return TwoFasNotification.show(config.Texts.Error.UndefinedError);
32 | });
33 | };
34 |
35 | module.exports = neverShowNotificationInfo;
36 |
--------------------------------------------------------------------------------
/src/content/functions/openOptionsPage.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const openOptionsPage = e => {
23 | if (e) {
24 | if (typeof e.preventDefault === 'function') {
25 | e.preventDefault();
26 | }
27 |
28 | if (typeof e.stopPropagation === 'function') {
29 | e.stopPropagation();
30 | }
31 | }
32 |
33 | const port = browser.runtime.connect({ name: '2FAS' });
34 |
35 | port.postMessage({
36 | action: 'openBrowserPage',
37 | url: browser.runtime.getURL('/optionsPage/optionsPage.html')
38 | });
39 | };
40 |
41 | module.exports = openOptionsPage;
42 |
--------------------------------------------------------------------------------
/src/defaultAutoSubmitExcludedDomains.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const defaultAutoSubmitExcludedDomains = [];
21 |
22 | module.exports = defaultAutoSubmitExcludedDomains;
23 |
--------------------------------------------------------------------------------
/src/fonts/montserrat-v25-latin-600.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/fonts/montserrat-v25-latin-600.woff2
--------------------------------------------------------------------------------
/src/fonts/montserrat-v25-latin-700.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/fonts/montserrat-v25-latin-700.woff2
--------------------------------------------------------------------------------
/src/fonts/montserrat-v25-latin-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/fonts/montserrat-v25-latin-regular.woff2
--------------------------------------------------------------------------------
/src/global-styles/_fonts.scss:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | @font-face {
21 | font-family: 'Montserrat';
22 | font-style: normal;
23 | font-weight: 400;
24 | font-display: swap;
25 | src: url("../fonts/montserrat-v25-latin-regular.woff2") format('woff2');
26 | }
27 |
28 | @font-face {
29 | font-family: 'Montserrat';
30 | font-style: normal;
31 | font-weight: 600;
32 | font-display: swap;
33 | src: url("../fonts/montserrat-v25-latin-600.woff2") format('woff2');
34 | }
35 |
36 | @font-face {
37 | font-family: 'Montserrat';
38 | font-style: normal;
39 | font-weight: 700;
40 | font-display: swap;
41 | src: url("../fonts/montserrat-v25-latin-700.woff2") format('woff2');
42 | }
--------------------------------------------------------------------------------
/src/images/close.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/images/copy-icon.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/images/cover-intro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/cover-intro.png
--------------------------------------------------------------------------------
/src/images/icons/icon128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon128.png
--------------------------------------------------------------------------------
/src/images/icons/icon128_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon128_1.png
--------------------------------------------------------------------------------
/src/images/icons/icon128_1gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon128_1gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon128_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon128_2.png
--------------------------------------------------------------------------------
/src/images/icons/icon128_2gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon128_2gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon128gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon128gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon128safari.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon128safari.png
--------------------------------------------------------------------------------
/src/images/icons/icon16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon16.png
--------------------------------------------------------------------------------
/src/images/icons/icon16_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon16_1.png
--------------------------------------------------------------------------------
/src/images/icons/icon16_1gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon16_1gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon16_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon16_2.png
--------------------------------------------------------------------------------
/src/images/icons/icon16_2gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon16_2gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon16gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon16gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon16safari.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon16safari.png
--------------------------------------------------------------------------------
/src/images/icons/icon32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon32.png
--------------------------------------------------------------------------------
/src/images/icons/icon32_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon32_1.png
--------------------------------------------------------------------------------
/src/images/icons/icon32_1gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon32_1gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon32_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon32_2.png
--------------------------------------------------------------------------------
/src/images/icons/icon32_2gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon32_2gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon32gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon32gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon32safari.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon32safari.png
--------------------------------------------------------------------------------
/src/images/icons/icon48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon48.png
--------------------------------------------------------------------------------
/src/images/icons/icon48_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon48_1.png
--------------------------------------------------------------------------------
/src/images/icons/icon48_1gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon48_1gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon48_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon48_2.png
--------------------------------------------------------------------------------
/src/images/icons/icon48_2gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon48_2gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon48gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon48gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon48safari.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon48safari.png
--------------------------------------------------------------------------------
/src/images/icons/icon96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon96.png
--------------------------------------------------------------------------------
/src/images/icons/icon96_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon96_1.png
--------------------------------------------------------------------------------
/src/images/icons/icon96_1gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon96_1gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon96_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon96_2.png
--------------------------------------------------------------------------------
/src/images/icons/icon96_2gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon96_2gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon96gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon96gray.png
--------------------------------------------------------------------------------
/src/images/icons/icon96safari.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/icons/icon96safari.png
--------------------------------------------------------------------------------
/src/images/install-page/open-tutorial-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/open-tutorial-dark.png
--------------------------------------------------------------------------------
/src/images/install-page/open-tutorial-dark@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/open-tutorial-dark@2x.png
--------------------------------------------------------------------------------
/src/images/install-page/open-tutorial-dark@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/open-tutorial-dark@3x.png
--------------------------------------------------------------------------------
/src/images/install-page/open-tutorial.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/open-tutorial.png
--------------------------------------------------------------------------------
/src/images/install-page/open-tutorial@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/open-tutorial@2x.png
--------------------------------------------------------------------------------
/src/images/install-page/open-tutorial@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/open-tutorial@3x.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext-dark.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext-dark@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext-dark@2x.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext-dark@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext-dark@3x.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext-firefox-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext-firefox-dark.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext-firefox-dark@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext-firefox-dark@2x.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext-firefox-dark@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext-firefox-dark@3x.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext-firefox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext-firefox.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext-firefox@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext-firefox@2x.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext-firefox@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext-firefox@3x.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext@2x.png
--------------------------------------------------------------------------------
/src/images/install-page/pin-ext@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/install-page/pin-ext@3x.png
--------------------------------------------------------------------------------
/src/images/notification-close.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/images/notification-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/images/page-icons/add.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/images/page-icons/close.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/images/page-icons/disconnect.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/images/page-icons/newpage.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/images/page-icons/trash.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/images/phone-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/phone-dark.png
--------------------------------------------------------------------------------
/src/images/phone-dark@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/phone-dark@2x.png
--------------------------------------------------------------------------------
/src/images/phone-dark@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/phone-dark@3x.png
--------------------------------------------------------------------------------
/src/images/phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/phone.png
--------------------------------------------------------------------------------
/src/images/phone@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/phone@2x.png
--------------------------------------------------------------------------------
/src/images/phone@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/phone@3x.png
--------------------------------------------------------------------------------
/src/images/qr-border.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/images/qr-phone-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/qr-phone-dark.png
--------------------------------------------------------------------------------
/src/images/qr-phone-dark@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/qr-phone-dark@2x.png
--------------------------------------------------------------------------------
/src/images/qr-phone-dark@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/qr-phone-dark@3x.png
--------------------------------------------------------------------------------
/src/images/qr-phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/qr-phone.png
--------------------------------------------------------------------------------
/src/images/qr-phone@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/qr-phone@2x.png
--------------------------------------------------------------------------------
/src/images/qr-phone@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/src/images/qr-phone@3x.png
--------------------------------------------------------------------------------
/src/images/shield-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/installPage/functions/configurationComplete.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 |
22 | const configurationComplete = () => {
23 | document.querySelector(S.installPage.newDevice).classList.add('hidden');
24 | document.querySelector(S.installPage.configured).classList.remove('hidden');
25 |
26 | if (typeof window !== 'undefined') {
27 | window.scrollTo(0, 0);
28 | }
29 | };
30 |
31 | module.exports = configurationComplete;
32 |
--------------------------------------------------------------------------------
/src/installPage/functions/generateQRCode.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const qrcode = require('qrcode');
21 |
22 | const generateQRCode = configLink => {
23 | return qrcode.toDataURL(configLink, {
24 | errorCorrectionLevel: 'H',
25 | quality: 1,
26 | width: 197
27 | }).catch(err => {
28 | throw new Error(err);
29 | });
30 | };
31 |
32 | module.exports = generateQRCode;
33 |
--------------------------------------------------------------------------------
/src/installPage/functions/index.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | exports.configurationComplete = require('./configurationComplete');
21 | exports.generateQRCode = require('./generateQRCode');
22 | exports.installContainerHandlers = require('./installContainerHandlers');
23 | exports.qrTimeout = require('./qrTimeout');
24 | exports.setQRCode = require('./setQRCode');
25 | exports.showIntegrityError = require('./showIntegrityError');
26 |
--------------------------------------------------------------------------------
/src/installPage/functions/setQRCode.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 | const qrTimeout = require('./qrTimeout');
22 |
23 | const setQRCode = (imageURL, channel, extensionID) => {
24 | return new Promise(() => {
25 | const QRImgs = document.querySelectorAll(S.installPage.qr.imgs);
26 | const QRManuals = document.querySelectorAll(S.installPage.qr.manual);
27 |
28 | if (QRImgs) {
29 | QRImgs.forEach(img => {
30 | img.src = imageURL;
31 | });
32 | }
33 |
34 | if (QRManuals) {
35 | QRManuals.forEach(manual => {
36 | manual.innerText = extensionID;
37 | });
38 | }
39 |
40 | return qrTimeout(QRImgs, channel);
41 | });
42 | };
43 |
44 | module.exports = setQRCode;
45 |
--------------------------------------------------------------------------------
/src/installPage/functions/showIntegrityError.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 |
22 | const showIntegrityError = () => {
23 | const el = document.querySelector(S.optionsPage.integrityError);
24 | el.classList.add('show-integrity-error');
25 | };
26 |
27 | module.exports = showIntegrityError;
28 |
--------------------------------------------------------------------------------
/src/localStorage/clearLocalStorage.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const clearLocalStorage = () => {
23 | return browser.storage.local.clear()
24 | .catch(err => {
25 | console.error({ err });
26 | throw new Error(err);
27 | });
28 | };
29 |
30 | module.exports = clearLocalStorage;
31 |
--------------------------------------------------------------------------------
/src/localStorage/index.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | exports.loadFromLocalStorage = require('./loadFromLocalStorage');
21 | exports.saveToLocalStorage = require('./saveToLocalStorage');
22 | exports.clearLocalStorage = require('./clearLocalStorage');
23 | exports.removeFromLocalStorage = require('./removeFromLocalStorage');
24 |
--------------------------------------------------------------------------------
/src/localStorage/loadFromLocalStorage.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const loadFromLocalStorage = key => {
23 | return browser.storage.local.get(key)
24 | .catch(err => {
25 | console.error({ err });
26 | throw new Error(err);
27 | });
28 | };
29 |
30 | module.exports = loadFromLocalStorage;
31 |
--------------------------------------------------------------------------------
/src/localStorage/removeFromLocalStorage.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const removeFromLocalStorage = key => {
23 | return browser.storage.local.remove(key.toString())
24 | .then(result => result)
25 | .catch(err => {
26 | console.error({ err });
27 | throw new Error(err);
28 | });
29 | };
30 |
31 | module.exports = removeFromLocalStorage;
32 |
--------------------------------------------------------------------------------
/src/localStorage/saveToLocalStorage.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const saveToLocalStorage = (data, storageObj = {}) => {
23 | return browser.storage.local.set(data)
24 | .then(() => Object.assign(storageObj, data))
25 | .catch(err => {
26 | console.error({ err });
27 | throw new Error(err);
28 | });
29 | };
30 |
31 | module.exports = saveToLocalStorage;
32 |
--------------------------------------------------------------------------------
/src/notification/functions/index.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | exports.sendFrontEndPushAction = require('./sendFrontEndPushAction');
21 | exports.showFrontEndPush = require('./showFrontEndPush');
22 | exports.showNativePush = require('./showNativePush');
23 | exports.showNativePushWithoutTimeout = require('./showNativePushWithoutTimeout');
24 |
--------------------------------------------------------------------------------
/src/notification/functions/sendFrontEndPushAction.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const sendFrontEndPushAction = (notificationObject, tabID, timeout) => {
23 | return browser.tabs.sendMessage(tabID, {
24 | action: 'notification',
25 | title: notificationObject.Title,
26 | message: notificationObject.Message,
27 | timeout
28 | });
29 | };
30 |
31 | module.exports = sendFrontEndPushAction;
32 |
--------------------------------------------------------------------------------
/src/notification/functions/showFrontEndPush.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const notification = require('../../content/functions/notification');
21 |
22 | const showFrontEndPush = (notificationObject, timeout) => {
23 | const notifObj = {
24 | title: notificationObject.Title,
25 | message: notificationObject.Message,
26 | timeout
27 | };
28 |
29 | return notification(notifObj);
30 | };
31 |
32 | module.exports = showFrontEndPush;
33 |
--------------------------------------------------------------------------------
/src/notification/functions/showNativePush.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const showNativePush = (notificationObject, alert) => {
23 | const notificationOptions = {
24 | title: notificationObject.Title,
25 | message: notificationObject.Message,
26 | iconUrl: '../images/icons/icon128.png',
27 | silent: !alert,
28 | requireInteraction: false,
29 | type: 'basic',
30 | priority: alert ? 1 : 0
31 | };
32 |
33 | if (process.env.EXT_PLATFORM === 'Firefox') {
34 | delete notificationOptions.silent;
35 | delete notificationOptions.requireInteraction;
36 | }
37 |
38 | return browser.notifications.create('', notificationOptions);
39 | };
40 |
41 | module.exports = showNativePush;
42 |
--------------------------------------------------------------------------------
/src/notification/functions/showNativePushWithoutTimeout.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const showNativePushWithoutTimeout = notificationObject => {
23 | const notificationOptions = {
24 | title: notificationObject.Title,
25 | message: notificationObject.Message,
26 | iconUrl: '../images/icons/icon128.png',
27 | silent: false,
28 | requireInteraction: true,
29 | type: 'basic',
30 | priority: 2
31 | };
32 |
33 | if (process.env.EXT_PLATFORM === 'Firefox') {
34 | delete notificationOptions.silent;
35 | delete notificationOptions.requireInteraction;
36 | }
37 |
38 | return browser.notifications.create('', notificationOptions);
39 | };
40 |
41 | module.exports = showNativePushWithoutTimeout;
42 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/confirmModalBackdropClick.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const hideConfirmModal = require('./hideConfirmModal');
21 |
22 | const confirmModalBackdropClick = e => {
23 | const elClassList = Array.from(e.target.classList);
24 |
25 | if (elClassList.includes('js-twofas-confirm-modal')) {
26 | hideConfirmModal();
27 | }
28 | };
29 |
30 | module.exports = confirmModalBackdropClick;
31 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/domainModalBackdropClick.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const hideDomainModal = require('./hideDomainModal');
21 |
22 | const domainModalBackdropClick = e => {
23 | const elClassList = Array.from(e.target.classList);
24 |
25 | if (elClassList.includes('js-twofas-domain-modal')) {
26 | hideDomainModal();
27 | }
28 | };
29 |
30 | module.exports = domainModalBackdropClick;
31 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/generateEmptyDeviceRow.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 | const { createElement, createTextElement } = require('../../partials/DOMElements');
22 |
23 | const generateEmptyDeviceRow = tbody => {
24 | let t = {
25 | tr: null,
26 | td: null,
27 | noDevice: null
28 | };
29 |
30 | t.tr = createElement('tr');
31 | t.td = createElement('td');
32 | t.td.setAttribute('colspan', '4');
33 |
34 | t.noDevice = createTextElement('p', browser.i18n.getMessage('noPairedDevices'));
35 |
36 | t.td.appendChild(t.noDevice);
37 | t.tr.appendChild(t.td);
38 | tbody.appendChild(t.tr);
39 |
40 | t = null;
41 | };
42 |
43 | module.exports = generateEmptyDeviceRow;
44 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/generateEmptyDomainRow.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 | const { createElement, createTextElement } = require('../../partials/DOMElements');
22 |
23 | const generateEmptyDomainRow = tbody => {
24 | let t = {
25 | tr: null,
26 | td: null,
27 | noExcludedDomains: null
28 | };
29 |
30 | t.tr = createElement('tr');
31 | t.td = createElement('td');
32 | t.td.setAttribute('colspan', '2');
33 |
34 | t.noExcludedDomains = createTextElement('p', browser.i18n.getMessage('noExcludedDomains'));
35 |
36 | t.td.appendChild(t.noExcludedDomains);
37 | t.tr.appendChild(t.td);
38 | tbody.appendChild(t.tr);
39 |
40 | t = null;
41 | };
42 |
43 | module.exports = generateEmptyDomainRow;
44 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/handleAdvancedHeaderClick.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 |
22 | const handleAdvancedHeaderClick = e => {
23 | e.preventDefault();
24 | e.stopPropagation();
25 |
26 | document.querySelector(S.optionsPage.advanced.header).classList.toggle('open');
27 | document.querySelector(S.optionsPage.advanced.content).classList.toggle('visible');
28 | };
29 |
30 | module.exports = handleAdvancedHeaderClick;
31 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/handleAutoSubmitChange.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const saveToLocalStorage = require('../../localStorage/saveToLocalStorage');
21 |
22 | const handleAutoSubmitChange = e => {
23 | return saveToLocalStorage({ autoSubmitEnabled: e.currentTarget.checked });
24 | };
25 |
26 | module.exports = handleAutoSubmitChange;
27 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/handleContextMenuChange.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 | const saveToLocalStorage = require('../../localStorage/saveToLocalStorage');
22 | const createContextMenus = require('../../background/functions/createContextMenus');
23 |
24 | const handleContextMenuChange = e => {
25 | return saveToLocalStorage({ contextMenu: e.currentTarget.checked })
26 | .then(async storage => {
27 | if (storage.contextMenu) {
28 | await browser.contextMenus.removeAll();
29 | createContextMenus();
30 | } else {
31 | try {
32 | await browser.contextMenus.remove('twofas-context-menu');
33 | } catch {}
34 | }
35 | });
36 | };
37 |
38 | module.exports = handleContextMenuChange;
39 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/handleHamburgerClick.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 |
22 | const handleHamburgerClick = e => {
23 | e.preventDefault();
24 | e.stopPropagation();
25 |
26 | const menuContent = document.querySelector(S.optionsPage.hamburger.content);
27 | menuContent.classList.toggle('visible');
28 | };
29 |
30 | module.exports = handleHamburgerClick;
31 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/handleLoggingChange.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const saveToLocalStorage = require('../../localStorage/saveToLocalStorage');
21 |
22 | const handleLoggingChange = e => {
23 | return saveToLocalStorage({ logging: e.currentTarget.checked });
24 | };
25 |
26 | module.exports = handleLoggingChange;
27 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/handlePinInfo.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const saveToLocalStorage = require('../../localStorage/saveToLocalStorage');
21 | const S = require('../../selectors');
22 |
23 | const handlePinInfo = () => {
24 | const view = document.querySelector(S.optionsPage.pin.info);
25 | view.classList.add('hidden');
26 |
27 | return saveToLocalStorage({ pinInfo: true });
28 | };
29 |
30 | module.exports = handlePinInfo;
31 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/handlePinInfoNext.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 |
22 | const handlePinInfoNext = () => {
23 | const slider = document.querySelector(S.optionsPage.pin.slider);
24 |
25 | if (slider) {
26 | slider.classList.add('step2');
27 | }
28 | };
29 |
30 | module.exports = handlePinInfoNext;
31 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/handlePinInfoPrev.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 |
22 | const handlePinInfoPrev = () => {
23 | const slider = document.querySelector(S.optionsPage.pin.slider);
24 |
25 | if (slider) {
26 | slider.classList.remove('step2');
27 | }
28 | };
29 |
30 | module.exports = handlePinInfoPrev;
31 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/handlePushChange.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const saveToLocalStorage = require('../../localStorage/saveToLocalStorage');
21 |
22 | const handlePushChange = e => {
23 | return saveToLocalStorage({ nativePush: e.target.value === 'native' });
24 | };
25 |
26 | module.exports = handlePushChange;
27 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/hideConfirmModal.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 |
22 | const hideConfirmModal = () => {
23 | const modalEl = document.querySelector(S.optionsPage.confirmModal.element);
24 | const headerEl = document.querySelector(S.optionsPage.confirmModal.header);
25 | const textEl = document.querySelector(S.optionsPage.confirmModal.text);
26 |
27 | modalEl.classList.add('hidden');
28 |
29 | setTimeout(() => {
30 | headerEl.textContent = '';
31 | textEl.textContent = '';
32 | }, 201);
33 | };
34 |
35 | module.exports = hideConfirmModal;
36 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/hideDomainModal.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 |
22 | const hideDomainModal = () => {
23 | const modalEl = document.querySelector(S.optionsPage.domainModal.element);
24 | const inputEl = document.querySelector(S.optionsPage.domainModal.input);
25 | const validationEl = document.querySelector(S.optionsPage.domainModal.validation);
26 |
27 | modalEl.classList.add('hidden');
28 | inputEl.value = '';
29 | validationEl.innerText = '';
30 | };
31 |
32 | module.exports = hideDomainModal;
33 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/removeDeviceFromDOM.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const generateEmptyDeviceRow = require('./generateEmptyDeviceRow');
21 | const S = require('../../selectors');
22 |
23 | const removeDeviceFromDOM = deviceID => {
24 | const tr = document.querySelector(`tr[data-device-id="${deviceID}"]`);
25 |
26 | if (tr && typeof tr.remove === 'function') {
27 | tr.remove();
28 | }
29 |
30 | const tbody = document.querySelector(S.optionsPage.devicesList);
31 |
32 | if (tbody.childElementCount === 0) {
33 | generateEmptyDeviceRow(tbody);
34 | }
35 |
36 | return true;
37 | };
38 |
39 | module.exports = removeDeviceFromDOM;
40 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/removeDomainFromDOM.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const generateEmptyDomainRow = require('./generateEmptyDomainRow');
21 | const S = require('../../selectors');
22 |
23 | const removeDomainFromDOM = domain => {
24 | const tr = document.querySelector(`tr[data-domain="${domain}"]`);
25 |
26 | if (tr && typeof tr.remove === 'function') {
27 | tr.remove();
28 | }
29 |
30 | const tbody = document.querySelector(S.optionsPage.autoSubmit.list);
31 |
32 | if (tbody.childElementCount === 0) {
33 | generateEmptyDomainRow(tbody);
34 | }
35 |
36 | return true;
37 | };
38 |
39 | module.exports = removeDomainFromDOM;
40 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/sendTestNotification.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const TwoFasNotification = require('../../notification');
21 | const config = require('../../config');
22 |
23 | const sendTestNotification = () => {
24 | return TwoFasNotification.show(config.Texts.Info.Test);
25 | };
26 |
27 | module.exports = sendTestNotification;
28 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/setContextMenuToggle.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const { loadFromLocalStorage, saveToLocalStorage } = require('../../localStorage');
21 |
22 | const setContextMenuToggle = () => {
23 | return loadFromLocalStorage(['contextMenu'])
24 | .then(storage => {
25 | if (!('contextMenu' in storage)) {
26 | return saveToLocalStorage({ contextMenu: true }, storage);
27 | }
28 |
29 | return storage;
30 | })
31 | .then(storage => {
32 | const contextMenuToggle = document.querySelector('input#twofas-context-menu');
33 |
34 | if (contextMenuToggle) {
35 | contextMenuToggle.checked = storage.contextMenu;
36 | }
37 |
38 | return Promise.resolve();
39 | })
40 | .catch(() => {});
41 | };
42 |
43 | module.exports = setContextMenuToggle;
44 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/setExtName.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 |
22 | const setExtName = extName => {
23 | const extNameEl = document.querySelector(S.extName.input);
24 | extNameEl.value = extName;
25 | };
26 |
27 | module.exports = setExtName;
28 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/setExtNameUpdateForm.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 | const extNameUpdate = require('../../partials/extNameUpdate');
22 |
23 | const setExtNameUpdateForm = storage => {
24 | const extNameUpdateForm = document.querySelector(S.extName.updateForm);
25 | extNameUpdateForm.addEventListener('submit', e => extNameUpdate(storage, e));
26 | };
27 |
28 | module.exports = setExtNameUpdateForm;
29 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/setExtVersion.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 | const S = require('../../selectors');
22 |
23 | const setExtVersion = () => {
24 | const version = browser.runtime.getManifest().version;
25 |
26 | document.querySelectorAll(S.optionsPage.extVersion).forEach(el => {
27 | el.innerText = version;
28 | });
29 | };
30 |
31 | module.exports = setExtVersion;
32 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/setHamburger.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 | const handleHamburgerClick = require('./handleHamburgerClick');
22 |
23 | const setHamburger = () => {
24 | const hamburger = document.querySelector(S.optionsPage.hamburger.element);
25 |
26 | if (hamburger) {
27 | hamburger.addEventListener('click', handleHamburgerClick);
28 | }
29 | };
30 |
31 | module.exports = setHamburger;
32 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/setImportDefaultExcludedDomains.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 | const handleImportDefaultExcludedDomains = require('./handleImportDefaultExcludedDomains');
22 |
23 | const setImportDefaultExcludedDomains = () => {
24 | const importDefaultListBtn = document.querySelector(S.optionsPage.autoSubmit.importDefault);
25 | importDefaultListBtn.addEventListener('click', handleImportDefaultExcludedDomains);
26 | };
27 |
28 | module.exports = setImportDefaultExcludedDomains;
29 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/setLoggingToggle.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const { loadFromLocalStorage, saveToLocalStorage } = require('../../localStorage');
21 |
22 | const setLoggingToggle = () => {
23 | return loadFromLocalStorage(['logging'])
24 | .then(storage => {
25 | if (!('logging' in storage)) {
26 | return saveToLocalStorage({ logging: false }, storage);
27 | }
28 |
29 | return storage;
30 | })
31 | .then(storage => {
32 | const loggingToggle = document.querySelector('input#twofas-logs');
33 |
34 | if (loggingToggle) {
35 | loggingToggle.checked = storage.logging;
36 | }
37 |
38 | return Promise.resolve();
39 | })
40 | .catch(() => {});
41 | };
42 |
43 | module.exports = setLoggingToggle;
44 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/setMenuLinks.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 | const handleMenuLink = require('./handleMenuLink');
22 |
23 | const setMenuLinks = () => {
24 | const menuLinks = document.querySelectorAll(S.optionsPage.menuLink);
25 | menuLinks.forEach(el => el.addEventListener('click', handleMenuLink));
26 | };
27 |
28 | module.exports = setMenuLinks;
29 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/setPinInfo.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const loadFromLocalStorage = require('../../localStorage/loadFromLocalStorage');
21 | const S = require('../../selectors');
22 |
23 | const setPinInfo = () => {
24 | return loadFromLocalStorage('pinInfo')
25 | .then(data => {
26 | if (!data.pinInfo) {
27 | const pinInfo = document.querySelector(S.optionsPage.pin.info);
28 |
29 | if (pinInfo) {
30 | pinInfo.classList.remove('hidden');
31 | }
32 | }
33 | });
34 | };
35 |
36 | module.exports = setPinInfo;
37 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/setPinInfoBtns.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 | const handlePinInfo = require('./handlePinInfo');
22 | const handlePinInfoNext = require('./handlePinInfoNext');
23 | const handlePinInfoPrev = require('./handlePinInfoPrev');
24 |
25 | const setPinInfoBtns = () => {
26 | const gotIt = document.querySelector(S.optionsPage.pin.gotIt);
27 | const next = document.querySelectorAll(S.optionsPage.pin.next);
28 | const prev = document.querySelector(S.optionsPage.pin.prev);
29 |
30 | if (gotIt) {
31 | gotIt.addEventListener('click', handlePinInfo);
32 | }
33 |
34 | if (next) {
35 | next.forEach(btn => {
36 | btn.addEventListener('click', handlePinInfoNext);
37 | });
38 | }
39 |
40 | if (prev) {
41 | prev.addEventListener('click', handlePinInfoPrev);
42 | }
43 | };
44 |
45 | module.exports = setPinInfoBtns;
46 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/showDomainModal.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 |
22 | const showDomainModal = e => {
23 | e.preventDefault();
24 | e.stopPropagation();
25 |
26 | const modalEl = document.querySelector(S.optionsPage.domainModal.element);
27 | const validation = document.querySelector(S.optionsPage.domainModal.validation);
28 | const inputEl = document.querySelector(S.optionsPage.domainModal.input);
29 |
30 | modalEl.classList.remove('hidden');
31 | validation.innerText = '';
32 |
33 | setTimeout(() => {
34 | inputEl.focus();
35 | }, 200);
36 | };
37 |
38 | module.exports = showDomainModal;
39 |
--------------------------------------------------------------------------------
/src/optionsPage/functions/showIntegrityError.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const S = require('../../selectors');
21 |
22 | const showIntegrityError = () => {
23 | const el = document.querySelector(S.optionsPage.integrityError);
24 | el.classList.add('show-integrity-error');
25 | };
26 |
27 | module.exports = showIntegrityError;
28 |
--------------------------------------------------------------------------------
/src/partials/DOMElements/createElement.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const createElement = (tagName, className = '') => {
21 | const el = document.createElement(tagName);
22 | el.className = className;
23 |
24 | return el;
25 | };
26 |
27 | module.exports = createElement;
28 |
--------------------------------------------------------------------------------
/src/partials/DOMElements/createImageElement.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const createImageElement = (src, alt) => {
21 | const img = document.createElement('img');
22 | img.src = src;
23 | img.alt = alt;
24 |
25 | return img;
26 | };
27 |
28 | module.exports = createImageElement;
29 |
--------------------------------------------------------------------------------
/src/partials/DOMElements/createSVGElement.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const createSVGElement = data => {
21 | const svg = document.createElement('svg');
22 | svg.innerHTML = data.trim();
23 |
24 | return svg.firstChild;
25 | };
26 |
27 | module.exports = createSVGElement;
28 |
--------------------------------------------------------------------------------
/src/partials/DOMElements/createTextElement.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const createTextElement = (tagName, text, className = '') => {
21 | const el = document.createElement(tagName);
22 | el.className = className;
23 |
24 | const elText = document.createTextNode(text);
25 | el.appendChild(elText);
26 |
27 | return el;
28 | };
29 |
30 | module.exports = createTextElement;
31 |
--------------------------------------------------------------------------------
/src/partials/DOMElements/index.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | exports.createElement = require('./createElement');
21 | exports.createImageElement = require('./createImageElement');
22 | exports.createSVGElement = require('./createSVGElement');
23 | exports.createTextElement = require('./createTextElement');
24 |
--------------------------------------------------------------------------------
/src/partials/delay.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const delay = (f, t) => {
21 | return new Promise(resolve => {
22 | setTimeout(() => {
23 | f();
24 | return resolve();
25 | }, t);
26 | });
27 | };
28 |
29 | module.exports = delay;
30 |
--------------------------------------------------------------------------------
/src/partials/extPageOnMessage.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const { notification, showNotificationInfo } = require('../content/functions');
21 |
22 | const extPageOnMessage = (request) => {
23 | if (!request || !request.action) {
24 | return { status: 'error' };
25 | }
26 |
27 | switch (request.action) {
28 | case 'notification': {
29 | return notification(request);
30 | }
31 |
32 | case 'notificationInfo': {
33 | return showNotificationInfo();
34 | }
35 |
36 | default: {
37 | return { status: 'error' };
38 | }
39 | }
40 | };
41 |
42 | module.exports = extPageOnMessage;
43 |
--------------------------------------------------------------------------------
/src/partials/formSubmitSelectors.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const ignoreButtonSelectors = require('./ignoreButtonSelectors');
21 |
22 | const formSubmitSelectors = () => {
23 | let buttonSelectors = [
24 | 'button[type="submit"]',
25 | 'input[type="submit"]'
26 | ];
27 |
28 | const linkSelectors = [];
29 |
30 | buttonSelectors = buttonSelectors.map(selector => {
31 | return selector + ignoreButtonSelectors().join('');
32 | });
33 |
34 | if (linkSelectors.length <= 0) {
35 | return buttonSelectors.join(',');
36 | }
37 |
38 | return buttonSelectors.join(',') + ',' + linkSelectors.join(',');
39 | };
40 |
41 | module.exports = formSubmitSelectors;
42 |
--------------------------------------------------------------------------------
/src/partials/handleTargetBlank.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const handleTargetBlank = () => {
23 | if (process.env.EXT_PLATFORM !== 'Safari') {
24 | return;
25 | }
26 |
27 | const nodes = Array.from(document.querySelectorAll('a.twofas-new-tab-link'));
28 |
29 | nodes.forEach(node => {
30 | node.addEventListener('click', function (e) {
31 | e.preventDefault();
32 | e.stopPropagation();
33 |
34 | const url = this?.href;
35 |
36 | if (typeof window === 'undefined' || !url || url.length <= 0) {
37 | return;
38 | }
39 |
40 | return browser.tabs.create({ url });
41 | });
42 | });
43 | };
44 |
45 | module.exports = handleTargetBlank;
46 |
--------------------------------------------------------------------------------
/src/partials/i18n.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const i18n = () => {
23 | let elements = document.querySelectorAll('[data-i18n]');
24 |
25 | elements.forEach(element => {
26 | let type = element.localName.toLowerCase();
27 | let i18nID = element.getAttribute('data-i18n');
28 | let m = browser.i18n.getMessage(i18nID);
29 |
30 | if (!m) {
31 | console.log(`i18n: ${i18nID} not found`);
32 | return false;
33 | }
34 |
35 | if (type === 'img') {
36 | element.setAttribute('alt', m);
37 | } else if (type === 'input') {
38 | element.setAttribute('placeholder', m);
39 | } else {
40 | element.innerText = m;
41 | }
42 |
43 | type = null;
44 | i18nID = null;
45 | m = null;
46 | });
47 |
48 | elements = null;
49 | };
50 |
51 | module.exports = i18n;
52 |
--------------------------------------------------------------------------------
/src/partials/ignoreButtonSelectors.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const ignoreButtonSelectors = () => {
21 | return [
22 | ':not([data-role*="search"])',
23 | ':not(#search-button)',
24 | ':not(#search)',
25 | ':not([class*="dropdown"])',
26 | ':not([class*="cancel"])',
27 | ':not([class*="checkbox"])',
28 | ':not([class*="mail"])',
29 | ':not([class*="phone"])',
30 | ':not([disabled])',
31 | ':not([style*="display:none"])',
32 | ':not([style*="opacity:0"])',
33 | ':not([style*="visibility:hidden"])',
34 | ':not([class*="twofas"])',
35 | ':not(#terminate_session_submit)',
36 | ':not(#signin-button)'
37 | ];
38 | };
39 |
40 | module.exports = ignoreButtonSelectors;
41 |
--------------------------------------------------------------------------------
/src/partials/months.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const browser = require('webextension-polyfill');
21 |
22 | const months = [
23 | browser.i18n.getMessage('january'),
24 | browser.i18n.getMessage('february'),
25 | browser.i18n.getMessage('march'),
26 | browser.i18n.getMessage('april'),
27 | browser.i18n.getMessage('may'),
28 | browser.i18n.getMessage('june'),
29 | browser.i18n.getMessage('july'),
30 | browser.i18n.getMessage('august'),
31 | browser.i18n.getMessage('september'),
32 | browser.i18n.getMessage('october'),
33 | browser.i18n.getMessage('november'),
34 | browser.i18n.getMessage('december')
35 | ];
36 |
37 | module.exports = months;
38 |
--------------------------------------------------------------------------------
/src/partials/onTabFocused.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const onTabFocused = (onFocus, onBlur) => {
21 | if (document.visibilityState === 'visible') {
22 | if (typeof onFocus === 'function') {
23 | onFocus();
24 | }
25 | } else {
26 | if (typeof onBlur === 'function') {
27 | onBlur();
28 | }
29 | }
30 | };
31 |
32 | module.exports = onTabFocused;
33 |
--------------------------------------------------------------------------------
/src/partials/openShortcutEdit.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const config = require('../config');
21 | const browser = require('webextension-polyfill');
22 | const storeLog = require('./storeLog');
23 | const TwoFasNotification = require('../notification');
24 |
25 | const openShortcutEdit = function (e) {
26 | e.preventDefault();
27 | e.stopPropagation();
28 |
29 | const url = this?.dataset?.shortcutLink;
30 |
31 | if (!url) {
32 | return storeLog('error', 32, new Error('openShortcutEdit: no url'), 'openShortcutEdit')
33 | .then(() => TwoFasNotification.show(config.Texts.Error.UndefinedError, null, true))
34 | .catch(() => {});
35 | }
36 |
37 | const port = browser.runtime.connect({ name: '2FAS' });
38 |
39 | port.postMessage({
40 | action: 'openBrowserPage',
41 | url
42 | });
43 |
44 | port.disconnect();
45 | };
46 |
47 | module.exports = openShortcutEdit;
48 |
--------------------------------------------------------------------------------
/src/partials/runTasksWithDelay.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const wait = require('./wait');
21 |
22 | const runTasksWithDelay = async (tasks, delayTime) => {
23 | for (const task of tasks) {
24 | await task();
25 | await wait(delayTime);
26 | }
27 | };
28 |
29 | module.exports = runTasksWithDelay;
30 |
--------------------------------------------------------------------------------
/src/partials/storageValidation.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const config = require('../config');
21 | const TwoFasNotification = require('../notification');
22 |
23 | const storageValidation = storage => {
24 | return new Promise((resolve, reject) => {
25 | if (
26 | !storage.keys ||
27 | !storage?.keys?.publicKey ||
28 | !storage?.keys?.privateKey ||
29 | !storage?.extensionID
30 | ) {
31 | if (storage?.attempt && storage?.attempt > 5) {
32 | TwoFasNotification.show(config.Texts.Error.StorageIntegrity);
33 | return reject(new TypeError('Too many attempts'));
34 | }
35 |
36 | TwoFasNotification.show(config.Texts.Error.StorageCorrupted);
37 | return reject(new TypeError('Storage corrupted'));
38 | }
39 |
40 | // @TODO: Future reset attempts?
41 | return resolve();
42 | });
43 | };
44 |
45 | module.exports = storageValidation;
46 |
--------------------------------------------------------------------------------
/src/partials/uniqueOnly.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const uniqueOnly = (value, index, self) => {
21 | return self.indexOf(value) === index;
22 | }
23 |
24 | module.exports = uniqueOnly;
25 |
--------------------------------------------------------------------------------
/src/partials/wait.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const wait = async ms => {
21 | return new Promise(resolve => setTimeout(resolve, ms));
22 | };
23 |
24 | module.exports = wait;
25 |
--------------------------------------------------------------------------------
/src/views/pinInfoViews/chrome.html:
--------------------------------------------------------------------------------
1 |
21 |
22 |
23 |

24 |

25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/views/pinInfoViews/edge.html:
--------------------------------------------------------------------------------
1 |
21 |
22 |
23 |

24 |

25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/views/pinInfoViews/firefox.html:
--------------------------------------------------------------------------------
1 |
21 |
22 |
23 |

24 |

25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/webpack/development.config.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | console.log('\x1b[32m', `Webpack DEV Build [${process.env.EXT_PLATFORM}]`, '\x1b[0m');
21 |
22 | module.exports = [
23 | require('./development/background.dev.config'),
24 | require('./development/contentScript.dev.config'),
25 | require('./development/optionsPage.dev.config'),
26 | require('./development/installPage.dev.config')
27 | ];
28 |
--------------------------------------------------------------------------------
/webpack/production.config.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | console.log('\x1b[32m', `Webpack PROD Build [${process.env.EXT_PLATFORM}]`, '\x1b[0m');
21 |
22 | module.exports = [
23 | require('./production/background.prod.config'),
24 | require('./production/contentScript.prod.config'),
25 | require('./production/optionsPage.prod.config'),
26 | require('./production/installPage.prod.config')
27 | ];
28 |
--------------------------------------------------------------------------------
/webpack/utils/browserRegExps.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const BrowserRegExps = {
21 | chrome: /chrome\.html$/,
22 | firefox: /firefox\.html$/,
23 | opera: /opera\.html$/,
24 | safari: /safari\.html$/,
25 | edge: /edge\.html$/
26 | };
27 |
28 | module.exports = BrowserRegExps;
29 |
--------------------------------------------------------------------------------
/webpack/utils/checkBuildDirectoryExists.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const fs = require('node:fs');
21 |
22 | if (!fs.existsSync('./build/')) {
23 | fs.mkdirSync('./build');
24 | }
25 |
--------------------------------------------------------------------------------
/webpack/utils/dotenvConfig.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | const path = require('path');
21 | const Dotenv = require('dotenv-webpack');
22 |
23 | const DotenvConfig = new Dotenv({
24 | path: path.join(__dirname, '../../.env'),
25 | safe: true,
26 | expand: true,
27 | allowEmptyValues: false,
28 | systemvars: true
29 | });
30 |
31 | module.exports = DotenvConfig;
32 |
--------------------------------------------------------------------------------
/webpack/utils/export/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twofas/2fas-browser-extension/a09fb07abdc35a3f689fcabcb888d98c3fa9556b/webpack/utils/export/.gitkeep
--------------------------------------------------------------------------------
/webpack/utils/global.js:
--------------------------------------------------------------------------------
1 | //
2 | // This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension)
3 | // Copyright © 2023 Two Factor Authentication Service, Inc.
4 | // Contributed by Grzegorz Zając. All rights reserved.
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | //
19 |
20 | module.exports = window
21 |
--------------------------------------------------------------------------------