Skip to main content
Version: v4

Define a credential schema

Author the JSON schema​

A credential schema's shape is a JSON Schema (draft 2020-12) whose credentialSubject lists the claims. Give it a title (it becomes the credential's name in wallets) and a description. Use VPR_CHAIN_ID and VPR_CREDENTIAL_SCHEMA_ID as placeholders in $id; the registry replaces them.

{
"$id": "vpr:verana:VPR_CHAIN_ID:cs:VPR_CREDENTIAL_SCHEMA_ID",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "MembershipCredential",
"description": "Membership of the Example Association.",
"type": "object",
"properties": {
"credentialSubject": {
"type": "object",
"properties": {
"id": { "type": "string", "format": "uri" },
"memberName": { "type": "string", "minLength": 1, "maxLength": 256 },
"memberId": { "type": "string", "minLength": 1, "maxLength": 64 },
"since": { "type": "string", "format": "date" }
},
"required": ["memberName", "memberId", "since"]
}
}
}

The five Essential Credential Schemas are good models. Keep id as a property only when the subject is a DID (a service, an organisation); credentials for people carry no subject DID.

Choose the policy​

SettingOptionsThink about
Issuer onboarding modeopen, ecosystem onboarding process, grantor onboarding processWho may issue. Open is right when anyone may describe themselves; validation when the ecosystem vouches.
Verifier onboarding modesameWho may ask people for this credential. Open is common for low-sensitivity credentials.
Holder onboarding modeissuer onboarding process, permissionlessIssuer onboarding process gives each holder an entry the issuer can revoke; required for credentials issued to services. Permissionless for credentials issued to people.
Validity periodsdays per role, zero for noneHow often grantors, issuers, verifiers and holders must renew
Pricing assetnative coin (frontend today), trust unit, fiatThe unit of every fee on this schema
Digest algorithmsha384 or sha512Used to anchor public credentials

Everything except the validity periods is immutable; the frontend warns before you sign.

Steps​

Ecosystem page, Credential schemas, New schema: paste the JSON schema (validated in the browser, bounded by the network's size limit), set the modes, periods and algorithm, sign. The anchor publishes the schema credential, type metadata and AnonCreds schema within a block or two.

Verify​

curl -s https://idx.testnet.verana.network/v4/credential-schema/get/<id> | jq '{id, ecosystem_id, issuer_onboarding_mode, verifier_onboarding_mode, holder_onboarding_mode, pricing_asset_type, pricing_asset, digest_algorithm}'
curl -s https://idx.testnet.verana.network/v4/credential-schema/js/<id> | jq .title

Next​