diff --git a/credentials/utopia-ambulance-driver/badge.svg b/credentials/utopia-ambulance-driver/badge.svg new file mode 100644 index 0000000..4a242e3 --- /dev/null +++ b/credentials/utopia-ambulance-driver/badge.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UTOPIA DMV + + + + + {{credentialSubject.name}} + + + + + AMBULANCE DRIVER + + + + + diff --git a/credentials/utopia-ambulance-driver/build.js b/credentials/utopia-ambulance-driver/build.js new file mode 100644 index 0000000..7e1fb23 --- /dev/null +++ b/credentials/utopia-ambulance-driver/build.js @@ -0,0 +1,18 @@ +import fs from 'node:fs'; +import path from 'node:path'; + +const svgPath = path.join(import.meta.dirname, 'badge.svg'); +const jsonPath = path.join(import.meta.dirname, 'credential.json'); + +const svgContent = fs.readFileSync(svgPath, 'utf8'); +// put SVG on a single line and remove excess whitespace +const minifiedSvg = svgContent + .replace(/\r?\n|\r/g, ' ') + .replace(/\s{2,}/g, ' ') + .replace(/>\s+<') + .trim(); + +// add the SVG as the `template` value of the first `renderMethod` property +const json = JSON.parse(fs.readFileSync(jsonPath, 'utf8')); +json.renderMethod[0].template = minifiedSvg; +fs.writeFileSync(jsonPath, JSON.stringify(json, null, 2) + '\n'); diff --git a/credentials/utopia-ambulance-driver/credential.json b/credentials/utopia-ambulance-driver/credential.json new file mode 100644 index 0000000..5a22fda --- /dev/null +++ b/credentials/utopia-ambulance-driver/credential.json @@ -0,0 +1,52 @@ +{ + "@context": [ + "https://www.w3.org/ns/credentials/v2", + "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json", + "https://w3id.org/vc/render-method/v2rc1" + ], + "id": "urn:uuid:f47ac10b-58cc-4372-a567-0e02b2c3d479", + "type": [ + "VerifiableCredential", + "OpenBadgeCredential" + ], + "name": "Ambulance Driver Certificate", + "description": "Utopia Ambulance Driver Certificate.", + "renderMethod": [ + { + "name": "Utopia Ambulance Driver Certificate", + "type": "SvgRenderingTemplate2024", + "mediaType": "image/svg+xml", + "template": " UTOPIA DMV {{credentialSubject.name}} AMBULANCE DRIVER " + } + ], + "issuer": { + "id": "https://www.utopia-dmv.example", + "type": [ + "Profile" + ], + "name": "Utopia Department of Motor Vehicles" + }, + "validFrom": "2026-01-15T00:00:00Z", + "validUntil": "2028-01-14T23:59:59Z", + "credentialSubject": { + "id": "urn:uuid:c9a6a3b2-1d4e-4f5a-8b6c-7e8f9a0b1c2d", + "type": "AchievementSubject", + "name": "Alex Rivera", + "achievement": { + "id": "urn:uuid:a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "type": [ + "Achievement" + ], + "achievementType": "Certificate", + "name": "Ambulance Driver Certificate", + "description": "Certifies the holder is authorized to operate an ambulance under applicable motor vehicle laws.", + "criteria": { + "narrative": "The holder has completed a certified ambulance driver training program, passed a written knowledge examination, and met all medical fitness requirements as prescribed by applicable state regulations." + }, + "image": { + "id": "https://examples.vcplayground.org/credentials/utopia-ambulance-driver/image.png", + "type": "Image" + } + } + } +} diff --git a/credentials/utopia-ambulance-driver/image.png b/credentials/utopia-ambulance-driver/image.png new file mode 100644 index 0000000..ece682e Binary files /dev/null and b/credentials/utopia-ambulance-driver/image.png differ diff --git a/credentials/utopia-ambulance-driver/image.svg b/credentials/utopia-ambulance-driver/image.svg new file mode 100644 index 0000000..92af5d0 --- /dev/null +++ b/credentials/utopia-ambulance-driver/image.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/credentials/utopia-ambulance-driver/queries.json b/credentials/utopia-ambulance-driver/queries.json new file mode 100644 index 0000000..fdd78ed --- /dev/null +++ b/credentials/utopia-ambulance-driver/queries.json @@ -0,0 +1,19 @@ +{ + "web": { + "VerifiablePresentation": { + "query": [{ + "type": "QueryByExample", + "credentialQuery": [{ + "reason": "An Ambulance Driver Certificate is required.", + "example": { + "@context": [ + "https://www.w3.org/ns/credentials/v2", + "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json" + ], + "type": "OpenBadgeCredential" + } + }] + }] + } + } +}