### Example Identity Attestation Data (Mother) Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/README.md This example shows the concrete values for an identity attestation for a mother, illustrating how the schema attributes are populated. ```json { "@context": ["https://www.w3.org/2018/credentials/v1","https://iqn-trustframework.apps.exp.lab.pocquebec.org/2020/credentials/iqn/identite/v1/"], "id": "http://iqn-trustframework.apps.exp.lab.pocquebec.org/2020/credentials/iqn/identite/v1/RegistreIdentite.json" } ``` -------------------------------- ### Example Identity Attestation Data Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/README.md This example shows the concrete values for an identity attestation, illustrating how the schema attributes are populated for a specific individual. ```json { "@context": ["https://www.w3.org/2018/credentials/v1", "https://iqn-trustframework.apps.exp.lab.pocquebec.org/2020/credentials/iqn/identite/v1"], "id": "http://iqn-trustframework.apps.exp.lab.pocquebec.org/2020/credentials/iqn/identite/v1/RegistreIdentite.json", "type": ["VerifiableCredential","IdentityCredential"], "credentialSchema": "V4SGRU86Z58d6TV7PBUe6f:3:CL:1573: Registre_Identite_Qc", "issuanceDate": "2020-11-04T15:40:00Z", "expirationDate": "2020-11-04T15:40:00Z", "issuer": "did:sov: V4SGRU86Z58d6TV7PBUe6f", "trustFramework": "http://iqn-trustframework.apps.exp.lab.pocquebec.org", "credentialSubject.id": "DID de Luc", "credentialSubject.firstNames": "Luc", "credentialSubject.lastName": "Plante", "credentialSubject.birthDate": "1976-01-01T20:00:00Z", "credentialSubject.birthplace": "Ville de Québec", "credentialSubject.gender": "Masculin", "credentialSubject.fatherFullName": "Nom complet du père", "credentialSubject.motherFullName": "Solange Plante (nom complet de la mère)" } ``` -------------------------------- ### Créer le projet OpenShift Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/openshift/templates/README.md Initialise un nouveau projet dans OpenShift et définit le contexte actif. ```bash oc new-project exp-att-man --display-name="Expérimentation Attestation Mandatée" --description="Expérimentation sur l'Attestation Mandatée en verifiable credential" ``` ```bash oc project exp-att-man ``` -------------------------------- ### Création du schéma de mandat de curatelle Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Envoie une requête POST pour enregistrer un nouveau schéma de mandat de curatelle avec les attributs requis. ```bash curl -X POST "http://cpq-agent-admin.apps.exp.lab.pocquebec.org/schemas" \ -H "accept: application/json" \ -H "X-Api-Key: secret" \ -H "Content-Type: application/json-patch+json" \ -d '{ "schema_name": "Mandat de Curatelle", "schema_version": "1.0", "attributes": [ "id", "type", "credentialSchema", "issuanceDate", "expirationDate", "issuer", "trustFramework", "auditURI", "appealURI", "credentialSubject.holder.type", "credentialSubject.holder.role", "credentialSubject.holder.rationaleURI", "credentialSubject.holder.firstNames", "credentialSubject.holder.lastName", "credentialSubject.holder.birthDate", "credentialSubject.holder.birthplace", "credentialSubject.holder.gender", "credentialSubject.holder.fatherFullName", "credentialSubject.holder.motherFullName", "credentialSubject.holder.constraints.boundaries", "credentialSubject.holder.constraints.pointOfOrigin", "credentialSubject.holder.constraints.radiusKm", "credentialSubject.holder.constraints.jurisdictions", "credentialSubject.holder.constraints.trigger", "credentialSubject.holder.constraints.circumstances", "credentialSubject.proxied.type", "credentialSubject.proxied.permissions", "credentialSubject.proxied.firstNames", "credentialSubject.proxied.lastName", "credentialSubject.proxied.birthDate", "credentialSubject.proxied.birthplace", "credentialSubject.proxied.gender", "credentialSubject.proxied.fatherFullName", "credentialSubject.proxied.motherFullName", "credentialSubject.proxied.nativeLanguage", "credentialSubject.proxied.identifyingMarks", "credentialSubject.proxied.photo", "credentialSubject.proxied.iris", "credentialSubject.proxied.fingerprint" ] }' ``` -------------------------------- ### Supprimer les fichiers de clés locaux Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/openshift/templates/README.md Nettoyage des fichiers de clés sensibles après configuration. ```bash rm exp-att-man && rm exp-att-man.pub ``` -------------------------------- ### Fonctions utilitaires de configuration et réseau Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Fonctions pour récupérer les variables d'environnement et effectuer des requêtes fetch avec timeout. ```javascript // config/constants.js - Gestion des secrets API export function GET_API_SECRET() { let API_SECRET = process.env.REACT_APP_API_SECRET; if (API_SECRET === undefined || API_SECRET === '') return 'secret'; else return API_SECRET; } export function GET_SCHEMA_ID() { let SCHEMA_ID = process.env.REACT_APP_SCHEMA_ID; if (SCHEMA_ID === undefined || SCHEMA_ID === '') return 'NONE'; else return SCHEMA_ID; } export function GET_CRED_ID() { let CRED_ID = process.env.REACT_APP_CRED_ID; if (CRED_ID === undefined || CRED_ID === '') return 'NONE'; else return CRED_ID; } // config/endpoints.js - Configuration des URLs export function GET_ISSUER_HOST_URL() { let ISSUER_HOST_URL = process.env.REACT_APP_ISSUER_HOST_URL; if (ISSUER_HOST_URL === undefined || ISSUER_HOST_URL === '') return 'NONE'; else return ISSUER_HOST_URL; } // helpers/fetchWithTimeout.js - Fetch avec timeout export function fetchWithTimeout(url, options, timeout) { return Promise.race([ fetch(url, options), new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), timeout) ) ]); } ``` -------------------------------- ### Création de la définition d'attestation Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Envoie une requête POST pour créer une définition d'attestation liée à un schéma spécifique. ```bash curl -X POST "http://cpq-agent-admin.apps.exp.lab.pocquebec.org/credential-definitions" \ -H "accept: application/json" \ -H "X-Api-Key: secret" \ -H "Content-Type: application/json-patch+json" \ -d '{ "support_revocation": false, "tag": "vc-authn-oidc", "schema_id": "G15uJpKsf9JnvYCN54Sd28:2:Mandat de Curatelle:1.0" }' ``` -------------------------------- ### Démarrer l'installation des contrôleurs Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/openshift/templates/README.md Déploie les composants de l'expérimentation en utilisant les gabarits OpenShift fournis. ```bash oc process -f openshift/templates/rqc-template.yml -p GITHUB_WEBHOOK_SECRET='$(cat .ssh/exp-att-man)' | oc apply -f - ``` ```bash oc process -f openshift/templates/cpq-template.yml -p GITHUB_WEBHOOK_SECRET='$(cat .ssh/exp-att-man)' | oc apply -f - ``` -------------------------------- ### Configure Express Server Proxies Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Sets up an Express server to serve static React files and proxy API requests to Hyperledger Aries agents. ```javascript const express = require('express'); const path = require('path'); const app = express(); const { createProxyMiddleware } = require('http-proxy-middleware'); // Configuration des ports et URLs const PORT = process.env.PORT || 11000; const HOST_URL = process.env.REACT_APP_ISSUER_HOST_URL || 'http://rqc-agent-admin.apps.exp.lab.pocquebec.org'; // Servir les fichiers statiques React app.use(express.static(path.join(__dirname, 'build'))); // Proxy pour les connexions avec le portefeuille numérique app.use('/connections', createProxyMiddleware({ target: HOST_URL, changeOrigin: true, })); // Proxy pour l'émission d'attestations app.use('/issue-credential', createProxyMiddleware({ target: HOST_URL, changeOrigin: true, })); // Proxy pour les définitions d'attestations app.use('/credential-definitions', createProxyMiddleware({ target: HOST_URL, changeOrigin: true, })); // Proxy pour les présentations de preuves app.use('/present-proof', createProxyMiddleware({ target: HOST_URL, changeOrigin: true, })); // Route par défaut pour le SPA React app.get('*', function (req, res) { res.sendFile(path.join(__dirname, 'build', 'index.html')); }); app.listen(PORT); console.log("Application started on port " + PORT); ``` -------------------------------- ### Déployer sur OpenShift et configurer les schémas Indy Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Commandes pour initialiser le projet OpenShift, déployer les contrôleurs et enregistrer les schémas sur la blockchain. ```bash # Créer le projet OpenShift oc new-project exp-att-man --display-name="Expérimentation Attestation Mandatée" # Déployer les contrôleurs oc process -f openshift/templates/rqc-template.yml | oc apply -f - oc process -f openshift/templates/cpq-template.yml | oc apply -f - # Créer le schéma d'identité sur la blockchain curl -X POST "http://rqc-agent-admin.apps.exp.lab.pocquebec.org/schemas" \ -H "accept: application/json" \ -H "X-Api-Key: secret" \ -H "Content-Type: application/json-patch+json" \ -d '{ "schema_name": "Identité Gouvernementale", "schema_version": "1.0", "attributes": [ "id", "type", "credentialSchema", "issuanceDate", "expirationDate", "issuer", "trustFramework", "credentialSubject.id", "credentialSubject.firstNames", "credentialSubject.lastName", "credentialSubject.gender", "credentialSubject.birthplace", "credentialSubject.birthDate", "credentialSubject.fatherFullName", "credentialSubject.motherFullName", "credentialSubject.photo" ] }' # Créer la définition d'attestation d'identité curl -X POST "http://rqc-agent-admin.apps.exp.lab.pocquebec.org/credential-definitions" \ -H "accept: application/json" \ -H "X-Api-Key: secret" \ -H "Content-Type: application/json-patch+json" \ -d '{ "support_revocation": false, "tag": "vc-authn-oidc", "schema_id": "G15uJpKsf9JnvYCN54Sd28:2:Identité Gouvernementale:1.0" }' ``` -------------------------------- ### Create Identity Schema Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/openshift/templates/README.md Use this command to create the identity schema. Ensure the agent URL is correct and adjust schema name and version as needed. ```bash curl -X POST "http://rqc-agent-admin.apps.exp.lab.pocquebec.org/schemas" -H "accept: application/json" -H "X-Api-Key: " -H "Content-Type: application/json-patch+json" -d "{\"schema_name\": \"Identité Gouvernementale\",\"schema_version\":\"1.0\",\"attributes\":[\"id\",\"type\",\"credentialSchema\",\"issuanceDate\",\"expirationDate\",\"issuer\",\"trustFramework\",\"credentialSubject.id\",\"credentialSubject.firstNames\",\"credentialSubject.lastName\",\"credentialSubject.gender\",\"credentialSubject.birthplace\",\"credentialSubject.birthDate\",\"credentialSubject.fatherFullName\",\"credentialSubject.motherFullName\",\"credentialSubject.photo\"]}" ``` -------------------------------- ### Configurer les clés SSH pour le déploiement Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/openshift/templates/README.md Commandes pour générer des clés SSH et les intégrer dans OpenShift afin d'accéder à des dépôts GitHub privés. ```bash mkdir .ssh cd .ssh ``` ```bash ssh-keygen -C "openshift-source-builder/exp-att-man@github" -f exp-att-man -N '' ``` ```bash oc create secret generic exp-att-man --from-file=ssh-privatekey=exp-att-mna --type=kubernetes.io/ssh-auth ``` ```bash oc secrets link builder exp-att-man ``` -------------------------------- ### Create Identity Credential Definition Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/openshift/templates/README.md Create the identity credential definition using the schema ID obtained from the previous step. Revocation is not supported. ```bash curl -X POST "http://rqc-agent-admin.apps.exp.lab.pocquebec.org/credential-definitions" -H "accept: application/json" -H "X-Api-Key: " -H "Content-Type: application/json-patch+json" -d "{\"support_revocation\": false,\"tag\": \"vc-authn-oidc\",\"schema_id\": \"G15uJpKsf9JnvYCN54Sd28:2:Identité Gouvernementale:1.0\"}" ``` -------------------------------- ### Create Curatorship Mandate Schema Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/openshift/templates/README.md Use this command to create the curatorship mandate schema. Ensure the agent URL is correct and adjust schema name and version as needed. ```bash curl -X POST "http://cpq-agent-admin.apps.exp.lab.pocquebec.org/schemas" -H "accept: application/json" -H "X-Api-Key: " -H "Content-Type: application/json-patch+json" -d "{\"schema_name\": \"Mandat de Curatelle\",\"schema_version\":\"1.0\",\"attributes\":[\"id\",\"type\",\"credentialSchema\",\"issuanceDate\",\"expirationDate\",\"issuer\",\"trustFramework\",\"auditURI\",\"appealURI\",\"credentialSubject.holder.type\",\"credentialSubject.holder.role\",\"credentialSubject.holder.rationaleURI\",\"credentialSubject.holder.firstNames\",\"credentialSubject.holder.lastName\",\"credentialSubject.holder.birthDate\",\"credentialSubject.holder.birthplace\",\"credentialSubject.holder.gender\",\"credentialSubject.holder.fatherFullName\",\"credentialSubject.holder.motherFullName\",\"credentialSubject.holder.constraints.boundaries\",\"credentialSubject.holder.constraints.pointOfOrigin\",\"credentialSubject.holder.constraints.radiusKm\",\"credentialSubject.holder.constraints.jurisdictions\",\"credentialSubject.holder.constraints.trigger\",\"credentialSubject.holder.constraints.circumstances\",\"credentialSubject.proxied.type\",\"credentialSubject.proxied.permissions\",\"credentialSubject.proxied.firstNames\",\"credentialSubject.proxied.lastName\",\"credentialSubject.proxied.birthDate\",\"credentialSubject.proxied.birthplace\",\"credentialSubject.proxied.gender\",\"credentialSubject.proxied.fatherFullName\",\"credentialSubject.proxied.motherFullName\",\"credentialSubject.proxied.nativeLanguage\",\"credentialSubject.proxied.identifyingMarks\",\"credentialSubject.proxied.photo\",\"credentialSubject.proxied.iris\",\"credentialSubject.proxied.fingerprint\"]}" ``` -------------------------------- ### Envoyer une demande de présentation de preuve Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Utilisez cette fonction pour envoyer une demande de présentation de preuve au portefeuille du citoyen. Elle nécessite l'ID de connexion et l'ID de définition de credential. L'ID de l'échange de présentation est consigné dans la console. ```javascript function sendProofRequest(connectionId, credDefId) { fetch('/present-proof/send-request', { method: 'POST', headers: { 'X-API-Key': `${GET_API_SECRET()}`, 'Content-Type': 'application/json; charset=utf-8' }, body: JSON.stringify({ "connection_id": connectionId, "proof_request": { "name": "Vérification d'identité", "version": "1.0", "requested_attributes": { "subjectFirstNames": { "name": "credentialSubject.firstNames", "restrictions": [{ "cred_def_id": credDefId }] }, "subjectLastName": { "name": "credentialSubject.lastName", "restrictions": [{ "cred_def_id": credDefId }] }, "subjectGender": { "name": "credentialSubject.gender", "restrictions": [{ "cred_def_id": credDefId }] }, "subjectBirthplace": { "name": "credentialSubject.birthplace", "restrictions": [{ "cred_def_id": credDefId }] }, "subjectBirthDate": { "name": "credentialSubject.birthDate", "restrictions": [{ "cred_def_id": credDefId }] }, "subjectFatherFullName": { "name": "credentialSubject.fatherFullName", "restrictions": [{ "cred_def_id": credDefId }] }, "subjectMotherFullName": { "name": "credentialSubject.motherFullName", "restrictions": [{ "cred_def_id": credDefId }] }, "subjectPhoto": { "name": "credentialSubject.photo", "restrictions": [{ "cred_def_id": credDefId }] } }, "requested_predicates": {} } }) }).then(response => response.json()) .then(data => { console.log("Presentation exchange ID:", data.presentation_exchange_id); // Stocker l'ID pour la vérification ultérieure }); } ``` -------------------------------- ### Create Curatorship Mandate Credential Definition Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/openshift/templates/README.md Create the curatorship mandate credential definition using the schema ID obtained from the previous step. Revocation is not supported. ```bash curl -X POST "http://cpq-agent-admin.apps.exp.lab.pocquebec.org/credential-definitions" -H "accept: application/json" -H "X-Api-Key: " -H "Content-Type: application/json-patch+json" -d "{\"support_revocation\": false,\"tag\": \"vc-authn-oidc\",\"schema_id\": \"G15uJpKsf9JnvYCN54Sd28:2:Mandat de Curatelle:1.0\"}" ``` -------------------------------- ### Émission d'attestation de mandat Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Envoie une requête POST pour émettre une attestation de mandat de curatelle en utilisant les en-têtes d'authentification requis. ```javascript "comment": "Émission d'attestation de mandat de curatelle" }), headers: { 'HOST': `${GET_ISSUER_HOST_URL}`, 'X-API-Key': `${GET_API_SECRET()}`, 'Content-Type': 'application/json; charset=utf-8' } }).then(resp => console.log("Mandat de curatelle émis")); } ``` -------------------------------- ### Vérifier une présentation de preuve en JavaScript Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Utilise l'API pour valider une présentation de preuve et extraire les attributs du titulaire et du sujet. ```javascript function VerifyPresentation(presentation_exchange_id) { fetch('/present-proof/records/' + presentation_exchange_id + '/verify-presentation', { method: 'POST', headers: { 'X-API-Key': `${GET_API_SECRET()}`, 'Content-Type': 'application/json; charset=utf-8', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': '*', 'Access-Control-Allow-Headers': '*', 'Access-Control-Allow-Credentials': 'true' }, body: {} }) .then(response => response.json()) .then(data => { // Extraire les données vérifiées de la présentation const mandatVerifie = { holderFirstNames: data.presentation.requested_proof.revealed_attrs.holderFirstNames.raw, holderLastName: data.presentation.requested_proof.revealed_attrs.holderLastName.raw, holderGender: data.presentation.requested_proof.revealed_attrs.holderGender.raw, holderBirthplace: data.presentation.requested_proof.revealed_attrs.holderBirthplace.raw, holderBirthDate: data.presentation.requested_proof.revealed_attrs.holderBirthDate.raw, holderFatherFullName: data.presentation.requested_proof.revealed_attrs.holderFatherFullName.raw, holderMotherFullName: data.presentation.requested_proof.revealed_attrs.holderMotherFullName.raw, // Données du sujet (personne dépendante) subjectFirstNames: data.presentation.requested_proof.revealed_attrs.subjectFirstNames.raw, subjectLastName: data.presentation.requested_proof.revealed_attrs.subjectLastName.raw, subjectGender: data.presentation.requested_proof.revealed_attrs.subjectGender.raw, subjectBirthplace: data.presentation.requested_proof.revealed_attrs.subjectBirthplace.raw, subjectBirthDate: data.presentation.requested_proof.revealed_attrs.subjectBirthDate.raw, subjectFatherFullName: data.presentation.requested_proof.revealed_attrs.subjectFatherFullName.raw, subjectMotherFullName: data.presentation.requested_proof.revealed_attrs.subjectMotherFullName.raw }; console.log("Mandat vérifié:", mandatVerifie); // Procéder à l'émission de l'attestation d'identité par mandat }); } ``` -------------------------------- ### Copier la clé publique SSH Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/openshift/templates/README.md Commandes pour copier la clé publique dans le presse-papier selon le système d'exploitation. ```bash xclip -sel c < exp-att-man.pub ``` ```bash cat exp-att-man.pub | pbcopy ``` -------------------------------- ### Create Connection Invitation Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Sends a POST request to the Aries agent to generate a connection invitation for a digital wallet. ```javascript import { GET_API_SECRET } from '../../config/constants'; import { GET_ISSUER_HOST_URL } from '../../config/endpoints'; function creerInvitation(destination) { fetch('/connections/create-invitation', { method: 'POST', headers: { 'HOST': `${GET_ISSUER_HOST_URL}`, 'X-API-Key': `${GET_API_SECRET()}`, 'Content-Type': 'application/json; charset=utf-8', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, POST, PUT, PATCH, POST, DELETE, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type', 'Access-Control-Max-Age': '86400' } }).then((resp => resp.json().then((data => { // Rediriger avec les données de l'invitation history.push(destination, { type: "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/invitation", data: { issuanceDate: '2024-01-15', id: 'did:sov:abc123xyz', firstNames: 'Luc', lastName: 'Robitaille', gender: 'Masculin', birthplace: 'Ville de Québec, Québec, Canada', birthDate: '1976-11-08', fatherFullName: 'Jacques Robitaille', motherFullName: 'Solange Robitaille', registrationNumber: 'uuid-registration', photo: 'base64-encoded-photo' }, invitation: data }); })))); } ``` -------------------------------- ### Émettre un mandat de curatelle Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Utilise l'API d'émission de mandat pour créer une relation entre un curateur et une personne dépendante. Nécessite la configuration des variables d'environnement pour les schémas et les identifiants d'émetteur. ```javascript function issueCredentialMandat() { const schemaName = process.env.REACT_APP_SCHEMA_CURATELLE; const schemaVersion = process.env.REACT_APP_SCHEMA_CURATELLE_VERSION; const schemaIssuerDID = process.env.REACT_APP_SCHEMA_ISSUER_DID_CURATELLE; const schemaCredDef = process.env.REACT_APP_CRED_DEF_CURATELLE; fetch('/issue-credential/send', { method: 'POST', body: JSON.stringify({ "schema_name": schemaName, "schema_version": schemaVersion, "schema_issuer_did": schemaIssuerDID, "connection_id": "connection-uuid", "cred_def_id": schemaCredDef, "credential_proposal": { "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/1.0/credential-preview", "attributes": [ { "name": "@context", "value": '["https://www.w3.org/2018/credentials/v1","https://github.com/hyperledger/aries-rfcs/concepts/0103-indirect-identity-control"]' }, { "name": "id", "value": "https://iqn-trustframework.apps.exp.lab.pocquebec.org/2020/credentials/iqn/delegation/v1/MandatCuratelle.json" }, { "name": "type", "value": '["VerifiableCredential", "Proxy.G/IQNTrustFramework/1.0/delegation"]' }, { "name": "issuanceDate", "value": "2024-01-15" }, { "name": "expirationDate", "value": "2030-12-31" }, { "name": "issuer", "value": "did:sov:CurateurPublicDID" }, { "name": "trustFramework", "value": "http://iqn-trustframework.apps.exp.lab.pocquebec.org/" }, { "name": "auditURI", "value": "https://audit.org/report" }, { "name": "appealURI", "value": "did:sov:U86Z58d6TV7PB" }, // Données du détenteur (représentant/curateur) { "name": "credentialSubject.holder.type", "value": "http://iqn-trustframework.apps.exp.lab.pocquebec.org/2020/credentials/iqn/identite/v1/RegistreIdentite.json" }, { "name": "credentialSubject.holder.role", "value": "Curateur" }, { "name": "credentialSubject.holder.rationaleURI", "value": "Décision procès nr. 63554/2020" }, { "name": "credentialSubject.holder.firstNames", "value": "Luc" }, { "name": "credentialSubject.holder.lastName", "value": "Robitaille" }, { "name": "credentialSubject.holder.birthDate", "value": "1976-11-08" }, { "name": "credentialSubject.holder.birthplace", "value": "Ville de Québec" }, { "name": "credentialSubject.holder.gender", "value": "Masculin" }, { "name": "credentialSubject.holder.fatherFullName", "value": "Jacques Robitaille" }, { "name": "credentialSubject.holder.motherFullName", "value": "Solange Robitaille" }, // Contraintes du mandat { "name": "credentialSubject.holder.constraints.boundaries", "value": "Canada" }, { "name": "credentialSubject.holder.constraints.pointOfOrigin", "value": "Québec" }, { "name": "credentialSubject.holder.constraints.radiusKm", "value": "2000" }, { "name": "credentialSubject.holder.constraints.jurisdictions", "value": "Canada, toutes les provinces" }, // Données de la personne dépendante (sujet) { "name": "credentialSubject.proxied.type", "value": "http://iqn-trustframework.apps.exp.lab.pocquebec.org/2020/credentials/iqn/identite/v1/RegistreIdentite.json" }, { "name": "credentialSubject.proxied.permissions", "value": "S/O" }, { "name": "credentialSubject.proxied.firstNames", "value": "Solange" }, { "name": "credentialSubject.proxied.lastName", "value": "Robitaille" }, { "name": "credentialSubject.proxied.birthDate", "value": "1936-12-25" }, { "name": "credentialSubject.proxied.birthplace", "value": "Chibougamau, Québec" }, { "name": "credentialSubject.proxied.gender", "value": "Féminin" }, { "name": "credentialSubject.proxied.fatherFullName", "value": "Jean Robitaille" }, { "name": "credentialSubject.proxied.motherFullName", "value": "Marie Tremblay" }, { "name": "credentialSubject.proxied.nativeLanguage", "value": "Français" } ] }, ``` -------------------------------- ### Émission d'une attestation d'identité Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Utilise l'agent Aries pour envoyer une proposition d'attestation d'identité via une requête POST. Nécessite des variables d'environnement configurées pour le schéma et les identifiants de l'émetteur. ```javascript function issueCredential() { const schemaName = process.env.REACT_APP_SCHEMA_NAME_IDENTITE; const schemaVersion = process.env.REACT_APP_SCHEMA_VERSION_IDENTITE; const schemaIssuerDID = process.env.REACT_APP_SCHEMA_ISSUER_DID_IDENTITE; const schemaCredDef = process.env.REACT_APP_CRED_DEF_IDENTITE; fetch('/issue-credential/send', { method: 'POST', body: JSON.stringify({ "schema_name": schemaName, "schema_version": schemaVersion, "schema_issuer_did": schemaIssuerDID, "connection_id": "connection-uuid-from-invitation", "cred_def_id": schemaCredDef, "credential_proposal": { "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/1.0/credential-preview", "attributes": [ { "name": "@context", "value": '["https://www.w3.org/2018/credentials/v1", "http://iqn-trustframework.apps.exp.lab.pocquebec.org/2020/credentials/iqn/identite/v1"]' }, { "name": "id", "value": "http://iqn-trustframework.apps.exp.lab.pocquebec.org/2020/credentials/iqn/identite/v1/RegistreIdentite.json" }, { "name": "type", "value": '["VerifiableCredential", "IdentityCredential"]' }, { "name": "credentialSchema", "value": schemaCredDef }, { "name": "issuanceDate", "value": "2024-01-15" }, { "name": "expirationDate", "value": "" }, { "name": "issuer", "value": "did:iqn:" + schemaIssuerDID }, { "name": "trustFramework", "value": "http://iqn-trustframework.apps.exp.lab.pocquebec.org/" }, { "name": "credentialSubject.id", "value": "did:sov:citizen-did" }, { "name": "credentialSubject.firstNames", "value": "Luc" }, { "name": "credentialSubject.lastName", "value": "Robitaille" }, { "name": "credentialSubject.gender", "value": "Masculin" }, { "name": "credentialSubject.birthplace", "value": "Ville de Québec" }, { "name": "credentialSubject.birthDate", "value": "1976-11-08" }, { "name": "credentialSubject.fatherFullName", "value": "Jacques Robitaille" }, { "name": "credentialSubject.motherFullName", "value": "Solange Robitaille" }, { "name": "credentialSubject.photo", "value": "base64-encoded-photo" } ] }, "comment": "Émission d'attestation du registre d'identité Québec" }), headers: { 'HOST': `${GET_ISSUER_HOST_URL}`, 'X-API-Key': `${GET_API_SECRET()}`, 'Content-Type': 'application/json; charset=utf-8' } }).then(resp => { // Rediriger vers la page de vérification console.log("Attestation émise avec succès"); }); } ``` -------------------------------- ### Vérification de l'état de connexion Source: https://context7.com/cqen-qdce/exp-attestation-mandatee/llms.txt Vérifie périodiquement l'état d'une connexion avec le portefeuille numérique du citoyen en utilisant un polling avec timeout. ```javascript import { fetchWithTimeout } from '../../helpers/fetchWithTimeout'; function getConnectionInfo(connectionId) { const INTERVAL = 5000; // 5 secondes entre chaque vérification const TIMEOUT = 3000; // Timeout de 3 secondes pour chaque requête try { fetchWithTimeout(`/connections/${connectionId}`, { method: 'GET', headers: { 'HOST': `${GET_ISSUER_HOST_URL}`, 'X-API-Key': `${GET_API_SECRET()}`, 'Content-Type': 'application/json; charset=utf-8', } }, TIMEOUT).then((resp => { try { resp.json().then((data => { if (data.state) { let intervalFunction; // État "invitation" = en attente de connexion // État "active" = connexion établie if (data.state === "invitation") { intervalFunction = setTimeout(() => getConnectionInfo(connectionId), INTERVAL); } else { // Connexion établie, récupérer le DID du citoyen clearInterval(intervalFunction); console.log("DID du citoyen:", data.their_did); // Procéder à l'émission de l'attestation } } else { console.log('En attente de réponse!'); setTimeout(() => getConnectionInfo(connectionId), INTERVAL); } })); } catch (error) { setTimeout(() => getConnectionInfo(connectionId), INTERVAL); } })); } catch (error) { console.log(error); setTimeout(() => getConnectionInfo(connectionId), INTERVAL); } } ``` -------------------------------- ### Mandate Attestation Data Schema Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/README.md This JSON object outlines the schema for a mandate attestation, specifying attributes related to the holder, proxied individual, and constraints. ```json { "schema_name": "Mandat de curatelle", "schema_version": "1.0", "attributes": [ "@context", "id", "type", "credentialSchema", "issuanceDate", "expirationDate", "issuer", "trustFramework", "auditURI", "appealURI", "credentialSubject.holder.type", "credentialSubject.holder.role", "credentialSubject.holder.rationaleURI", "credentialSubject.holder.firstNames", "credentialSubject.holder.lastName", "credentialSubject.holder.birthDate", "credentialSubject.holder.birthplace", "credentialSubject.holder.gender", "credentialSubject.holder.fatherFullName", "credentialSubject.holder.motherFullName", "credentialSubject.holder.constraints.boundaries", "credentialSubject.holder.constraints.pointOfOrigin", "credentialSubject.holder.constraints.radiusKm", "credentialSubject.holder.constraints.jurisdictions", "credentialSubject.holder.constraints.trigger", "credentialSubject.holder.constraints.circumstances", "credentialSubject.proxied.type", "credentialSubject.proxied.permissions", "credentialSubject.proxied.firstNames", "credentialSubject.proxied.lastName", "credentialSubject.proxied.birthDate", "credentialSubject.proxied.birthplace", "credentialSubject.proxied.gender", "credentialSubject.proxied.fatherFullName", "credentialSubject.proxied.motherFullName", "credentialSubject.proxied.nativeLanguage", "credentialSubject.proxied.identifyingMarks", "credentialSubject.proxied.photo", "credentialSubject.proxied.iris", "credentialSubject.proxied.fingerprint" ] } ``` -------------------------------- ### Digital Identity Attestation Schema Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/README.md This JSON schema defines the structure and attributes for a digital identity attestation, including context, identifiers, dates, issuer, and subject details. ```json { "schema_name": "Identité Gouvernementale", "schema_version": "1.1", "attributes": [ "@context", "id", "type", "credentialSchema", "issuanceDate", "expirationDate", "issuer", "trustFramework", "credentialSubject.id", "credentialSubject.firstNames", "credentialSubject.lastName", "credentialSubject.birthDate", "credentialSubject.birthplace", "credentialSubject.gender", "credentialSubject.fatherFullName", "credentialSubject.motherFullName", "credentialSubject.photo" ] } ``` -------------------------------- ### Identity Attestation Data Schema Source: https://github.com/cqen-qdce/exp-attestation-mandatee/blob/master/README.md This JSON object defines the schema for an identity attestation, including fields like type, issuance date, issuer, and credential subject details. ```json { "type": [ "VerifiableCredential", "IdentityCredential" ], "credentialSchema": "V4SGRU86Z58d6TV7PBUe6f:3:CL:1573: Registre_Identite_Qc", "issuanceDate": "2020-11-04T15:40:00Z", "expirationDate": "2020-11-04T15:40:00Z", "issuer": "did:sov: V4SGRU86Z58d6TV7PBUe6f", "trustFramework": "http://iqn-trustframework.apps.exp.lab.pocquebec.org", "credentialSubject.id": "DID de la mère", "credentialSubject.firstNames": "Solange", "credentialSubject.lastName": "Plante", "credentialSubject.birthDate": "1950-01-01T20:00:00Z", "credentialSubject.birthplace": "Ville de Québec", "credentialSubject.gender": "Féminin", "credentialSubject.fatherFullName": "Nom du père", "credentialSubject.motherFullName": "Nom de la mère" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.