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 (the frontend sets it), trust unit, fiatThe unit of every fee on this schema. The frontend creates schemas priced in VNA, and keeps the fee-bearing actions of schemas priced in another asset disabled, with a notice.
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: set the onboarding modes, the digest algorithm and the validity periods in days, paste the JSON schema (validated in the browser, bounded by the network's size limit), and sign. The anchor publishes the schema credential, type metadata and AnonCreds schema within a block or two.

The Create New Credential Schema formThe Create New Credential Schema formClick anywhere or press Esc to close

The schema then appears on the ecosystem page with its modes and figures, and opens on its own page with the JSON schema and its activity.

The ecosystem page with its first credential schemaThe ecosystem page with its first credential schemaClick anywhere or press Esc to close
A credential schema pageA credential schema pageClick anywhere or press Esc to close

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​