@zkpass/zkfetch-web
v1.0.2
Published
zkFetch using zkTLS is a system that enables verifiable fetching of HTTPS data using zero-knowledge proofs (ZKPs). It ensures that the response from a remote TLS server (like a Web2 API) is authentic, integrity-preserved, and can be publicly verified—with
Downloads
220
Maintainers
Readme
@zkpass/zkfetch-web
zkFetch using zkTLS is a system that enables verifiable fetching of HTTPS data using zero-knowledge proofs (ZKPs). It ensures that the response from a remote TLS server (like a Web2 API) is authentic, integrity-preserved, and can be publicly verified—without trusting the data fetcher or exposing sensitive content.
Register an develop account
Please register an account on the zkPass Dev Center and create a project. Then you can get appId for your zkFetch.
Installation
You can install the package either using NPM or using Yarn
Using NPM
npm install @zkpass/zkfetch-webUsing Yarn
yarn add @zkpass/zkfetch-webBrowser Environment Required
This package is designed to run exclusively in browser environments and cannot be used in Node.js or server-side applications.
Example
import zkFetchClient from '@zkpass/zkfetch'
const fetchData = async () =>{
try{
const appid = "8fb9d43c-2f24-424e-a98d-7ba34a5532f5" //Locate this form on the development platform
const client = new zkFetchClient(appid)
const response = await client.fetchData({
request: {
url: "https://backend.zkpass.org/users/level/airdrop?address=0xecd12972e428a8256c9805b708e007882568d7d6",
method: "GET",
headers: {
accept: "application/json, text/plain, */*",
"accept-encoding": "gzip, deflate, br, zstd",
"accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7",
"cache-control": "no-cache",
origin: "https://portal.zkpass.org",
pragma: "no-cache",
priority: "u=1, i",
referer: "https://portal.zkpass.org/",
"sec-ch-ua": '"Not)A;Brand";v="8", "Chromium";v="138", "Google Chrome";v="138"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"macOS"',
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent":
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
},
},
asserts: {
request: {
query: [
{
key: "address",
value: "0xecd12972e428a8256c9805b708e007882568d7d6",
operation: "=",
},
],
},
response: [
{
key: "reward",
isPublic: true,
},
],
},
})
console.log("Response:", response)
}catch(error){
console.log('transgate error', error)
}
}
