Skip to main content
Ask for only what the current step needs. A sign-in step might request a hashed email, while checkout might request a name and address. Your published KYA profile defines those fields, and the verifier refuses a credential that shares anything outside the selected scope. This page covers two steps of the site setup: publishing your profile, and answering protected pages with 401. It also shows how to pass the scope to your token route.

How a scope moves through the flow

  1. Your site publishes a named scope in kya-profile.json.
  2. A protected page returns that scope in KYA-Disclosure-Scope.
  3. The agent gets a credential minted for the scope and sends the same reference to your token route.
  4. Your token route resolves the scope from the published profile and passes it to verify.

Publish your profile

Every site that accepts KYA credentials publishes this file. Host it at /.well-known/kya-profile.json on your domain. Each entry in scopes is one step and lists the exact fields it may read.
Every field is required. The SDK refuses a profile with a missing or wrongly typed field. The Profile field reference below describes each one.

Fields a scope can list

These are the details a credential can carry. The technical name is what a KYA profile and disclosed_fields use.
When a platform mints a business credential, the business details go in disclosed_fields and the acting person’s details go in actor_disclosed_fields, using the person field names.

Readable values or hashes

A credential can share a detail in one of two ways. The platform sets the mode when it mints:
  • CLEARTEXT_AND_HASH (default) shares the requested paths. These can be readable values, like email or address.postal_code, and recognition hashes, like hashes.email.
  • HASH_ONLY shares only recognition hashes. Each requested field is swapped for its hash:
    • email → hashes.email
    • given_name → hashes.name
    • address.* → hashes.address
    Left out: address.usps_validated, address.address_type, and details with no hash (birthdate, birth_year, residency).
A recognition hash is sha256: followed by a hex digest of a normalized value. A site can compute the same hash from its own records and match a customer without ever receiving the value.

Ask for a scope

When an agent with no token calls a protected page, respond 401 with a KYA-Disclosure-Scope header naming the scope:
The reference is <profile_id>#<scope_name>. The agent reads your profile, gets a credential minted for that scope, and sends the same reference as scope with its credential.

Enforce the scope

Load your profile, look up the scope the agent sent, and pass it to verify. If the reference doesn’t match a scope in your profile, refuse with UNKNOWN_DISCLOSURE_SCOPE.
The KYA SDK is coming soon. The packages aren’t published yet, so the code on the rest of this page won’t run until they are.
oauthError and tokenResponse are the helpers from the SDK quickstart. An unknown scope gets 400 with invalid_scope.

What the verifier enforces

  • A credential is refused with SCOPE_VIOLATION if it shares any field outside the selected scope’s fields.
  • The whole credential is refused. The SDK never keeps the allowed fields and drops the rest, so you can only read what your published step says you read.
  • A field listed by the scope may still be absent if Baselayer doesn’t have a value for it.
  • Check required fields after verification, before you make your site’s decision.
If you call verify without a scope, the SDK does not check the shared fields against any list.

Read the fields

report.credential.disclosed holds the shared fields as { path: value }. To show a field to a person, claimLabel(vct, path, "en-US") turns a path into a readable label, such as “Email address (hashed)” for hashes.email. It returns null when there is no label.

Profile field reference

Field paths are dotted paths to single values, such as given_name, hashes.email or address.postal_code. List each value you need.
A scope that lists only address does not cover address.postal_code.
For every field a credential can share, in plain words, see Fields a scope can list.

Profile identity

Each scope

For how these fields are carried inside the credential, see Disclosures in the Credential Format Reference.