401. It also shows how to pass the scope to your token route.
How a scope moves through the flow
- Your site publishes a named scope in
kya-profile.json. - A protected page returns that scope in
KYA-Disclosure-Scope. - The agent gets a credential minted for the scope and sends the same reference to your token route.
- 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.
Fields a scope can list
These are the details a credential can carry. The technical name is what a KYA profile anddisclosed_fields use.
View all person fields
View all person fields
View all business fields
View all business fields
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, likeemailoraddress.postal_code, and recognition hashes, likehashes.email. -
HASH_ONLYshares only recognition hashes. Each requested field is swapped for its hash:email→hashes.emailgiven_name→hashes.nameaddress.*→hashes.address
address.usps_validated,address.address_type, and details with no hash (birthdate,birth_year, residency).
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, respond401 with a KYA-Disclosure-Scope header naming the scope:
<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 toverify. 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_VIOLATIONif it shares any field outside the selected scope’sfields. - 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.
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 asgiven_name, hashes.email or address.postal_code. List each value you need.
A scope that lists only
address does not cover address.postal_code.Profile identity
Each scope
For how these fields are carried inside the credential, see Disclosures in the Credential Format Reference.