From 5af7c3da29c0dca2b5f62b885640e4bc0afe32f9 Mon Sep 17 00:00:00 2001 From: Jesse van Muijden Date: Wed, 4 Jun 2025 06:01:29 -0400 Subject: [PATCH 1/2] feat(display): hardcoded display of AcademicEnrollmentCredential name and issuer --- src/components/Credentials/CredentialInfo.js | 4 +++- src/context/ContainerContext.tsx | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Credentials/CredentialInfo.js b/src/components/Credentials/CredentialInfo.js index df0361a2b..be69682b4 100644 --- a/src/components/Credentials/CredentialInfo.js +++ b/src/components/Credentials/CredentialInfo.js @@ -60,6 +60,7 @@ const CredentialInfo = ({ credential, mainClassName = "text-sm lg:text-base w-fu const { isOnline } = useContext(StatusContext); const [parsedCredential, setParsedCredential] = useState(null); const [credentialFormat, setCredentialFormat] = useState(''); + const [issuerName, setIssuerName] = useState(''); const [credentialSubjectRows, setCredentialSubjectRows] = useState([]); const container = useContext(ContainerContext); const { api } = useContext(SessionContext); @@ -84,6 +85,7 @@ const CredentialInfo = ({ credential, mainClassName = "text-sm lg:text-base w-fu } setParsedCredential(c.beautifiedForm); + setIssuerName(c.beautifiedForm.issuer?.name || ''); let iss = c.beautifiedForm.iss; @@ -212,7 +214,7 @@ const CredentialInfo = ({ credential, mainClassName = "text-sm lg:text-base w-fu {!credentialSubjectRows.some(row => row.name === 'institution') && renderRow('institution', 'Institution', parsedCredential?.vc?.credentialSubject?.institution, screenType)} {!credentialSubjectRows.some(row => row.name === 'valid_from') && renderRow('valid_from', 'Valid from', parsedCredential?.vc?.credentialSubject?.valid_from, screenType)} {!credentialSubjectRows.some(row => row.name === 'valid_until') && renderRow('valid_until', 'Valid until', parsedCredential?.vc?.credentialSubject?.valid_until, screenType)} - {!credentialSubjectRows.some(row => row.name === 'issuer') && renderRow('issuer', 'Issuer', parsedCredential?.vc?.credentialSubject?.issuer, screenType)} + {!credentialSubjectRows.some(row => row.name === 'issuer') && renderRow('issuer', 'Issuer', parsedCredential?.vc?.credentialSubject?.issuer || issuerName, screenType)} ) } diff --git a/src/context/ContainerContext.tsx b/src/context/ContainerContext.tsx index 7e9b2e8be..a183e486c 100644 --- a/src/context/ContainerContext.tsx +++ b/src/context/ContainerContext.tsx @@ -269,6 +269,7 @@ export const ContainerContextProvider = ({ children }) => { if (isOpenBadgeCredential) return beautifiedForm.credentialSubject.achievement.name; if (t.includes('SupportCredential') || t.includes('ExamEnrollmentCredential')) return beautifiedForm.credentialSubject.title; + if (t.includes('AcademicEnrollmentCredential')) return beautifiedForm.credentialSubject.name; if (storedCredentialConfigurationId === 'EduID') return 'eduID' return result.beautifiedForm.name || credentialConfiguration?.display?.[0]?.name || 'Credential'; From 3e301930c1ca331d2371e0287e8ecb06c60dd998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A8r=20Kessels?= Date: Wed, 4 Jun 2025 10:20:51 +0200 Subject: [PATCH 2/2] feat: Remove trusted issuer check from authorization code flow Users weren't prompted, only an error logged to the console, amids many other errors and logs. Users won't see why it doesn't work. Devs have no easy or documented way to provide trusted issuers either. Trusted issuers are not per-user but server-wide, so allowing users to add/ignore/allow them, is not possible in current setup. All in all, this "feature" is very much in our way, annoying and it adds nothing yet. It will increase security when finished. But in current state doesn't add safety, but is annoying and in the way. --- src/components/CredentialOfferHandler.tsx | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/components/CredentialOfferHandler.tsx b/src/components/CredentialOfferHandler.tsx index d2bccc346..58947e501 100644 --- a/src/components/CredentialOfferHandler.tsx +++ b/src/components/CredentialOfferHandler.tsx @@ -149,13 +149,13 @@ export const CredentialOfferHandler = ({ ) { return; } - + const userHandleB64u = keystore.getUserHandleB64u(); - + if (!userHandleB64u) { return; } - + const handleCredentialOffer = async () => { try { // Get the credential offer @@ -178,14 +178,6 @@ export const CredentialOfferHandler = ({ setCredentialIssuer(issuer); - // Get trusted issuers - const { data: trustedCredentialIssuers } = await api.getExternalEntity('/issuer/all', undefined, true); - const trustedCredentialIssuer = trustedCredentialIssuers.find(o => o.credentialIssuerIdentifier = issuer); - - if (!trustedCredentialIssuer) { - // @todo: Prompt to add issuer to trusted issuers - } - // Get issuer configuration const issuerConfiguration = await getIssuerConfiguration( issuer.endsWith('/') ? issuer.slice(0, -1) : issuer, @@ -213,11 +205,6 @@ export const CredentialOfferHandler = ({ /** Authorization code flow */ if (FIELD_AUTHORIZATION_CODE_GRANT_TYPE in grants) { - // @todo: May not be needed - if (!trustedCredentialIssuer) { - throw new Error('Issuing a credential with authorization code flow only works with trusted issuers.'); - } - // Get issuer state const issuer_state = grants.authorization_code?.issuer_state;