Service worker which transforms browser asset request to the IC to canister calls and verifies the asset certification.
Usage | Folder | Command | Note |
---|---|---|---|
dev build for testnets | dist-dev | npm run build-dev |
- sets FORCE_FETCH_ROOT_KEY=1 - not minified |
prod build for mainnet | dist-prod | npm run build |
- uses IC root key - minified |
- Node.js 17
- npm 8.5
By setting the FORCE_FETCH_ROOT_KEY=1
environment variable prior to building, the service worker will
always fetch the root key of the network before doing the validation.
THIS SHOULD ONLY BE USED ON A TEST OR LOCAL NETWORK. The IC mainnet public key is hard coded in the agent and, for security reasons, should not be fetched by the agent.
To start the local development instance:
- Run
npm install
- Run
npm start
This will start serving the files built using npm run build-dev
on http://localhost:8080. Any path that don't match a file instead will be sent to https://ic0.app.
Note that for the service worker to correctly relay the canister call to a canister there must be a query parameter canisterId=<canisterId>
.
The service worker can be tested against any mainnet canister.
For example:
- Internet Identity: http://localhost:8080/?canisterId=rdmx6-jaaaa-aaaaa-aaadq-cai
- DSCVR: http://localhost:8080/?canisterId=h5aet-waaaa-aaaab-qaamq-cai
- Create MR that updates
version
inpackage.json
- Test the built artifact using testnet boundary node VMs
- Merge MR to master
- Tag the commit on
master
withservice-worker_v${version}
- Verify that the desired version has been pushed to NPM: https://www.npmjs.com/package/@dfinity/service-worker
- Create an MR for the boundary nodes team that updates the
sw_version
andsw_sha256
inic-os/boundary-guestos/rootfs/Dockerfile