From e81837bd4eb3084fdf1e15b1870178343808dc49 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 27 Feb 2024 13:19:25 +0100 Subject: [PATCH] add url in credentialStatus for key dids --- idhub/models.py | 5 +++++ idhub/templates/credentials/course-credential.json | 4 ++-- idhub/templates/credentials/e-operator-claim.json | 4 ++-- idhub/templates/credentials/federation-membership.json | 4 ++-- idhub/templates/credentials/financial-vulnerability.json | 4 ++-- idhub/templates/credentials/membership-card.json | 4 ++-- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/idhub/models.py b/idhub/models.py index 07f9a15..ae4625b 100644 --- a/idhub/models.py +++ b/idhub/models.py @@ -699,6 +699,10 @@ class VerificableCredential(models.Model): org = Organization.objects.get(main=True) + credential_status_id = 'https://revocation.not.supported/' + if self.issuer_did.type == DID.Types.WEB: + credential_status_id = self.issuer_did.did + context = { 'id_credential': str(self.id), 'vc_id': url_id, @@ -709,6 +713,7 @@ class VerificableCredential(models.Model): 'lastName': self.user.last_name or "", 'email': self.user.email, 'organisation': org.name or '', + 'credential_status_id': credential_status_id, } context.update(d) return context diff --git a/idhub/templates/credentials/course-credential.json b/idhub/templates/credentials/course-credential.json index 6ba46ef..e7ac036 100644 --- a/idhub/templates/credentials/course-credential.json +++ b/idhub/templates/credentials/course-credential.json @@ -59,7 +59,7 @@ "evidenceAssessment": "{{ evidenceAssessment }}" }, "credentialStatus": { - "id": "{{ issuer_did }}", + "id": "{{ credential_status_id}}", "type": "RevocationBitmap2022", "revocationBitmapIndex": "{{ id_credential }}" }, @@ -68,4 +68,4 @@ "type": "FullJsonSchemaValidator2021" } } - \ No newline at end of file + diff --git a/idhub/templates/credentials/e-operator-claim.json b/idhub/templates/credentials/e-operator-claim.json index 902a940..71c46f5 100644 --- a/idhub/templates/credentials/e-operator-claim.json +++ b/idhub/templates/credentials/e-operator-claim.json @@ -56,7 +56,7 @@ "email": "{{ email }}" }, "credentialStatus": { - "id": "{{ issuer_did }}", + "id": "{{ credential_status_id}}", "type": "RevocationBitmap2022", "revocationBitmapIndex": "{{ id_credential }}" }, @@ -64,4 +64,4 @@ "id": "https://idhub.pangea.org/vc_schemas/federation-membership.json", "type": "FullJsonSchemaValidator2021" } - } \ No newline at end of file + } diff --git a/idhub/templates/credentials/federation-membership.json b/idhub/templates/credentials/federation-membership.json index ca35e70..9a382a1 100644 --- a/idhub/templates/credentials/federation-membership.json +++ b/idhub/templates/credentials/federation-membership.json @@ -67,7 +67,7 @@ "certificationDate": "{{ certificationDate }}" }, "credentialStatus": { - "id": "{{ issuer_did }}", + "id": "{{ credential_status_id}}", "type": "RevocationBitmap2022", "revocationBitmapIndex": "{{ id_credential }}" }, @@ -75,4 +75,4 @@ "id": "https://idhub.pangea.org/vc_schemas/federation-membership.json", "type": "FullJsonSchemaValidator2021" } - } \ No newline at end of file + } diff --git a/idhub/templates/credentials/financial-vulnerability.json b/idhub/templates/credentials/financial-vulnerability.json index 859b161..cfe2495 100644 --- a/idhub/templates/credentials/financial-vulnerability.json +++ b/idhub/templates/credentials/financial-vulnerability.json @@ -63,7 +63,7 @@ "assessmentDate": "{{ assessmentDate }}" }, "credentialStatus": { - "id": "{{ issuer_did }}", + "id": "{{ credential_status_id}}", "type": "RevocationBitmap2022", "revocationBitmapIndex": "{{ id_credential }}" }, @@ -71,4 +71,4 @@ "id": "https://idhub.pangea.org/vc_schemas/financial-vulnerability.json", "type": "FullJsonSchemaValidator2021" } -} \ No newline at end of file +} diff --git a/idhub/templates/credentials/membership-card.json b/idhub/templates/credentials/membership-card.json index d227bdc..e9de47a 100644 --- a/idhub/templates/credentials/membership-card.json +++ b/idhub/templates/credentials/membership-card.json @@ -62,7 +62,7 @@ "affiliatedUntil": "{{ affiliatedUntil }}" }, "credentialStatus": { - "id": "{{ issuer_did }}", + "id": "{{ credential_status_id}}", "type": "RevocationBitmap2022", "revocationBitmapIndex": "{{ id_credential }}" }, @@ -70,4 +70,4 @@ "id": "https://idhub.pangea.org/vc_schemas/membership-card.json", "type": "FullJsonSchemaValidator2021" } -} \ No newline at end of file +}