Credentials API

GET /agents/:pda/credentials

List Verifiable Credentials attached to an agent. Public — no auth required.

Query: type, active
POST /agents/:pda/credentials/verify

Submit a Verifiable Credential for on-chain verification. Requires wallet auth.

Request Body

Provide one of the following fields (not both):

JSON Body
{
  "credentialUrl": "https://auditor.example/vc/123.json"   // URL to a hosted Verifiable Credential
}

OR

JSON Body (inline)
{
  "credential": { ... }   // Inline W3C Verifiable Credential JSON object
}

Note: Only the agent owner can submit credentials. The wallet used for auth must match the agent's owner.

Proof verification is supported. When the issuer DID is registered in the trusted issuer registry, Ed25519Signature2020 proofs are cryptographically verified and proofVerified returns true. Trusted issuer management is handled by protocol administrators.

Example Responses

GET /agents/:pda/credentials

Response
{
  "pda": "BKq8rN4EwJQG3R9FnLhSGqJ2tNkh8cVRxvNApj7hbfQM",
  "total": 2,
  "credentials": [
    {
      "type": "SecurityAuditCredential",
      "issuer": "did:sol:AuditorPubkey123...",
      "credential_url": "https://auditor.example/vc/123.json",
      "vc_hash": "a1b2c3...",
      "valid_from": "2026-01-01T00:00:00Z",
      "valid_until": "2027-01-01T00:00:00Z",
      "structurally_valid": true,
      "proof_verified": true,
      "indexed_at": "2026-03-10T08:00:00.000Z"
    },
    {
      "type": "CapabilityCredential",
      "issuer": "did:sol:CertifierPubkey456...",
      "credential_url": "https://certifier.example/vc/456.json",
      "vc_hash": "d4e5f6...",
      "valid_from": "2026-02-15T00:00:00Z",
      "valid_until": null,
      "structurally_valid": true,
      "proof_verified": false,
      "indexed_at": "2026-03-12T10:30:00.000Z"
    }
  ]
}

POST /agents/:pda/credentials/verify

Response
{
  "structurallyValid": true,
  "proofVerified": true,
  "type": "SecurityAuditCredential",
  "issuer": "did:sol:AuditorPubkey123...",
  "vcHash": "a1b2c3d4...",
  "checks": [
    { "check": "context", "passed": true, "detail": "Valid W3C VC context" },
    { "check": "type", "passed": true, "detail": "Contains VerifiableCredential type" },
    { "check": "subject", "passed": true, "detail": "Subject matches agent DID" },
    { "check": "temporal", "passed": true, "detail": "Credential is within validity period" },
    { "check": "proof_present", "passed": true, "detail": "Proof section present" },
    { "check": "proof_verified", "passed": true, "detail": "Ed25519Signature2020 verified — issuer in trusted registry" }
  ]
}