To implement OpenPassport in your app, you need to implement it in both your front-end and back-end. The front-end will generate a QR code containing all the information relative to your app and what you are requesting users to disclose. The back-end will verify proofs and manage nullifiers.
🚧 Deeplinking is WIP. If you want to implement OpenPassport in a mobile application, please contact us.
If you want to debug your app with a mock passport generated inside the application, you have to call the method allowMockPassports();
Instantiate OpenPassportQRcode
OpenPassportQRcode is a React component that you can instantiate in your front-end:
Here are the different parameters of OpenPassportQRcode:
Parameter
Type
Description
appName
string
Name of your app, part that will be displayed in the mobile app.
userId
string
userID is passed as a parameter of the proof in order to prevent users from stealing proof between each other.
userIdType
'hex' | 'uuid' | 'string'
Type of userId.
openPassportVerifier
OpenPassportVerifier
Instance of OpenPassportVerifier.
onSuccess
function
Callback method fired after proof verification. This is the place where you want to send the proof to your backend for web2 apps or send tx to verifier contracts for dApps.
Verify the proof in your back-end (or smart-contracts)
Web2 apps
Install dependencies:
Instantiate OpenPassportVerifier
Note: you have to use the same scope as in your front-end.
Verify the proof:
Nullify the proof:
Once the proof and nullifier are verified, you can fire your custom functions: