W3C
Document Rails can verify W3C V2 credentials and presentations against a list of trusted DIDs.
When verifying credentials of this kind, Document Rails outputs expanded JSON-LD nodes instead of raw field names, preserving context-specific representation of provided documents and allowing for delegation of JSON-LD handling from your application.
Output
| Name | Value | Description |
|---|---|---|
kind | w3c | Credential kind identifier |
id | Optional string value | Credential identifier |
issuer | String value | Value of the issuer field within the credential |
not_after_ts | Optional UNIX timestamp | Date, after which the certificate should not be used |
not_before_ts | Optional UNIX timestamp | Date, before which the certificate should not be used |
types | Array of strings | Credential types (W3C credentials may have multiple credential types) |
credential_subject | Credential subject | Parsed credential subject |
Credential subject
| Name | Value | Description |
|---|---|---|
id | Optional string value | Credential subject identifier |
types | Array of strings | Credential subject types (W3C credentials may have multiple credential subject types) |
properties | JSON object | Credential subject properties |
Nonce presence
Nonce value is present only if it was provided as a challenge field within the verifiable presentation proof.
For verifiable credentials and for verifiable presentations without the challenge field, the nonce field is going to be missing.
Example output
{
"nonce": "example-value",
"credentials": [
{
"kind": "w3c",
"id": "http://university.example/credentials/3732",
"issuer": "did:key:z6MkoYwkqx5NwJdas1x3hfsQN8ouETNrvhsKmYD3PUwQTWcg",
"types": [
"https://www.w3.org/2018/credentials#VerifiableCredential",
"https://www.w3.org/ns/credentials/examples#ExampleDegreeCredential"
],
"credential_subject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"properties": {
"https://www.w3.org/ns/credentials/examples#degree": {
"https://schema.org/name": "Bachelor of Science and Arts"
}
}
}
}
]
}
Example
import { verify, OptionalityFlag, VerifyInputKind } from "@vaultie/document-rails";
const response = await verify(
client,
accessToken,
organizationId,
{
input: {
kind: VerifyInputKind.W3CVC,
data: {
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
}
},
"issuer": "did:key:z6MkoYwkqx5NwJdas1x3hfsQN8ouETNrvhsKmYD3PUwQTWcg",
"validFrom": "2010-01-01T00:00:00Z",
"validUntil": "2030-01-01T00:00:00Z",
"proof": {
"@context": "https://w3id.org/security/suites/ed25519-2020/v1",
"type": "Ed25519Signature2020",
"created": "2025-03-12T13:11:22.863Z",
"verificationMethod": "did:key:z6MkoYwkqx5NwJdas1x3hfsQN8ouETNrvhsKmYD3PUwQTWcg#z6MkoYwkqx5NwJdas1x3hfsQN8ouETNrvhsKmYD3PUwQTWcg",
"proofPurpose": "assertionMethod",
"proofValue": "z2hYk2iYeCsitk88xZHZBT5TiVEXmLoHarVxkTWRVkLWV4giYge3gLmgthYGEZiJvXtEJZnpj9BVeFpuLVn6cxrEC"
}
},
},
trust_registries: [trustRegistryId],
check_expiration_date: false,
check_revocation_status: OptionalityFlag.Ignored
}
);