Quickstart · 5 minutes

Issue a Credential

Generate keys, issue a W3C Verifiable Credential, and verify it — all in under 20 lines of code. No server, no blockchain, no configuration.

Install

Terminal
 npm install @attestto-com/vc-sdk 

The complete flow

This script creates a key pair, issues a credential, and verifies it:

quickstart.ts
 import { VCIssuer, VCVerifier, generateKeyPair } from '@attestto-com/vc-sdk'

// 1. Generate Ed25519 keys
const keys = generateKeyPair()

// 2. Create an issuer with your DID
const issuer = new VCIssuer({
  did: 'did:web:my-org.example.com',
  privateKey: keys.privateKey,
})

// 3. Issue a credential
const vc = await issuer.issue({
  type: 'UniversityDegree',
  subjectDid: 'did:web:student.example.com',
  claims: {
    degree: 'Computer Science',
    level: 'Bachelor',
  },
  expirationDate: '2030-01-01T00:00:00Z',
})

console.log('Issued:', JSON.stringify(vc, null, 2))

// 4. Verify it
const verifier = new VCVerifier()
const result = await verifier.verifyWithKey(vc, keys.publicKey, 'Ed25519', {
  expectedType: 'UniversityDegree',
  expectedIssuer: 'did:web:my-org.example.com',
})

console.log('Valid:', result.valid)     // true
console.log('Checks:', result.checks)  // detailed check results 

Run it

Terminal
 npx tsx quickstart.ts 

You'll see the full W3C Verifiable Credential JSON with proof, followed by the verification result.

What you get

The issued credential follows the W3C VC Data Model v2.0:

Output — Verifiable Credential
 {
  "@context": ["https://www.w3.org/2018/credentials/v1"],
  "id": "urn:uuid:...",
  "type": ["VerifiableCredential", "UniversityDegree"],
  "issuer": "did:web:my-org.example.com",
  "issuanceDate": "2026-04-15T...",
  "credentialSubject": {
    "id": "did:web:student.example.com",
    "degree": "Computer Science",
    "level": "Bachelor"
  },
  "proof": {
    "type": "Ed25519Signature2020",
    "verificationMethod": "did:web:my-org.example.com#key-1",
    "proofValue": "..."
  }
} 
💡
Zero native dependencies. The SDK uses @noble/curves for pure JavaScript Ed25519 and ES256 cryptography. Works everywhere Node.js runs — no OpenSSL, no native modules.

Key concepts

  • DID — Decentralized Identifier. Your issuer identity. Works with any DID method (did:web, did:sns, did:key).
  • VC — Verifiable Credential. A cryptographically signed claim about a subject.
  • Proof — The digital signature that makes the credential verifiable.
  • Schema Plugin — Extend the SDK with domain-specific credential types and JSON-LD contexts.

Next steps