Skip to main content

Overview

The credential event is triggered when a credential is accepted or rejected by the user. The event includes the full W3C Verifiable Credential with cryptographic proofs, enabling verification and audit.

Example Payload

{
  "eventType": "credential",
  "requestId": "68c42ec3e47c9a7f9241e0ba",
  "internalId": "req_internal_001",
  "issuerDid": "did:via:org-abc123",
  "user": {
    "contact": "+1234567890",
    "did": "did:via:user-xyz789",
    "internalId": "user_98765"
  },
  "decisionDate": "2024-01-15T18:30:00.000Z",
  "action": "accept",
  "credential": {
    "@context": [
      "https://www.w3.org/2018/credentials/v1",
      "https://humanos.id/credentials/v1"
    ],
    "id": "urn:uuid:cred_abc123def456",
    "type": ["VerifiableCredential", "ConsentCredential"],
    "issuer": "did:via:org-abc123",
    "validFrom": "2024-01-15T18:30:00.000Z",
    "validUntil": "2025-01-15T18:30:00.000Z",
    "credentialSubject": {
      "id": "did:via:user-xyz789",
      "data": [
        {
          "label": "Privacy Policy Agreement",
          "type": "string",
          "value": "I agree to the collection and processing of my personal data.",
          "hash": "sha256:abc123..."
        }
      ]
    },
    "proof": {
      "type": "DataIntegrityProof",
      "cryptosuite": "eddsa-rdfc-2022",
      "proofPurpose": "assertionMethod",
      "verificationMethod": "did:via:user-xyz789#key-1",
      "proofValue": "z3hF9vZ...",
      "actionType": "accept",
      "actionProof": "z4gH2wX...",
      "createdAt": "2024-01-15T18:30:00.000Z"
    },
    "getEndpoint": "/v1/credentials/cred_abc123def456"
  }
}

Base Fields

All credential events include these common fields:
FieldTypeRequiredDescription
eventTypestringYesAlways "credential"
requestIdstringYesRequest identifier
internalIdstringNoYour internal identifier for the request
issuerDidstringYesDID of the organization/issuer
userobjectYesObject containing user identity fields
decisionDateDateYesTimestamp when the credential decision was made

User Object

FieldTypeRequiredDescription
contactstringYesUser’s contact information (phone or email)
didstringYesDID of the user/subject
internalIdstringNoYour internal identifier for the user

Credential-Specific Fields

FieldTypeRequiredDescription
actionstringYesUser’s action: "accept" or "reject"
credentialW3CVerifiableCredentialYesFull W3C Verifiable Credential with proofs

Action Types

ActionDescription
acceptUser accepted and signed the credential
rejectUser explicitly rejected the credential

W3C Verifiable Credential Structure

The credential field contains a full W3C VC 2.0 compliant credential:
FieldTypeRequiredDescription
@contextstring[] or stringYesJSON-LD context(s)
idstringYesUnique credential identifier
typestring[] or stringYesCredential type(s)
issuerstringYesDID of the issuer
validFromstringNoStart of validity period (ISO 8601)
validUntilstringNoEnd of validity period (ISO 8601)
credentialSubjectCredentialSubjectYesThe credential data and subject
proofW3CProof or W3CProof[]NoCryptographic proof(s)
getEndpointstringNoAPI endpoint to retrieve full credential details

Credential Subject

The credentialSubject contains the actual credential data:
FieldTypeRequiredDescription
idstringNoDID of the subject
dataMandateDataDto[]YesArray of data fields

Mandate Data Structure

Each item in the data array follows this structure:
FieldTypeRequiredDescription
labelstringYesHuman-readable label for the field
typestringYesData type: string, number, boolean, object, array, date, pdf
valueanyYesThe actual value
hashstringNoHash of the value for integrity verification
descriptionstringNoAdditional description
hiddenbooleanNoWhether the field should be hidden
fieldsMandateDataDto[]NoNested fields (for object type)

W3C Proof Structure

The proof field contains the cryptographic proof following W3C Data Integrity:
FieldTypeRequiredDescription
typestringYesProof type (e.g., "DataIntegrityProof")
cryptosuitestringYesCryptographic suite used
proofPurposestringYesPurpose (e.g., "assertionMethod")
verificationMethodstringYesDID URL of the verification key
proofValuestringYesThe cryptographic proof value
actionTypestringYesAction taken: "accept" or "reject"
actionProofstringYesProof of the action
createdAtstringYesTimestamp of proof creation (ISO 8601)