Skip to content

Commit 61b4f46

Browse files
committed
chore(docs): sample data
1 parent 44bedb6 commit 61b4f46

File tree

2 files changed

+165
-8
lines changed

2 files changed

+165
-8
lines changed

apps/docs/src/components/sample-data.ts

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,70 @@ export const sampleCredential1 = {
4747
},
4848
};
4949

50+
export const sampleCredential2 = {
51+
version: "v0",
52+
witness: {
53+
type: "simple",
54+
issuer: {
55+
_type: "PublicKey",
56+
value: "B62qqRryvaLH99vsPx6kL8cuWFq2AZZsDjaQftab4hpGA5Du3Jju6kP",
57+
},
58+
issuerSignature: {
59+
_type: "Signature",
60+
value: {
61+
r: "18608032094363426526383612175861105396636219252290095846645842383039012234860",
62+
s: "16614231870158121751259974049410646935461628042855821394498854808344556066615",
63+
},
64+
},
65+
},
66+
credential: {
67+
owner: {
68+
_type: "PublicKey",
69+
value: "B62qqBvUfKppzx3omv5g9YSooRuqA3YVG5zq4j33tN2THA6tGc7JUij",
70+
},
71+
data: {
72+
age: { _type: "Field", value: "18" },
73+
name: {
74+
_type: "Bytes",
75+
value:
76+
"416c696365000000000000000000000000000000000000000000000000000000",
77+
},
78+
},
79+
},
80+
};
81+
82+
export const sampleCredential3 = {
83+
version: "v0",
84+
witness: {
85+
type: "simple",
86+
issuer: {
87+
_type: "PublicKey",
88+
value: "B62qipmSo9Bju1XPtHfH8ukLWSMgur6e2xiUcfzbqwKEMdzSfQNbfbS",
89+
},
90+
issuerSignature: {
91+
_type: "Signature",
92+
value: {
93+
r: "15369596967930537948249866433896467790855310091967164859503093172192059176638",
94+
s: "18498891580394813079080734274552796309574738769075217343428610783674309728163",
95+
},
96+
},
97+
},
98+
credential: {
99+
owner: {
100+
_type: "PublicKey",
101+
value: "B62qrVPwPbeogxQKzPcV5dTSTmNo39g1T2hAM19cJ5Dtwk1p4STmKAE",
102+
},
103+
data: {
104+
age: { _type: "Field", value: "18" },
105+
name: {
106+
_type: "Bytes",
107+
value:
108+
"416c696365000000000000000000000000000000000000000000000000000000",
109+
},
110+
},
111+
},
112+
};
113+
50114
export const samplePresentationRequest = {
51115
type: "zk-app",
52116
spec: {
@@ -151,3 +215,100 @@ export const samplePresentationRequest = {
151215
action: { _type: "Field", value: "123" },
152216
},
153217
};
218+
219+
export const samplePresentationRequest1 = {
220+
type: "https",
221+
spec: {
222+
inputs: {
223+
signedData: {
224+
type: "credential",
225+
credentialType: "simple",
226+
witness: {
227+
type: { type: "Constant", value: "simple" },
228+
issuer: { _type: "PublicKey" },
229+
issuerSignature: { _type: "Signature" },
230+
},
231+
data: { age: { _type: "Field" }, name: { _type: "Bytes", size: 32 } },
232+
},
233+
targetAge: { type: "claim", data: { _type: "Field" } },
234+
targetName: {
235+
type: "constant",
236+
data: { _type: "Bytes", size: 32 },
237+
value:
238+
"416c696365000000000000000000000000000000000000000000000000000000",
239+
},
240+
},
241+
logic: {
242+
assert: {
243+
type: "and",
244+
inputs: [
245+
{
246+
type: "equals",
247+
left: {
248+
type: "property",
249+
key: "age",
250+
inner: {
251+
type: "property",
252+
key: "data",
253+
inner: {
254+
type: "property",
255+
key: "signedData",
256+
inner: { type: "root" },
257+
},
258+
},
259+
},
260+
right: {
261+
type: "property",
262+
key: "targetAge",
263+
inner: { type: "root" },
264+
},
265+
},
266+
{
267+
type: "equals",
268+
left: {
269+
type: "property",
270+
key: "name",
271+
inner: {
272+
type: "property",
273+
key: "data",
274+
inner: {
275+
type: "property",
276+
key: "signedData",
277+
inner: { type: "root" },
278+
},
279+
},
280+
},
281+
right: {
282+
type: "property",
283+
key: "targetName",
284+
inner: { type: "root" },
285+
},
286+
},
287+
],
288+
},
289+
outputClaim: {
290+
type: "property",
291+
key: "age",
292+
inner: {
293+
type: "property",
294+
key: "data",
295+
inner: {
296+
type: "property",
297+
key: "signedData",
298+
inner: { type: "root" },
299+
},
300+
},
301+
},
302+
},
303+
},
304+
claims: { targetAge: { _type: "Field", value: "18" } },
305+
inputContext: {
306+
type: "https",
307+
serverNonce: {
308+
_type: "Field",
309+
value:
310+
"4343919140832211358170758874350867217600871707216240107166052913905177631127",
311+
},
312+
action: "POST /api/verify",
313+
},
314+
};

apps/docs/src/components/test-zkapp.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ import { createStore } from "@mina-js/connect";
22
import { useLocalStorage, useObjectState } from "@uidotdev/usehooks";
33
import { clsx } from "clsx";
44
import { useState, useSyncExternalStore } from "react";
5-
import { sampleCredential, samplePresentationRequest } from "./sample-data";
5+
import { sampleCredential3, samplePresentationRequest1 } from "./sample-data";
66

77
const store = createStore();
88

99
const sampleSignFieldsWithPassphrase = {
10-
fields: [
11-
"15194438335254979123992673494772742932886141479807135737958843785282001151979",
12-
"13058445919007356413345300070030973942059862825965583483176167800381508277987",
13-
"26067489438851605530938171293652363087823200555042082718868551789908955769071",
14-
],
10+
fields: ["1", "2", "3"],
1511
passphrase: "1234",
1612
};
1713

@@ -25,10 +21,10 @@ export const TestZkApp = () => {
2521
const [signFieldsWithPassphraseInput, setSignFieldsWithPassphraseInput] =
2622
useState(JSON.stringify(sampleSignFieldsWithPassphrase, null, 2));
2723
const [credentialInput, setCredentialInput] = useState(
28-
JSON.stringify(sampleCredential, null, 2),
24+
JSON.stringify(sampleCredential3, null, 2),
2925
);
3026
const [presentationRequest, setPresentationRequest] = useState(
31-
JSON.stringify(samplePresentationRequest, null, 2),
27+
JSON.stringify(samplePresentationRequest1, null, 2),
3228
);
3329
const [transactionBody, setTransactionBody] = useObjectState({
3430
to: "B62qnVUL6A53E4ZaGd3qbTr6RCtEZYTu3kTijVrrquNpPo4d3MuJ3nb",

0 commit comments

Comments
 (0)