diff --git a/.justfile b/.justfile index 2977069..2411789 100644 --- a/.justfile +++ b/.justfile @@ -18,8 +18,11 @@ serve-extension: upgrade-version: docker compose up upgrade-version -get-field FIELD: - op item get "Firefox Extension Signing Credentials" --fields {{FIELD}} +get-field FIELD *args='': + op item get "Firefox Extension Signing Credentials" --fields {{FIELD}} {{args}} sign-extension: - cd extension/dist && web-ext sign --api-key=$(just get-field username) --api-secret=$(just get-field credential) \ No newline at end of file + #!/bin/bash + API_KEY=$(just get-field username) + API_SECRET=$(just get-field credential --reveal) + docker compose run --rm -e API_KEY="$API_KEY" -e API_SECRET="$API_SECRET" web-ext \ No newline at end of file diff --git a/Dockerfile.utils b/Dockerfile.utils new file mode 100644 index 0000000..bbbb7fb --- /dev/null +++ b/Dockerfile.utils @@ -0,0 +1,14 @@ +# Use a lightweight Node.js image as the base +FROM node:18-alpine + +# Set the working directory +WORKDIR /app + +# Use a volume for the built extension +VOLUME /app + +# Install Mozilla's web-ext tool +RUN npm install -g web-ext@8.7.1 + +# Default command to serve the extension +CMD ["sh", "-c", "yarn run serve"] diff --git a/README.md b/README.md index b49068f..3937306 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ To build the extension locally you need to have the following tools installed: * [Docker](https://www.docker.com/) * [Just](https://github.com/casey/just) +* [1Password CLI](https://developer.1password.com/docs/cli/) ### Building the extension @@ -59,6 +60,22 @@ If you want to sign the operation, you simply need to select a wallet from your add the resulting PSBT to the correspondent text area in your browser. If you are using the Signer with NodeGuard, then it will automatically complete the sign operation as well. +## 🔏 Signing the Extension +To sign the extension for Google Chrome, go to the [Dev Console](https://chrome.google.com/webstore/devconsole) and upload it to the chrome web store. + +To sign the extension for Firefox, follow these steps: + +1. Ensure you have the necessary API credentials stored in 1Password for signing the extension. These credentials should be stored securely under the item named "Firefox Extension Signing Credentials". + - **Fields:** + - `username`: Your API username. + - `credential`: Your API secret key. +2. Use the `sign-extension` recipe in the `justfile` to sign the extension: + ```sh + just sign-extension + ``` + This will retrieve credentials and sign the extension. +4. Verify that the extension has been signed successfully by checking the output logs or the signed artifacts. + # 🤝 Contributing diff --git a/docker-compose.yml b/docker-compose.yml index 9e5a853..c3f85ab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - services: build-ext: image: nodeguards-companion-build @@ -15,7 +13,7 @@ services: context: . dockerfile: Dockerfile.serve depends_on: - build: + build-ext: condition: service_completed_successfully volumes: - ./extension:/app @@ -26,10 +24,34 @@ services: image: nodeguards-companion-upgrade build: context: . - dockerfile: Dockerfile.serve + dockerfile: Dockerfile.utils depends_on: - build: + build-ext: condition: service_completed_successfully volumes: - ./extension:/app - command: ["node", "scripts/upgradeVersion.js", "patch"] \ No newline at end of file + command: ["node", "scripts/upgradeVersion.js", "patch"] + + web-ext: + image: nodeguards-companion-web-ext + build: + context: . + dockerfile: Dockerfile.utils + depends_on: + build-ext: + condition: service_completed_successfully + upgrade-version: + condition: service_completed_successfully + volumes: + - ./extension:/app + command: > + sh -c 'web-ext sign \ + --verbose \ + --api-key="$$API_KEY" \ + --api-secret="$$API_SECRET" \ + --channel unlisted \ + --source-dir /app/dist \ + --artifacts-dir /app/signed' + + environment: + - NODE_ENV=production \ No newline at end of file diff --git a/extension/Cargo.toml b/extension/Cargo.toml index 978b722..30aea2b 100644 --- a/extension/Cargo.toml +++ b/extension/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "extension" -version = "0.2.8" +version = "0.2.9" authors = [ "The elenpay Developers" ] description = "A chrome extension/firefox add on for importing keys and signing PSBTs" edition = "2021" diff --git a/extension/static/manifest.json b/extension/static/manifest.json index c6f076f..b4cc1c7 100644 --- a/extension/static/manifest.json +++ b/extension/static/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "NodeGuard Companion", "description": "Import or generate your Bitcoin mnemonics, export your xpubs and sign your PSBTs. Your private keys never leave your browser.", - "version": "0.2.8", + "version": "0.2.9", "action": { "default_popup": "popup.html" }, diff --git a/extension/versions/manifest_v2.json b/extension/versions/manifest_v2.json index 460686a..5de8909 100644 --- a/extension/versions/manifest_v2.json +++ b/extension/versions/manifest_v2.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "NodeGuard Companion", "description": "Import or generate your Bitcoin mnemonics, export your xpubs and sign your PSBTs. Your private keys never leave your browser.", - "version": "0.2.8", + "version": "0.2.9", "browser_action": { "default_popup": "popup.html" },