@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 +47 -40
- package/package.json +2 -2
- package/NPM-README.md +0 -70
- package/dist/README.md +0 -70
- package/dist/assets/copy_slug.png +0 -0
package/README.md
CHANGED
@@ -1,63 +1,70 @@
|
|
1
|
-
#
|
1
|
+
# ZKEmail SDK
|
2
2
|
|
3
|
-
With the
|
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
|
-
|
6
|
+
## Install
|
6
7
|
|
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).
|
8
10
|
|
9
|
-
|
11
|
+
To install run:
|
10
12
|
|
11
|
-
|
13
|
+
```bash
|
14
|
+
npm i @zk-email/sdk
|
15
|
+
```
|
12
16
|
|
13
|
-
|
17
|
+
## Create a blueprint
|
14
18
|
|
15
|
-
|
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
|
-
##
|
22
|
+
## Generate a proof
|
18
23
|
|
19
|
-
|
20
|
-
but it is our priority to make this work with your own ifra easily, too.
|
24
|
+
Initialize the SDK:
|
21
25
|
|
22
|
-
|
26
|
+
```ts
|
27
|
+
import zkeSdk from "@zk-email/sdk";
|
28
|
+
const sdk = zkSdk();
|
29
|
+
```
|
23
30
|
|
24
|
-
|
31
|
+
Next, obtain the slug of the blueprint you want to create a proof for from our [registry](registry.zk.email).
|
25
32
|
|
26
|
-
|
33
|
+

|
27
34
|
|
28
|
-
|
35
|
+
Use the slug to get the blueprint:
|
29
36
|
|
30
|
-
|
37
|
+
```ts
|
38
|
+
const blueprint = await sdk.getBlueprint("Bisht13/SuccinctZKResidencyInvite@v2");
|
39
|
+
```
|
31
40
|
|
32
|
-
|
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
|
-
|
45
|
+
```ts
|
46
|
+
const prover = blueprint.createProver({ isLocal: true });
|
47
|
+
```
|
35
48
|
|
36
|
-
|
49
|
+
Now pass the email as a `string` to the prover to generate a proof.
|
37
50
|
|
38
|
-
If
|
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
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
62
|
+
console.log("Proof data: ", proof.props.proofData);
|
63
|
+
console.log("Public data: ", proof.props.publicData);
|
64
|
+
```
|
48
65
|
|
49
|
-
|
66
|
+
You can also verify the proof on chain. We currently use a contract deployed to Base Sepolia for this.
|
50
67
|
|
51
|
-
|
52
|
-
|
53
|
-
|
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.
|
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
|
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
|
-

|
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
|
-

|
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
|