Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions credentials/utopia-ambulance-driver/badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions credentials/utopia-ambulance-driver/build.js
Original file line number Diff line number Diff line change
@@ -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+</g, '><')
.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');
52 changes: 52 additions & 0 deletions credentials/utopia-ambulance-driver/credential.json
Original file line number Diff line number Diff line change
@@ -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": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" width=\"512\" height=\"512\"><defs><filter id=\"hexShadow\" x=\"-20%\" y=\"-20%\" width=\"140%\" height=\"140%\"><feDropShadow dx=\"0\" dy=\"4\" stdDeviation=\"8\" flood-color=\"rgba(0,0,0,0.15)\"/></filter><linearGradient id=\"hexGradient\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\"><stop offset=\"0%\" stop-color=\"#ffffff\"/><stop offset=\"100%\" stop-color=\"#f5f8ff\"/></linearGradient></defs><polygon points=\"256,20 472,138 472,374 256,492 40,374 40,138\" fill=\"url(#hexGradient)\" stroke=\"#1e3a8a\" stroke-width=\"4\" filter=\"url(#hexShadow)\"/><polygon points=\"256,50 442,158 442,354 256,462 70,354 70,158\" fill=\"none\" stroke=\"#dc2626\" stroke-width=\"2\" opacity=\"0.55\"/><g transform=\"translate(256, 256)\"><!-- 1. Ambulance icon - 3x (72x72), top y=-135 to y=-63 --><g transform=\"translate(-36, -135) scale(3)\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"#dc2626\" d=\"M 10 10 L 6 10\"/><path stroke=\"#1e3a8a\" d=\"M 14 18 L 14 6 C 14 4.895432 13.104569 4 12 4 L 4 4 C 2.895431 4 2 4.895432 2 6 L 2 17 C 2 17.552284 2.447715 18 3 18 L 5 18\"/><path stroke=\"#1e3a8a\" d=\"M 19 18 L 21 18 C 21.552284 18 22 17.552284 22 17 L 22 13.72 C 21.999674 13.289761 21.724194 12.907955 21.316 12.772 L 19.393 12.131 C 19.141373 12.04696 18.933451 11.866378 18.815001 11.629 L 17.275999 8.553 C 17.106737 8.214271 16.760666 8.000202 16.382 8 L 14 8\"/><path stroke=\"#dc2626\" d=\"M 8 8 L 8 12\"/><path stroke=\"#1e3a8a\" d=\"M 9 18 L 15 18\"/><path stroke=\"#1e3a8a\" d=\"M 19 18 C 19 19.10457 18.10457 20 17 20 C 15.895431 20 15 19.10457 15 18 C 15 16.89543 15.895431 16 17 16 C 18.10457 16 19 16.89543 19 18 Z\"/><path stroke=\"#1e3a8a\" d=\"M 9 18 C 9 19.10457 8.104569 20 7 20 C 5.895431 20 5 19.10457 5 18 C 5 16.89543 5.895431 16 7 16 C 8.104569 16 9 16.89543 9 18 Z\"/></g><!-- 2. UTOPIA DMV - ~40px gap below icon bottom (y=-63) --><text x=\"0\" y=\"-14\" text-anchor=\"middle\" fill=\"#6b7280\" font-family=\"Arial, sans-serif\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"3\"> UTOPIA DMV </text><!-- 3. Holder name - ~40px gap below issuer, in widest part of hex --><text x=\"0\" y=\"50\" text-anchor=\"middle\" fill=\"#1e3a8a\" font-family=\"Arial, sans-serif\" font-size=\"28\" font-weight=\"700\"> {{credentialSubject.name}} </text><!-- 4. AMBULANCE DRIVER - ~40px gap below name --><text x=\"0\" y=\"107\" text-anchor=\"middle\" fill=\"#dc2626\" font-family=\"Arial, sans-serif\" font-size=\"15\" font-weight=\"600\" letter-spacing=\"2.5\"> AMBULANCE DRIVER </text></g></svg>"
}
],
"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"
}
}
}
}
Binary file added credentials/utopia-ambulance-driver/image.png

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@applesnort cc: @BigBlueHat

We might want to update the image.png file here at some point.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bparth24 because?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the note, Parth. Agreed — I've tracked it as DB-725 (sub-issue of DB-723) so it doesn't get lost. I'll swap in proper artwork once the full EMSA certificate type set is finalized.

Mind dismissing your review so this can merge? Benjamin has already approved.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions credentials/utopia-ambulance-driver/image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions credentials/utopia-ambulance-driver/queries.json
Original file line number Diff line number Diff line change
@@ -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"
}
}]
}]
}
}
}