Skip to content

Conversation

@meiersi-da
Copy link
Contributor

@meiersi-da meiersi-da commented Dec 16, 2025

Draft code for a CN credential standard built in a similar fashion to how the CN token standard is built. The CIP text for it has not yet been written. The high-level idea is that:

  • The standard defines APIs for

    • creating and updating credentials in a registry (see the CredentialRegistry interface)
    • querying the credentials using an off-ledger API, which also supports filtering (see the OpenAPI spec)
    • fetching credential in Daml code (see the CredentialRecord interface)
  • The SVs run a credential registry as part of their Amulet Name Service (see the AnsCredentialRegistry implementation of the interface)

    • SVs protect their resources by requiring a refresh of the credential records every 90 days. Thus the traffic for the refresh protects them from somebody spamming the ACS of the DSO party
    • That registry is also used to solve the off-ledger API discovery problem in token standard.
  • Third-parties are welcome to run registries as well. Their off-ledger APIs can be discovered in the ANS registry from a self-published credential by their party with a well-known key.

  • Concrete sets of claims for specific use-cases are defined as part of additional CIPs, as outlined in https://docs.google.com/presentation/d/1PXVwQU98dPo4hhIrXt1U5pAutWa4YUlvS61xIiBMhgc/edit?slide=id.g328343e708d_0_468#slide=id.g328343e708d_0_468

Pull Request Checklist

Cluster Testing

  • If a cluster test is required, comment /cluster_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a hard-migration test is required (from the latest release), comment /hdm_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release notes.
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n
  • Include a screenshot for frontend-related PRs - see README or use your favorite screenshot tool

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

@meiersi-da meiersi-da changed the title DRAFT: credential registry standard API DRAFT: CN credential standard Dec 16, 2025
deriving (Eq, Show)

-- | A view of a credential record stored in a credential registry.
data CredentialRecordView = CredentialRecordView with
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: make this a CredentialView and remove the usage of Record in this file.

@meiersi-da meiersi-da force-pushed the meiersi/std/credential-registry branch from e87590c to 8d02ed0 Compare January 9, 2026 08:47
format: date-time
required: false
description: |
If provided, only return credential records that are valid at the given time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the semantics if I don't specify a time? is it validAsOf=now or is it all credentials even ones no longer active? If so, I assume I wonder if you should jus tbe able to specify a range in the query as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming you can query stuff that is no longer active what guarantees are registries expected to provide? Probably up to them to decide how long they want to store historic data?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point on range. Will adjust.

I would expect that the queries should return contracts in their ACS.

- in: query
name: holder
schema:
type: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the motivation for not supporting an array here? Bulk queries across multiple holders seem potentially useful

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. I was worried that the query plans would not be good enough. However it should be OK. will adjust.

Copy link
Contributor Author

@meiersi-da meiersi-da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add notes from self-review

and querying credential records.
version: 1.0.0
paths:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: add bulk retrieval APIs for explorers

$ref: "#/components/schemas/CredentialRegistryLimits"
required:
- adminId
- supportedVersions
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: switch to the supportedApis construction used in the token standard for increased flexibility

- in: query
name: holder
schema:
type: string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. I was worried that the query plans would not be good enough. However it should be OK. will adjust.

format: date-time
required: false
description: |
If provided, only return credential records that are valid at the given time.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point on range. Will adjust.

I would expect that the queries should return contracts in their ACS.

-- ^ The time from which this credential is valid.
validUntil : Optional Time
-- ^ The time until which this credential is valid.
meta : Metadata
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: also limit maximal size of metadata

explode: true
required: false
description: |
Only return credential records issued by one of the specified issuers.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: allow filtering for self-published tokens; e.g., using self as an issuer, or by adding a separate flag that allows self-published tokens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants