API Reference

This page contains the complete auto-generated API reference for the Issuer SDK. The API is organized by the role of each component.

Core Components

The primary entry points for creating and using the SDK.

Factory Functions


@the-hashgraph-group-ag/issuer / createCredentialIssuer

Function: createCredentialIssuer()

createCredentialIssuer<Handlers>(options): link:../interfaces/CredentialIssuer.md<Handlers>

Factory function to create a new credential issuer.

Type Parameters

Handlers

Handlers extends link:../interfaces/IssuanceHandler.md<object, object, object, object, object, object, string>[] = link:../interfaces/IssuanceHandler.md<object, object, object, object, object, object, string>[]

Parameters

options

link:../interfaces/IssuerOptions.md<Handlers>

The configuration options for the issuer

Returns

link:../interfaces/CredentialIssuer.md<Handlers>

A new instance of a CredentialIssuer with format-driven type inference

Typeparam

Handlers - Array of handler types that define supported credential formats


@the-hashgraph-group-ag/issuer / createCredentialIssuer

Function: createCredentialIssuer()

createCredentialIssuer<Handlers>(options): link:../interfaces/CredentialIssuer.md<Handlers>

Factory function to create a new credential issuer.

Type Parameters

Handlers

Handlers extends link:../interfaces/IssuanceHandler.md<object, object, object, object, object, object, string>[] = link:../interfaces/IssuanceHandler.md<object, object, object, object, object, object, string>[]

Parameters

options

link:../interfaces/IssuerOptions.md<Handlers>

The configuration options for the issuer

Returns

link:../interfaces/CredentialIssuer.md<Handlers>

A new instance of a CredentialIssuer with format-driven type inference

Typeparam

Handlers - Array of handler types that define supported credential formats

Unresolved include directive in modules/ROOT/pages/api-reference.adoc - include::../partials/api/functions/createPolicyEngine.adoc[]

Interface: CredentialIssuer<Handlers>

Main interface for credential issuance operations.

Typeparam

Handlers - Array of handler types that define supported credential formats

Type Parameters

Handlers

Handlers extends link:IssuanceHandler.md<object, object, object, object, object, object, string>[] = link:IssuanceHandler.md<object, object, object, object, object, object, string>[]

Methods

generateIssuanceRequest()

generateIssuanceRequest<Format>(request): Promise<link:SigningRequest.md<link:../type-aliases/UnsignedCredentialForFormat.md<Handlers, Format>, string[]>>

Generates an issuance request that can be signed externally. This prepares the unsigned credential and creates a signing request.

Type Parameters

======= Format

Format extends string

Parameters

======= request

link:CredentialIssuanceRequest.md<ClaimsForFormat<Handlers, Format>, CredentialOptionsForFormat<Handlers, Format>, Format>

The issuance request containing claims, format, and options

Returns

Promise<link:SigningRequest.md<link:../type-aliases/UnsignedCredentialForFormat.md<Handlers, Format>, string[]>>

A promise that resolves to a signing request containing the unsigned credential and proof signing request

Typeparam

Format - The format identifier (must match a handler’s FORMAT property)


issue()

issue<Format>(request): Promise<link:../type-aliases/IssuanceResult.md<CredentialResultForFormat<Handlers, Format>>>

Issues a verifiable credential based on the provided request. The format parameter determines which handler is used and what types are expected.

Type Parameters

======= Format

Format extends string

Parameters

======= request

link:CredentialIssuanceRequest.md<ClaimsForFormat<Handlers, Format>, CredentialOptionsForFormat<Handlers, Format>, Format>

The issuance request containing claims, format, and options

Returns

Promise<link:../type-aliases/IssuanceResult.md<CredentialResultForFormat<Handlers, Format>>>

A promise that resolves to a result object indicating success or failure

Typeparam

Format - The format identifier (must match a handler’s FORMAT property)

Unresolved include directive in modules/ROOT/pages/api-reference.adoc - include::../partials/api/interfaces/PolicyEngine.adoc[]

Handlers

Handlers are responsible for creating credentials in a specific format (e.g., LDP, JWT).


Class: LdpHandler<ClaimData, CredentialResult, PresentationResult, CredentialOptions, PresentationOptions, Format>

Handler for Linked Data Proof (LDP) verifiable credentials.

This handler processes issuance requests for LDP format credentials, generating signed credentials that conform to the W3C Verifiable Credentials Data Model with Linked Data Proofs.

Type Parameters

ClaimData

ClaimData extends object = object

CredentialResult

CredentialResult = link:../type-aliases/LdpCredential.md<ClaimDataWithId<ClaimData>>

PresentationResult

PresentationResult = LdpPresentation

CredentialOptions
PresentationOptions
Format

Format extends string = "ldp_vc"

Implements

  • link:../interfaces/IssuanceHandler.md<CredentialResult, PresentationResult, ClaimData, CredentialOptions, PresentationOptions, LdpCredential, Format>

Constructors

Constructor

new LdpHandler<ClaimData, CredentialResult, PresentationResult, CredentialOptions, PresentationOptions, Format>(options): LdpHandler<ClaimData, CredentialResult, PresentationResult, CredentialOptions, PresentationOptions, Format>

Creates a new LDP handler instance.

Parameters

======= options

Configuration options for the handler.

Returns

LdpHandler<ClaimData, CredentialResult, PresentationResult, CredentialOptions, PresentationOptions, Format>

Properties

FORMAT

readonly FORMAT: Format

Implementation of

FORMAT

readonly static FORMAT: "ldp_vc"

Methods

canHandle()

canHandle(format): boolean

Determines if this handler can process the specified format.

Parameters

======= format

string

The format identifier to check.

Returns

boolean

True if the format is ‘ldp_vc’, false otherwise.

Implementation of

handleCredential()

handleCredential(request, handlerOptions): Promise<CredentialResult>

Processes an LDP issuance request and generates a signed credential.

Parameters

======= request

link:../interfaces/CredentialIssuanceRequest.md<ClaimData, CredentialOptions, Format>

The issuance request containing claims and options.

======= handlerOptions

Optional configuration for the handler.

Returns

Promise<CredentialResult>

A promise that resolves to the signed LDP credential.

Remarks

This method reuses handlePrepareSigningRequest and handleAttachSignature to avoid code duplication. It performs the following steps: 1. Prepares the signing request (validates, loads schema, creates unsigned credential) 2. Signs the material using the signer 3. Attaches the signature to complete the credential

Throws

When required options are missing or invalid.

Implementation of

handlePrepareSigningRequestCredential()

handlePrepareSigningRequestCredential(request, handlerOptions): Promise<link:../interfaces/SigningRequest.md<link:../interfaces/LdpUnsignedCredential.md<ClaimDataWithId<ClaimData>>, string[]>>

Prepares a signing request for external signing. This creates the unsigned credential and generates the proof signing request.

Parameters

======= request

link:../interfaces/CredentialIssuanceRequest.md<ClaimData, CredentialOptions, Format>

The issuance request containing claims and options.

======= handlerOptions

Optional configuration for the handler.

Returns

Promise<link:../interfaces/SigningRequest.md<link:../interfaces/LdpUnsignedCredential.md<ClaimDataWithId<ClaimData>>, string[]>>

A promise that resolves to a signing request containing the unsigned credential and proof signing request.

Throws

When required options are missing or invalid.

handlePrepareSigningRequestPresentation()

handlePrepareSigningRequestPresentation(request, handlerOptions): Promise<<link:../interfaces/LdpUnsignedPresentation.md">LdpUnsignedPresentation, string[]>>

Prepares a signing request for external signing. This creates the unsigned presentation and generates the proof signing request.

Parameters

======= request

The issuance request containing claims and format information.

======= handlerOptions

Returns

A promise that resolves to a signing request containing the unsigned presentation and proof signing request.

handlePresentation()

handlePresentation(request, handlerOptions): Promise<PresentationResult>

Processes an issuance request and generates a signed presentation.

Parameters

======= request

The issuance request containing claims and format information.

======= handlerOptions

Returns

Promise<PresentationResult>

A promise that resolves to the signed presentation.

Interface: IssuanceHandler<CredentialResult, PresentationResult, ClaimData, CredentialOptions, PresentationOptions, CredentialsData, Format>

Interface for issuance format handlers.

Handlers are responsible for processing specific issuance formats and generating signed credentials or presentations in those formats.

Typeparam

Result - The type of the credential or presentation object that this handler produces.

Typeparam

Options - The type of options that this handler accepts.

Typeparam

Format - The format identifier for the issuance format.

Type Parameters

CredentialResult

CredentialResult = object

PresentationResult

PresentationResult = object

ClaimData

ClaimData extends object = object

CredentialOptions

CredentialOptions extends object = object

PresentationOptions

PresentationOptions extends object = object

CredentialsData

CredentialsData extends Credentials = Credentials

Format

Format extends string = string

Properties

FORMAT

readonly FORMAT: Format

Methods

canHandle()

canHandle(format): boolean

Determines if this handler can process the specified format.

Parameters

======= format

string

The format identifier to check (e.g., ‘ldp_vc’, ‘jwt_vc’).

Returns

boolean

True if this handler can process the format, false otherwise.


handleCredential()

handleCredential(request, options): CredentialResult | Promise<CredentialResult>

Processes an issuance request and generates a signed credential.

Parameters

======= request

link:CredentialIssuanceRequest.md<ClaimData, CredentialOptions>

The issuance request containing claims and format information.

======= options

Optional configuration for the handler.

Returns

CredentialResult | Promise<CredentialResult>

A promise that resolves to the signed credential.


handlePrepareSigningRequestCredential()

handlePrepareSigningRequestCredential(request, options): Promise<link:SigningRequest.md<object, string[]>>

Prepares a signing request for external signing. This creates the unsigned credential and generates the proof signing request.

Parameters

======= request

link:CredentialIssuanceRequest.md<ClaimData, CredentialOptions>

The issuance request containing claims and format information.

======= options

Optional configuration for the handler.

Returns

Promise<link:SigningRequest.md<object, string[]>>

A promise that resolves to a signing request containing the unsigned credential and proof signing request.


handlePrepareSigningRequestPresentation()

handlePrepareSigningRequestPresentation(request, options): Promise<link:SigningRequest.md<object, string[]>>

Prepares a signing request for external signing. This creates the unsigned presentation and generates the proof signing request.

Parameters

======= request

link:PresentationIssuanceRequest.md<CredentialsData, PresentationOptions>

The issuance request containing claims and format information.

======= options

Optional configuration for the handler.

Returns

Promise<link:SigningRequest.md<object, string[]>>

A promise that resolves to a signing request containing the unsigned presentation and proof signing request.


handlePresentation()

handlePresentation(request, options): PresentationResult | Promise<PresentationResult>

Processes an issuance request and generates a signed presentation.

Parameters

======= request

link:PresentationIssuanceRequest.md<CredentialsData, PresentationOptions>

The issuance request containing claims and format information.

======= options

Optional configuration for the handler.

Returns

PresentationResult | Promise<PresentationResult>

A promise that resolves to the signed presentation.

Policies

Policies are reusable classes that enforce business rules on the credential claims before issuance.


@the-hashgraph-group-ag/issuer / RequiredClaimsPolicy

Class: RequiredClaimsPolicy<Context>

A policy that checks for the presence of a specific set of claims.

This policy validates that all required claim keys exist on the claims object. It does not validate the values of the claims, only their presence.

Example

const policy = new RequiredClaimsPolicy(['name', 'dateOfBirth', 'email']);

// This would pass
const result1 = await policy.check({ claims: { name: 'John', dateOfBirth: '1990-01-01', email: 'john@example.com' } });

// This would fail
const result2 = await policy.check({ claims: { name: 'John', dateOfBirth: '1990-01-01' } }); // missing email

Type Parameters

Context

Context extends object = Record<string, unknown>

Implements

  • link:../interfaces/IssuancePolicy.md<Context>

Constructors

Constructor

new RequiredClaimsPolicy<Context>(requiredClaims): RequiredClaimsPolicy<Context>

Creates a new RequiredClaimsPolicy instance.

Parameters

======= requiredClaims

string[]

An array of strings representing the claim keys to check for.

Returns

RequiredClaimsPolicy<Context>

Example
const policy = new RequiredClaimsPolicy(['name', 'dateOfBirth']);

Properties

NAME

readonly NAME: "RequiredClaimsPolicy" = 'RequiredClaimsPolicy'

The unique name identifier for this policy.

Implementation of

Methods

check()

check(context): PolicyResult

Validates that all required claims are present in the claims object.

Parameters

======= context

link:../interfaces/PolicyContext.md<Context>

The policy context containing the claims to validate.

Returns

A promise that resolves to the policy validation result.

Example
const result = await policy.check({
  claims: { name: 'John', dateOfBirth: '1990-01-01' },
  logger: console
});

if (result.compliant) {
  console.log('All required claims are present');
} else {
  console.log('Missing claims:', result.reason);
}

Interface: IssuancePolicy<Data>

Interface for issuance policies that validate data before issuance.

Policies are used to enforce business rules and validate that data meet the requirements before a credential or presentation is issued.

Typeparam

Data - The type of the data that this policy validates.

Type Parameters

Properties

DESCRIPTION?

optional DESCRIPTION?: string

Optional description of what this policy validates.


NAME

NAME: string

The unique name identifier for this policy.

Methods

check()

check(input): PolicyResult | Promise<link:PolicyResult.md>

Validates the data against this policy.

Parameters

======= input

link:PolicyContext.md<Data>

The policy context containing data and logger.

Returns

PolicyResult | Promise<link:PolicyResult.md>

A promise that resolves to the policy validation result.

Services

Services are helper classes that provide utility functions to other components.

Unresolved include directive in modules/ROOT/pages/api-reference.adoc - include::../partials/api/classes/SchemaLoader.adoc[]

Type Definitions

These interfaces define the shape of the data structures used throughout the SDK, such as requests, results, and options.


Interface: IssuerOptions<Handlers>

Configuration options for creating an issuer.

Typeparam

Handlers - Array of handler types that define supported formats

Type Parameters

Handlers

Handlers extends link:IssuanceHandler.md<object, object, object, object, object, object, string>[] = link:IssuanceHandler.md<object, object, object, object, object, object, string>[]

Properties

handlers

handlers: Handlers

Array of handlers that can process different data formats


issuanceDecorators?

optional issuanceDecorators?: link:../classes/IssuanceDecorator.md<object>[]

Array of issuance decorators that can decorate the data


logger?

optional logger?: Logger

Logger instance for recording issuance operations


policies?

optional policies?: link:IssuancePolicy.md<object>[]

Array of policies that can validate claims before issuance

Unresolved include directive in modules/ROOT/pages/api-reference.adoc - include::../partials/api/interfaces/IssuanceRequest.adoc[]


Type Alias: IssuanceResult<Result>

IssuanceResult<Result> = link:../interfaces/IssuanceSuccess.md<Result>

Union type representing the result of a credential issuance operation.

Type Parameters

Result

Result = unknown

Typeparam

Result - The type of the issued credential

Unresolved include directive in modules/ROOT/pages/api-reference.adoc - include::../partials/api/interfaces/PolicyEngineOptions.adoc[]

Unresolved include directive in modules/ROOT/pages/api-reference.adoc - include::../partials/api/interfaces/PolicyEngineResult.adoc[]