Skip to content

Credential issuer metadata

It is possible to utilize credential description data stored in Document Rails to semi-automatically generate OpenID for Verifiable Credential Issuance credential issuer metadata.

The metadata includes information on how wallets should interact with your issuance service, and which credentials are supported (including localized information about credentials themselves).

Regular OID4VCI flow

Manually generating OID4VCI credential issuer metadata is not required when utilizing the regular OID4VCI flow, as Document Rails handles the protocol entirely on its own.

Usage

Make sure you have already initialized the credentials that you plan to include in the OID4VCI credential issuer metadata.

These credentials must include information about they should be represented within the resulting document.

import {
    createCredential,
    CredentialVarType,
    StringifiedCredentialKind
} from "@vaultie/document-rails";

const response = await createCredential(
    client,
    accessToken,
    organizationId,
    {
        credential_kind: StringifiedCredentialKind.SDJWT,
        credential_type: "https://example.com/exampleCredential",
        variables: {
            givenName: {
                type: CredentialVarType.String,
                // These fields are optional, but without them the resulting OID4VCI
                // credential issuer metadata is not complete.
                oid4vci_configuration: {
                    display: [
                        {
                            name: "First name",
                            locale: "en",
                        },
                        {
                            name: "Prénom",
                            locale: "fr",
                        },
                    ],
                },
            },

            familyName: {
                type: CredentialVarType.String,
                oid4vci_configuration: {
                    display: [
                        {
                            name: "Last name",
                            locale: "en",
                        },
                        {
                            name: "Nom",
                            locale: "fr",
                        },
                    ],
                },
            }
        },
        // This field is required for a credential to be eligible for inclusion
        // in the OID4VCI credential issuer metadata.
        oid4vci_configuration: {
            // Credential configuration identifier is required.
            id: "com.example.example_credential_sd_jwt",

            // Other fields within this object are optional.
            display: [
                {
                    name: "Test Credential",
                    locale: "en",
                },
            ],
        }
    }
);

After generating credentials (or identifying existing ones), you can send a request to Document Rails to generate the OID4VCI credential issuer metadata:

import { generateOID4VCICredentialIssuerMetadata } from "@vaultie/document-rails";

const response = await generateOID4VCICredentialIssuerMetadata(
    client,
    accessToken,
    organizationId,
    {
        // These fields are required.
        credential_issuer: "https://example.com",
        credential_endpoint: "https://example.com/credential",

        // Credentials to generate supported credential configurations from.
        //
        // Up to 20 credentials can be provided within a single request.
        credentials: [credential.id],

        // All other fields are optional.
        nonce_endpoint: "https://example.com/nonce",
        deferred_credential_endpoint: "https://example.com/deferredCredentialEndpoint",
        notification_endpoint: "https://example.com/notification",
        display: [
            {
                name: "Test Credential Issuer",
                locale: "en",
            },
        ]
    },
);