This project showcases how to use the @dfinity/response-verification
package to perform response verification within a service worker. Also see the Dfinity service worker for a full working example.
When bundling a service worker with Webpack, the target needs to be set to webworker
. Otherwise Webpack will transform the import.meta.url
line from wasm-bindgen
into document.location.href
, which will break in a service worker context.
From the root of this repository, install NPM dependencies:
pnpm i
Build the @dfinity/response-verification
package:
pnpm run --filter @dfinity/response-verification build
Run:
pnpm run --filter service-worker-example start
Bundle application:
pnpm run --filter service-worker-example build
Run:
pnpm run --filter service-worker-example start:http