diff --git a/main.py b/main.py index 5d72805..c4e7263 100644 --- a/main.py +++ b/main.py @@ -5,7 +5,7 @@ from jinja2 import Environment, FileSystemLoader, select_autoescape import idhub_ssikit -def issue_vc_test(): +def issue_vc_test(vc_name): jwk_issuer = didkit.generate_ed25519_key() jwk_subject = didkit.generate_ed25519_key() @@ -16,13 +16,13 @@ def issue_vc_test(): loader=FileSystemLoader("vc_templates"), autoescape=select_autoescape() ) - unsigned_vc_template = env.get_template("member.json") + unsigned_vc_template = env.get_template(vc_name) data = { - "vc_id": "http://example.org/credentials/3731", + "vc_id": "http://trustchain.pangea.org/credentials/42069", "issuer_did": did_issuer, - "subject_did": did_subject, "issuance_date": "2020-08-19T21:41:50Z", "validUntil": "2020-08-19T21:41:50Z", + "subject_did": did_subject, "membershipType": "lareputa" } signed_credential = idhub_ssikit.render_and_sign_credential( diff --git a/vc_templates/financial-vulnerability-PareManel.json b/vc_templates/financial-vulnerability-PareManel.json new file mode 100644 index 0000000..f5dbf33 --- /dev/null +++ b/vc_templates/financial-vulnerability-PareManel.json @@ -0,0 +1,101 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + { + "credentialSchema": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#surname", + "value": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#surname", + "lang": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#surname", + "description": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#surname", + "name": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#name", + + "surname": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#surname", + "email": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#email", + "phoneNumber": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#phoneNumber", + "identityDocType": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#identityDocType", + "identityNumber": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#identityNumber", + "streetAddress": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#streetAddress", + "socialWorkerName": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#socialWorkerName", + "socialWorkerSurname": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#socialWorkerSurname", + "financialVulnerabilityScore": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#financialVulnerabilityScore", + "amountCoveredByOtherAids": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#amountCoveredByOtherAids", + "connectivityOptionList": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#connectivityOptionList", + "assessmentDate": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#assessmentDate" + } + ], + "id": "{{ vc_id }}", + "type": [ + "VerifiableCredential", + "VerifiableAttestation", + "FinancialVulnerabilityCredential" + ], + "issuer": { + "id": "{{ issuer_did }}", + "name": "Fundació Pare Manel", + "description": [ + { + "value": "The Pare Manel Foundation is a non-profit institution which develops and leads social and educational action projects.", + "lang": "en" + }, + { + "value": "La Fundació Pare Manel és una institució sense ànim de lucre que desenvolupa i lidera projectes d'acció social i educativa.", + "lang": "ca_ES" + }, + { + "value": "La Fundación Pare Manel es una institución sin ánimo de lucro que desarrolla y lidera proyectos de acción social y educativa.", + "lang": "es" + } + ] + }, + "issuanceDate": "{{ issuance_date }}", + "validFrom": "{{ issuance_date }}", + "validUntil": "{{ validUntil }}", + "name": [ + { + "value": "Financial Vulnerability Credential", + "lang": "en" + }, + { + "value": "Credencial de Vulnerabilitat Financera", + "lang": "ca_ES" + }, + { + "value": "Credencial de Vulnerabilidad Financiera", + "lang": "es" + } + ], + "description": [ + { + "value": "The Financial Vulnerability Credential is issued to individuals or families to prove their financial vulnerability based on various factors, with the objective of presenting it to a third party to receive benefits or services.", + "lang": "en" + }, + { + "value": "La Credencial de Vulnerabilitat Financera és emesa a persones o famílies per acreditar la seva vulnerabilitat financera sobre la base de diversos factors, amb l'objectiu que la presentin a una tercera part per rebre beneficis o serveis.", + "lang": "ca_ES" + }, + { + "value": "La Credencial de Vulnerabilidad Financiera es emitida a personas o familias para acreditar su vulnerabilidad financiera con base en diversos factores, con el objetivo de que la presenten a una tercera parte para recibir beneficios o servicios.", + "lang": "es" + } + ], + + "credentialSubject": { + "id": "{{ subject_did }}", + "name": "{{ first_name }}", + "surname": "{{ last_name }}", + "email": "{{ email }}", + "phoneNumber": "{{ phone_number }}", + "identityDocType": "{{ identity_doc_type }}", + "identityNumber": "{{ identity_number }}", + "streetAddress": "{{ street_address }}", + "socialWorkerName": "{{ social_worker_name }}", + "socialWorkerSurname": "{{ social_worker_surname }}", + "financialVulnerabilityScore": "{{ financial_vulnerability_score }}", + "amountCoveredByOtherAids": "{{ amount_covered_by_other_aid }}", + "connectivityOptionList": "{{ connectivity_option_list }}", + "assessmentDate": "{{ assessmentDate }}" + }, + "credentialSchema": { + "id": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/vc_schemas/financial_vulnerability.json", + "type": "JsonSchema" + } +} diff --git a/vc_templates/membership-card-Pangea.json b/vc_templates/membership-card-Pangea.json new file mode 100644 index 0000000..aa4d5cd --- /dev/null +++ b/vc_templates/membership-card-Pangea.json @@ -0,0 +1,97 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + { + "credentialSchema": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#surname", + "value": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#surname", + "lang": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#surname", + "description": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#surname", + "name": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#name", + + "organisation": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#organisation", + "membershipType": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#membershipType", + "membershipId": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#membershipId", + "affiliatedSince": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#iaffiliatedSince", + "affiliatedUntil": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#affiliatedUntil", + "typeOfPerson": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#typeOfPerson", + "identityDocType": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#identityDocType", + "identityNumber": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#identityNumber", + "email": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#email", + "surname": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/contexts/#surname" + } + ], + "type": [ + "VerifiableCredential", + "VerifiableAttestation", + "MembershipCard" + ], + "id": "{{ vc_id }}", + "issuer": { + "id": "{{ issuer_did }}", + "name": "Pangea", + "description": [ + { + "value": "Pangea.org is a service provider leveraging open-source technologies to provide affordable and accessible solutions for social enterprises and solidarity organisations.", + "lang": "en" + }, + { + "value": "Pangea.org és un proveïdor de serveis que aprofita les tecnologies de codi obert per oferir solucions assequibles i accessibles per a empreses socials i organitzacions solidàries.", + "lang": "ca_ES" + }, + { + "value": "Pangea.org es un proveedor de servicios que aprovecha tecnologías de código abierto para proporcionar soluciones asequibles y accesibles para empresas sociales y organizaciones solidarias.", + "lang": "es" + } + ] + }, + "issuanceDate": "{{ issuance_date }}", + "issued": "{{ issuance_date }}", + "validFrom": "{{ issuance_date }}", + "validUntil": "{{ validUntil }}", + "name": [ + { + "value": "Membership Card", + "lang": "en" + }, + { + "value": "Carnet de soci/a", + "lang": "ca_ES" + }, + { + "value": "Carnet de socio/a", + "lang": "es" + } + ], + "description": [ + { + "value": "The membership card specifies an individual's subscription or enrollment in specific services or benefits issued by an organization.", + "lang": "en" + }, + { + "value": "El carnet de soci especifica la subscripció o la inscripció d'un individu en serveis o beneficis específics emesos per una organització.", + "lang": "ca_ES" + }, + { + "value": "El carnet de socio especifica la suscripción o inscripción de un individuo en servicios o beneficios específicos emitidos por uns organización.", + "lang": "es" + } + ], + "credentialSubject": { + "id": "{{ subject_did }}", + "organisation": "Pangea", + "membershipType": "{{ membershipType }}", + "membershipId": "{{ membershipId }}", + "affiliatedSince": "{{ affiliatedSince }}", + "affiliatedUntil": "{{ affiliatedUntil }}", + "typeOfPerson": "{{ typeOfPerson }}", + "identityDocType": "{{ identityDocType }}", + "identityNumber": "{{ identityNumber }}", + "name": "{{ first_name }}", + "surname": "{{ last_name }}", + "email": "{{ email }}" + }, + "credentialSchema": { + "id": "https://gitea.pangea.org/trustchain-oc1-orchestral/schemas/vc_schemas/membership-card.json", + "type": "JsonSchema" + } +} \ No newline at end of file diff --git a/vc_templates/exo.json b/vc_templates/old_or_deprecated/exo.json similarity index 100% rename from vc_templates/exo.json rename to vc_templates/old_or_deprecated/exo.json diff --git a/vc_templates/member.json b/vc_templates/old_or_deprecated/member.json similarity index 100% rename from vc_templates/member.json rename to vc_templates/old_or_deprecated/member.json diff --git a/vc_templates/membership-card.json b/vc_templates/old_or_deprecated/membership-card.json similarity index 100% rename from vc_templates/membership-card.json rename to vc_templates/old_or_deprecated/membership-card.json diff --git a/vc_templates/openarms.json b/vc_templates/old_or_deprecated/openarms.json similarity index 100% rename from vc_templates/openarms.json rename to vc_templates/old_or_deprecated/openarms.json diff --git a/vc_templates/paremanel.json b/vc_templates/old_or_deprecated/paremanel.json similarity index 100% rename from vc_templates/paremanel.json rename to vc_templates/old_or_deprecated/paremanel.json