@zk-email/sdk 0.0.89 → 0.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,63 +1,70 @@
1
- # zk-email-sdk-js
1
+ # ZKEmail SDK
2
2
 
3
- With the ZK Email SDK you can easily compile zk regex circuits and directly create proofs with them.
3
+ With the ZKEmail SDK you can create proofs about emails using blueprints. You can create blueprints with this
4
+ SDK (documentation pending), or using our [registry](registry.zk.email).
4
5
 
5
- For demos on how to use this repo, refer to our demo [https://github.com/zkemail/sdk-ts-demo](demo).
6
+ ## Install
6
7
 
7
- ## Test a decomposed regex locally
8
+ The SDK works for all JavaScript environments. You can find
9
+ examples for server-side (Node, Deno, Bun) and client-side (Vite, Next.js) usage [here](https://github.com/zkemail/sdk-ts-demo).
8
10
 
9
- Install Bun:
11
+ To install run:
10
12
 
11
- `curl -fsSL https://bun.sh/install | bash`
13
+ ```bash
14
+ npm i @zk-email/sdk
15
+ ```
12
16
 
13
- Install dependencies:
17
+ ## Create a blueprint
14
18
 
15
- `bun i`
19
+ Go to our [registry](registry.zk.email) and create a blueprint there. You can also create one with the SDK,
20
+ we will provide the documentation for this shortly.
16
21
 
17
- ## Note
22
+ ## Generate a proof
18
23
 
19
- This first version of this SDK does not support compiling the circuits and running the proofs without our infra,
20
- but it is our priority to make this work with your own ifra easily, too.
24
+ Initialize the SDK:
21
25
 
22
- ## Setup
26
+ ```ts
27
+ import zkeSdk from "@zk-email/sdk";
28
+ const sdk = zkSdk();
29
+ ```
23
30
 
24
- This project uses bun. So to install packages use `bun i`.
31
+ Next, obtain the slug of the blueprint you want to create a proof for from our [registry](registry.zk.email).
25
32
 
26
- ## Run integration tests
33
+ ![Copy Slug](./assets/copy_slug.png)
27
34
 
28
- Before you can run the tests, you must have the conductor running.
35
+ Use the slug to get the blueprint:
29
36
 
30
- NOTE: Not all tests are currently working, due to changes to the interfaces and the backend.
37
+ ```ts
38
+ const blueprint = await sdk.getBlueprint("Bisht13/SuccinctZKResidencyInvite@v2");
39
+ ```
31
40
 
32
- Then you can run `bun test`.
41
+ Create a prover. Here you can define whether the proof should be generated remotely (faster)
42
+ or in the browser (slower but private).
43
+ Set `isLocal` to `true` for proving in the browser.
33
44
 
34
- ### Directly start downloads
45
+ ```ts
46
+ const prover = blueprint.createProver({ isLocal: true });
47
+ ```
35
48
 
36
- To run the `start download` test, you first have to compile the TypeScript files to js with `bun run build`.
49
+ Now pass the email as a `string` to the prover to generate a proof.
37
50
 
38
- If you have python installed run `python -m http.server 8000`. Then you can go to
39
- `http://localhost:8000/integration_tests/start_downlaod_in_browser.html` and click the download button.
51
+ If your blueprint requires external inputs, pass them as a second argument.
40
52
 
41
- ## Updating localProverWorker.js
53
+ You can check out our [Next.js example](https://github.com/zkemail/sdk-ts-demo/tree/main/nextjs) to see how
54
+ a user can locally upload an email file.
42
55
 
43
- For local proving, we use a javascript WebWorker. In order to make this compatible with any bundler, we first build the worker file using vite.
44
- This will inline all dependencies and remove import statements. The next step is to generate a string from this file. Now we can
45
- use the worker in a native js way by passing a string to the worker.
56
+ ```ts
57
+ // 2. argument, externalInputs is only required if defined in the blueprint
58
+ const proof = await prover.generateProof(emailStr, [
59
+ { name: "email", value: "a@b.de", maxLength: 50 },
60
+ ]);
46
61
 
47
- To generate the `localProverWorkerString.ts` file which is passed into the worker, run:
62
+ console.log("Proof data: ", proof.props.proofData);
63
+ console.log("Public data: ", proof.props.publicData);
64
+ ```
48
65
 
49
- `bun run build-prove-worker`.
66
+ You can also verify the proof on chain. We currently use a contract deployed to Base Sepolia for this.
50
67
 
51
- ## Publish to npm
52
-
53
- ### Publish nightly for testing
54
-
55
- Bump the version in `package.json`, use a trailing version number, starting with `-1`, e.g. `0.0.86-6`.
56
-
57
- Run `bun run publish-nightly`.
58
-
59
- ### Publish new production version
60
-
61
- Bump the version in `package.json`, using this format: `0.0.86`.
62
-
63
- Run `bun run publish`.
68
+ ```ts
69
+ const isVerified = await blueprint.verifyProofOnChain(proof);
70
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zk-email/sdk",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "description": "ZK Email SDK for TypeScript",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/zk-email-sdk.es.js",
@@ -24,7 +24,7 @@
24
24
  "publish": "bun run build && npm publish --access public",
25
25
  "typecheck": "tsc --noEmit",
26
26
  "test": "echo \"Error: no test specified\" && exit 1",
27
- "prepublishOnly": "bun run build && cp NPM-README.md dist/README.md && cp -r assets dist/",
27
+ "prepublishOnly": "bun run build",
28
28
  "clean": "rm -rf dist",
29
29
  "publish-nightly": "bun run build && npm publish --access public --tag nightly"
30
30
  },
package/NPM-README.md DELETED
@@ -1,70 +0,0 @@
1
- # ZKEmail SDK
2
-
3
- With the ZKEmail SDK you can create proofs about emails using blueprints. You can create blueprints with this
4
- SDK (documentation pending), or using our [registry](registry.zk.email).
5
-
6
- ## Install
7
-
8
- The SDK works for all JavaScript environments. You can find
9
- examples for server-side (Node, Deno, Bun) and client-side (Vite, Next.js) usage [here](https://github.com/zkemail/sdk-ts-demo).
10
-
11
- To install run:
12
-
13
- ```bash
14
- npm i @zk-email/sdk
15
- ```
16
-
17
- ## Create a blueprint
18
-
19
- Go to our [registry](registry.zk.email) and create a blueprint there. You can also create one with the SDK,
20
- we will provide the documentation for this shortly.
21
-
22
- ## Generate a proof
23
-
24
- Initialize the SDK:
25
-
26
- ```ts
27
- import zkeSdk from "@zk-email/sdk";
28
- const sdk = zkSdk();
29
- ```
30
-
31
- Next, obtain the slug of the blueprint you want to create a proof for from our [registry](registry.zk.email).
32
-
33
- ![Copy Slug](./assets/copy_slug.png)
34
-
35
- Use the slug to get the blueprint:
36
-
37
- ```ts
38
- const blueprint = await sdk.getBlueprint("Bisht13/SuccinctZKResidencyInvite@v2");
39
- ```
40
-
41
- Create a prover. Here you can define whether the proof should be generated remotely (faster)
42
- or in the browser (slower but private).
43
- Set `isLocal` to `true` for proving in the browser.
44
-
45
- ```ts
46
- const prover = blueprint.createProver({ isLocal: true });
47
- ```
48
-
49
- Now pass the email as a `string` to the prover to generate a proof.
50
-
51
- If your blueprint requires external inputs, pass them as a second argument.
52
-
53
- You can check out our [Next.js example](https://github.com/zkemail/sdk-ts-demo/tree/main/nextjs) to see how
54
- a user can locally upload an email file.
55
-
56
- ```ts
57
- // 2. argument, externalInputs is only required if defined in the blueprint
58
- const proof = await prover.generateProof(emailStr, [
59
- { name: "email", value: "a@b.de", maxLength: 50 },
60
- ]);
61
-
62
- console.log("Proof data: ", proof.props.proofData);
63
- console.log("Public data: ", proof.props.publicData);
64
- ```
65
-
66
- You can also verify the proof on chain. We currently use a contract deployed to Base Sepolia for this.
67
-
68
- ```ts
69
- const isVerified = await blueprint.verifyProofOnChain(proof);
70
- ```
package/dist/README.md DELETED
@@ -1,70 +0,0 @@
1
- # ZKEmail SDK
2
-
3
- With the ZKEmail SDK you can create proofs about emails using blueprints. You can create blueprints with this
4
- SDK (documentation pending), or using our [registry](registry.zk.email).
5
-
6
- ## Install
7
-
8
- The SDK works for all JavaScript environments. You can find
9
- examples for server-side (Node, Deno, Bun) and client-side (Vite, Next.js) usage [here](https://github.com/zkemail/sdk-ts-demo).
10
-
11
- To install run:
12
-
13
- ```bash
14
- npm i @zk-email/sdk
15
- ```
16
-
17
- ## Create a blueprint
18
-
19
- Go to our [registry](registry.zk.email) and create a blueprint there. You can also create one with the SDK,
20
- we will provide the documentation for this shortly.
21
-
22
- ## Generate a proof
23
-
24
- Initialize the SDK:
25
-
26
- ```ts
27
- import zkeSdk from "@zk-email/sdk";
28
- const sdk = zkSdk();
29
- ```
30
-
31
- Next, obtain the slug of the blueprint you want to create a proof for from our [registry](registry.zk.email).
32
-
33
- ![Copy Slug](./assets/copy_slug.png)
34
-
35
- Use the slug to get the blueprint:
36
-
37
- ```ts
38
- const blueprint = await sdk.getBlueprint("Bisht13/SuccinctZKResidencyInvite@v2");
39
- ```
40
-
41
- Create a prover. Here you can define whether the proof should be generated remotely (faster)
42
- or in the browser (slower but private).
43
- Set `isLocal` to `true` for proving in the browser.
44
-
45
- ```ts
46
- const prover = blueprint.createProver({ isLocal: true });
47
- ```
48
-
49
- Now pass the email as a `string` to the prover to generate a proof.
50
-
51
- If your blueprint requires external inputs, pass them as a second argument.
52
-
53
- You can check out our [Next.js example](https://github.com/zkemail/sdk-ts-demo/tree/main/nextjs) to see how
54
- a user can locally upload an email file.
55
-
56
- ```ts
57
- // 2. argument, externalInputs is only required if defined in the blueprint
58
- const proof = await prover.generateProof(emailStr, [
59
- { name: "email", value: "a@b.de", maxLength: 50 },
60
- ]);
61
-
62
- console.log("Proof data: ", proof.props.proofData);
63
- console.log("Public data: ", proof.props.publicData);
64
- ```
65
-
66
- You can also verify the proof on chain. We currently use a contract deployed to Base Sepolia for this.
67
-
68
- ```ts
69
- const isVerified = await blueprint.verifyProofOnChain(proof);
70
- ```
Binary file