Skip to content

Latest commit

 

History

History
 
 

pass-extension

Extension resources

How to run the extension

Please note that all commands should be run from this directory, i.e. applications/pass-extension

On Mac, please first install mkcert with brew install mkcert (brew can be installed on https://brew.sh/) then:

yarn install
yarn install:devtools

For Chromium

Run

# `yarn start` targets the internal environment by default.
yarn start:prod

After that, the build is available in dist/ directory that you can install in Chromium by going to extension page, enable the developer mode, click on "Load Unpacked" and choose the dist/ directory here.

For Firefox

If you want to run the extension on Firefox, you can do:

BUILD_TARGET=firefox yarn start:prod
To run an extension on Firefox

1. Open firefox and navigate to `about:debugging` 2. Click on "_This Firefox_" 3. Click on "_Load Temporary Add-On_" and chose the `dist/manifest.json` 4. Right click on the extension icon in the toolbar and select "_Manage extension_" 5. Go to the permission tab and enable all necessary permissions 1 6. Go back to `about:debugging` and click on "_Reload_" 2 7. You may sign in and start using Pass

1 Firefox does not prompt for permissions when launching a temporary add-on
2 FF might not pick-up the permission changes needed for content-script communication

How to run the extension against localhost BE

As a prerequisite you need to have the backend running locally.

Build the extension with the proper config

  • Edit applications/pass-extension/src/app/config.ts and set export const API_URL = 'https://localhost:9090/api';
  • Edit applications/pass-extension/public/manifest.json and set externally_connectable to
        "matches": ["https://*.proton.local/*", "https://*.proton.black/*", "https://*.proton.pink/*", "https://localhost/*", "http://localhost/*", "https://localhost:9090/*"]
  • Now the extension can be built by going to applications/pass-extension and running yarn run start

Running the web account client locally

We need to run web account pointing to our local backend installation. From the root of this repository run:

yarn workspace proton-account start --api=https://localhost --port 8081

This will run the web account listening at port 8081 but chrome requires the extension to connect to sites with TLS enabled and the dev server for the web account doesn't support TLS. So we need to run something in front of it that will take care of the TLS termination and proxy the requests to the local web account. We can do that with Caddy webserver in proxy mode. To do so, create a file called Caddyfile with the following contents:

{
	http_port 9080
}

https://localhost:9090 {
		reverse_proxy http://localhost:8081
		header Access-Control-Allow-Origin *
		header -Server
}

and run caddy from the directory where the file is. Caddy should generate automatically a cert and export https via port 9090. Requests sent there will be forwarded to the web account client.

Now you should be able to use the extension with your local backend installation.