Important
Zap is a extension that currently uses TLSN (see documentation to attest web2 data. TLS requests from Prover to Server can be witnessed by the Notary, and then can be transformed in signed proofs, which can be sent to webpages and used as attestations.
Zap has two types of proofs and exploration market to use them:
- Dynamic proofs: Generated by the SidePanel, these can be called by API from other webpages and attest specific data (like a google account ownership or a revolut transaction data)
- Static proofs: Auto generated by the Popup extension, these can be created by manual option in the extension and stored to use then, earning Zap points (like social account ownership)
- Exploration market: Solutions provided by Zap team which request data proofs generated by our extension.
The folder structure of Zap:
extension/
├── src/
│ ├── assets/
│ ├── components/
│ ├── entries/
│ │ ├── Background/ # The extension itself, page routes are located here
│ │ │ ├── cache.ts # Responsible for separate requests by tab
│ │ │ ├── db.ts # Index storage responsible to store larger data like the requests and history
│ │ │ ├── handlers.ts # Aggregate the cache in a defined structure to add requests log in the database
│ │ │ ├── index.ts # Calls the rpc and other listeners
│ │ │ ├── mutex.tsx
│ │ │ └── rpc.tsx # Most important file: RPC with all actions that can be executed in the background
│ │ ├── Content/ # Content is used when webpages interact with our extension
│ │ │ ├── content.ts # Separated bundle responsible for the ZAP Class Provider API
│ │ │ ├── index.tsx # RPC Server that sends the actions to the Background execute
│ │ │ └── rpc.tsx # RPC Client and types defined here
│ │ ├── Popup/ # The extension itself, page routes are located here
│ │ └── SidePanel/ # Responsible for dynamic proofs
│ ├── pages/
│ ├── reducers/ # [React Redux](https://react-redux.js.org/)
│ │ ├── authSlice.tsx # Manage Auth state of extension
│ │ ├── history.tsx # Manage history (proofs) states and actions
│ │ ├── index.tsx
│ │ └── requests.tsx # Manage requests (TLS) states and actions
│ ├── utils/
│ │ ├── constants.tsx # Notary proxy and API defined here
│ │ └── storage.tsx # Local storage, getters and setters defined here with keys to access data
│ ├── firebaseConfig.ts # Firebase config for google authentication
│ └── manifest.json # Manifest version 3
├── utils/
│ ├── env.js
│ └── build.js # Set development or production state
├── .gitignore
├── package.json
└── README.md
- Starting Zap class provider:
const client = await zap.connect();
- Calling dynanmic proving:
const response = await (client as any).runDynamicProof("spotify");
See content script for detailed API functions.
There are 3 code components:
- Local Extension: Responsible for the client
- Local Notary Server: Responsible for the local notarization with less latency
- Local Websocket: Responsible for the proxy between server and client
- Check if your Node.js version is >= 18.
- Clone this repository.
- Run
npm install
to install the dependencies. - Run
npm start
, it will generate abuild
folder. - Load your extension on Chrome following:
- Access
chrome://extensions/
- Check
Developer mode
- Click on
Load unpacked extension
- Select the
build
folder.
- Access
- Now use Zap.
- Fork this repository: Notary Server
- Run
git checkout v0.1.0-alpha.5
to adjust the server version (⚠️ Important!!) - Disable tls in the
config/config.yaml
file (writefalse
insteadtrue
- line 18) - Run
cargo run --release
in the root folder - See the logs.
- Fork this repository: Local Proxy
- Run
./docker/build.sh
to build image using Docker - Choose a host to perform a proxy:
- Example: Notarize
api.x.com
- Certify if the host is present on the whitelist domains of TLSN
- Run
docker run -it --rm -p 55688:80 novnc/websockify 80 api.x.com:443
- Example: Notarize
- Use it
There are 2 code components:
- Local Extension: Responsible for the client
- Local Zap Websocket: Responsible for handling the request with the server
- Check if your Node.js version is >= 18.
- Clone this repository.
- Run
npm install
to install the dependencies. - Run
npm start
, it will generate abuild
folder. - Load your extension on Chrome following:
- Access
chrome://extensions/
- Check
Developer mode
- Click on
Load unpacked extension
- Select the
build
folder.
- Access
- Now use Zap.
Important
- Fork or clone this repository: Local Websocket
- Go in the javascript implementation in
./js/proxy
. - Run
node proxy.js
. - Now use Zap.
PS.: Current implementation is not using ZK and it's not secure
After the development, run the command
$ NODE_ENV=production npm run build
Now, the content of build
folder will be the extension ready to be submitted to the Chrome Web Store.
Just take a look at the official guide to more infos about publishing.