You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/zk-passport/guide-proof-of-citizenship.mdx
+55-46Lines changed: 55 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,8 @@ Basically, it goes likes this:
19
19
4. The app submits the proof to the callback URL(specified in the QR code) for verification
20
20
5. DApp backend fetches the verification status and citizenship data from a REST API
21
21
22
+
QR code generation and all the interactions with the backend are facilitated by Rarimo's ZK Passport library, which is available as an NPM package: `@rarimo/zk-passport`. The library provides a convenient API for generating QR codes and verifying the proof status.
23
+
22
24
You can check out this flow in the sandbox: <OutLinkhref="https://app.rarime.com/proof-requests-demo">ZK Passport Demo</OutLink>
23
25
24
26
## Pre-requisites
@@ -40,65 +42,68 @@ Links for installation:
40
42
- <OutLinkhref="https://apps.apple.com/us/app/rarime/id6503300598">RariMe for iOS | AppStore</OutLink>
41
43
- <OutLinkhref="https://play.google.com/store/apps/details?id=com.rarilabs.rarime">RariMe for Android | Google Play</OutLink>
42
44
43
-
## Step #2: Render a QR code with a verification request in your app
To install the package, run the following command in your project directory:
47
48
48
-
The following JS snippet gets data for a QR code for a passport verification with a uniqueness check on:
49
+
```bash npm2yarn
50
+
npm install @rarimo/zk-passport-react
51
+
```
49
52
50
-
```jsx
51
-
constverificatorUrl='https://api.app.rarime.com/'// your verificator-svc instance URL
52
-
constbody= {
53
-
data: {
54
-
type:"user",
55
-
// Some public and unique user ID
56
-
// Will be used to fetch status later
57
-
id:"some-user-id",
58
-
attributes: {
59
-
// Denotes the application and activity that is requesting the verification
60
-
event_id:"citizenship_verification",
61
-
// Let a single passport pass verification just once
62
-
uniqueness:true
63
-
}
64
-
}
65
-
}
53
+
If you don't use React, you can use the `@rarimo/zk-passport` package instead. It provides a low-level API for for requesting and passing for verification of ZK Passport proofs.
// ISO 3166 alpha-3 country code: https://www.iban.com/country-codes
126
131
// Note: German passports may have a single-letter "D" code
127
132
const citizenshipISOCode =data.attributes.nationality// e.g. "UKR"
128
133
```
134
+
135
+
## Conclusion
136
+
137
+
In this guide, we set up off-chain citizenship verification using ZK Passport and the RariMe App, enabling secure proof of citizenship without exposing private user data.
0 commit comments