Costa Rica Credentials

The cr-vc-sdk extends the base VC SDK with Costa Rica-specific credential types. Combined with cr-vc-schemas for JSON-LD contexts.

Install

Terminal
 npm install @attestto-com/cr-vc-sdk @attestto-com/cr-vc-schemas 

Available credential types

The following CR-specific credential types are supported:

  • DrivingLicense — Costa Rica driver's license with license class, restrictions, and validity.
  • TheoreticalTestResult — Driving theory exam result with score, passing threshold, and exam center.
  • MedicalCertificate — Medical fitness certificate for driving or professional licensing.
  • VehicleInspection — RTV (Revisión Técnica Vehicular) inspection result with pass/fail and findings.
  • ProfessionalLicense — Colegio-issued professional license (engineering, medicine, law, etc.).
  • IdentityCredential — Cédula-based identity attestation.

Schema plugins

The @attestto-com/cr-vc-schemas package provides a SchemaPlugin for each credential type. Each plugin injects the correct JSON-LD context URI.

Available schema plugins
 import {
  drivingLicenseSchema,
  theoreticalTestSchema,
  medicalCertSchema,
  vehicleInspectionSchema,
  professionalLicenseSchema,
  identityCredentialSchema,
} from '@attestto-com/cr-vc-schemas' 

Issuing a DrivingLicense

Full example using cr-vc-sdk with the driving license schema:

issue-driving-license.ts
 import { VCIssuer, generateKeyPair } from '@attestto-com/cr-vc-sdk'
import { drivingLicenseSchema } from '@attestto-com/cr-vc-schemas'

const keys = generateKeyPair()

const issuer = new VCIssuer({
  did: 'did:web:cosevi.go.cr',
  privateKey: keys.privateKey,
}).use(drivingLicenseSchema)

const vc = await issuer.issue({
  type: 'DrivingLicense',
  subjectDid: 'did:web:holder.example.com',
  claims: {
    fullName: 'Maria Rodriguez Vargas',
    licenseClass: 'B1',
    restrictions: [],
    issueDate: '2026-03-15',
    expiryDate: '2032-03-15',
  },
  expirationDate: '2032-03-15T23:59:59Z',
})

console.log(vc['@context'])
// ['https://www.w3.org/2018/credentials/v1', 'https://schemas.attestto.com/cr/driving-license/v1']

console.log(vc.type)
// ['VerifiableCredential', 'DrivingLicense'] 

Issuing a TheoreticalTestResult

issue-test-result.ts
 import { theoreticalTestSchema } from '@attestto-com/cr-vc-schemas'

issuer.use(theoreticalTestSchema)

const testResult = await issuer.issue({
  type: 'TheoreticalTestResult',
  subjectDid: 'did:web:student.example.com',
  claims: {
    score: 87,
    passingThreshold: 80,
    passed: true,
    examCenter: 'COSEVI San Jose',
    examDate: '2026-04-10',
  },
}) 

cr-vc-sdk vs vc-sdk

The cr-vc-sdk package re-exports everything from vc-sdk and adds CR-specific convenience methods. You can use either package — the difference is that cr-vc-sdk includes CR type definitions out of the box.

💡
Full type definitions. For the complete list of properties on each credential type, see the CR VC Schemas specification.

Next steps