Update ws merged (#90)

Co-authored-by: thomas-senechal <thomas.senechal@pm.me>
This commit is contained in:
turnoffthiscomputer
2025-02-13 04:23:51 +01:00
committed by GitHub
parent 6d4c211c51
commit 54ffcb69e4
36 changed files with 907 additions and 2609 deletions

View File

@@ -1,26 +1,18 @@
'use client';
import OpenPassportQRcode from '../../../../../qrcode/OpenPassportQRcode';
import { OpenPassportQRcodeWrapper, SelfApp, SelfAppBuilder } from '../../../../../qrcode/OpenPassportQRcode';
import { v4 as uuidv4 } from 'uuid';
import { OpenPassportVerifier } from '@openpassport/core';
import { COMMITMENT_TREE_TRACKER_URL } from '../../../../../../common/src/constants/constants';
export default function Prove() {
const userId = uuidv4();
const scope = 'scope';
const openPassportVerifierDisclose = new OpenPassportVerifier('vc_and_disclose', scope)
.setCommitmentMerkleTreeUrl(COMMITMENT_TREE_TRACKER_URL)
.excludeCountries('Albania')
.setMinimumAge(20)
.enableOFACCheck();
const selfApp = new SelfAppBuilder('Mock App2', 'scope').minimumAge(18).setUserId(userId).build();
return (
<div className="h-screen w-full bg-white flex flex-col items-center justify-center gap-4">
<OpenPassportQRcode
appName="Mock App"
userId={userId}
userIdType={'uuid'}
openPassportVerifier={openPassportVerifierDisclose}
onSuccess={(attestation) => { }}
<OpenPassportQRcodeWrapper
selfApp={selfApp}
onSuccess={() => { }}
/>
</div>
);

View File

@@ -2,19 +2,13 @@
export default function Home() {
return (
<div className="h-screen w-full bg-gray-100 flex flex-row items-center justify-center gap-12">
<div
className="flex flex-col items-center justify-center p-8 bg-white rounded-lg shadow-lg cursor-pointer transition-transform hover:scale-105"
onClick={() => (window.location.href = '/register')}
onClick={() => (window.location.href = '/disclose')}
>
<h2 className="text-2xl text-black font-bold mb-4">Register</h2>
<p className="text-gray-600">2 steps registration flow</p>
</div>
<div
className="flex flex-col items-center justify-center p-8 bg-white rounded-lg shadow-lg cursor-pointer transition-transform hover:scale-105"
onClick={() => (window.location.href = '/prove')}
>
<h2 className="text-2xl text-black font-bold mb-4">Prove</h2>
<p className="text-gray-600">1 step verification flow</p>
<h2 className="text-2xl text-black font-bold mb-4">Disclose</h2>
<p className="text-gray-600">1 step disclosure flow</p>
</div>
</div>
);

View File

@@ -1,31 +0,0 @@
'use client';
import { OpenPassportQRcode } from '@openpassport/qrcode';
// import { OpenPassportQRcode } from '../../../../../qrcode/index';
import { OpenPassportVerifier } from '@openpassport/core';
import { v4 as uuidv4 } from 'uuid';
// import { OpenPassportVerifier, OpenPassportDynamicAttestation } from '@openpassport/core';
// import { OpenPassportVerifier, OpenPassportDynamicAttestation } from '@openpassport/core';
export default function Prove() {
const userId = uuidv4();
const scope = 'scope';
const openPassportVerifier: OpenPassportVerifier = new OpenPassportVerifier('prove_offchain', scope)
.enableOFACCheck()
.excludeCountries('Iran (Islamic Republic of)').setMinimumAge(55).allowMockPassports();
return (
<div className="h-screen w-full bg-white flex flex-col items-center justify-center gap-4">
<OpenPassportQRcode
appName="Mock App"
userId={userId}
userIdType={'uuid'}
openPassportVerifier={openPassportVerifier}
onSuccess={(attestation) => {
// send the code to the backend server
}}
/>
</div>
);
}

View File

@@ -1,38 +0,0 @@
'use client';
import { v4 as uuidv4 } from 'uuid';
import { COMMITMENT_TREE_TRACKER_URL } from '../../../../../../common/src/constants/constants';
import { OpenPassportVerifier } from '@openpassport/core';
import OpenPassportQRcode from '../../../../../qrcode/OpenPassportQRcode';
import axios from 'axios';
export default function Prove() {
const userId = uuidv4();
const scope = 'scope';
const openPassportVerifier = new OpenPassportVerifier('register', scope)
.setCommitmentMerkleTreeUrl(COMMITMENT_TREE_TRACKER_URL);
return (
<div className="h-screen w-full bg-white flex flex-col items-center justify-center gap-4">
<OpenPassportQRcode
appName="Mock App"
userId={userId}
userIdType={'uuid'}
openPassportVerifier={openPassportVerifier}
onSuccess={(attestation) => {
axios
.post('https://proofofpassport-merkle-tree.xyz/api/verifier/register', attestation)
.then((response) => {
console.log('Registration response:', response);
})
.catch((error) => {
console.error('Error registering attestation:', error);
});
}}
/>
</div>
);
}