Skip to content

Commit

Permalink
Merge branch 'main' into chore/update-docs-link
Browse files Browse the repository at this point in the history
  • Loading branch information
cykoder authored Sep 27, 2024
2 parents 0443d19 + 166bbdb commit 1762588
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion pages/openid.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ function OID4VPProofRequest({ title, desc, proofRequestSetupObject }) {
export default function Home() {
const [ebsiURLS, setEBSIUrls] = useState();
const [credentialOffer, setCredentialOffer] = useState();
const [credentialOfferNoAuth, setCredentialOfferNoAuth] = useState();

async function createCredentialOffer() {
const { data: credentialOffer } = await postRequestLocal('create-credential-offer', {
Expand All @@ -253,6 +254,20 @@ export default function Home() {
setCredentialOffer(credentialOffer);
}

async function createCredentialOfferNoAuth() {
const { data: credentialOffer } = await postRequestLocal('create-credential-offer', {
credentialOptions: {
credential: {
...credential,
issuer: process.env.NEXT_PUBLIC_QUOTIENT_ISSUER_ID,
},
},
singleUse: true,
});

setCredentialOfferNoAuth(credentialOffer);
}

async function generateEBSIUrls() {
const { data: proofRequest } = await postRequestLocal('create-proof-request-object', {
did: process.env.NEXT_PUBLIC_QUOTIENT_ISSUER_ID,
Expand All @@ -265,8 +280,9 @@ export default function Home() {
}

useEffect(() => {
if (!credentialOffer) {
if (!credentialOffer && !credentialOfferNoAuth) {
createCredentialOffer();
createCredentialOfferNoAuth();
}
}, []);

Expand Down Expand Up @@ -306,6 +322,28 @@ export default function Home() {
</div>
</div>

<div>
<div className="orgCard">
<div className="cardImg valign-middle m-auto">
<p className="font-bold mb-5">OID4VCI (no auth)</p>
<div>
{credentialOfferNoAuth ? (
<QRCodeGenerator url={credentialOfferNoAuth.url} />
) : (
<>Loading...</>
)}
</div>
</div>
<hr />
<div className="pt-5 min-h-28">
<p className="text-sm">
Scan this QR code to initiate an OID4VCI import flow and instantly get a
credential.
</p>
</div>
</div>
</div>

<OID4VPProofRequest
proofRequestSetupObject={dockProofRequest}
title="OID4VP"
Expand Down

0 comments on commit 1762588

Please sign in to comment.