API Reference

This page contains the complete auto-generated API reference for the Verifier 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/verifier / createCredentialVerifier

Function: createCredentialVerifier()

createCredentialVerifier<Handlers>(options): CredentialVerifier

Type Parameters

Handlers

Handlers extends readonly link:../interfaces/VerificationHandler.md<Record<string, unknown>>[] = link:../interfaces/VerificationHandler.md<Record<string, unknown>>[]

Parameters

options

Interface: CredentialVerifier

Methods

createRequest()

createRequest(options): Promise<link:PresentationRequest.md>

Creates a presentation request.

Parameters

======= options

The options for creating the presentation request.

Returns

Promise<link:PresentationRequest.md>

A promise that resolves to the presentation request.


verify()

verify(presentation, request, handlerOptions?): Promise<link:VerificationResult.md<undefined>>

Verifies a presentation.

Parameters

======= presentation

unknown

The presentation to verify.

======= request

The presentation request.

======= handlerOptions?

Omit<VerificationHandlerOptions, "request" | "logger">

Optional handler-specific options (request and logger are provided automatically).

Returns

Promise<link:VerificationResult.md<undefined>>

A promise that resolves to the verification result.


@the-hashgraph-group-ag/verifier / VerificationHandler

Interface: VerificationHandler<Result>

Interface for a verification handler.

Type Parameters

Result

Result extends object = Record<string, unknown>

Methods

canHandle()

canHandle(input): boolean

Verifies if the input is a valid input for the handler.

Parameters

======= input

unknown

The input to verify.

Returns

boolean

True if the input is a valid input for the handler.


verify()

verify(input, options?): link:../type-aliases/HandlerResult.md<Result> | Promise<link:../type-aliases/HandlerResult.md<Result>>

Verifies the input and returns the result.

Parameters

======= input

unknown

The input to verify.

======= options?

The options for the handler.

Returns

link:../type-aliases/HandlerResult.md<Result> | Promise<link:../type-aliases/HandlerResult.md<Result>>

The result of the verification.

Handlers

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


@the-hashgraph-group-ag/verifier / VerificationHandler

Interface: VerificationHandler<Result>

Interface for a verification handler.

Type Parameters

Result

Result extends object = Record<string, unknown>

Methods

canHandle()

canHandle(input): boolean

Verifies if the input is a valid input for the handler.

Parameters

======= input

unknown

The input to verify.

Returns

boolean

True if the input is a valid input for the handler.


verify()

verify(input, options?): link:../type-aliases/HandlerResult.md<Result> | Promise<link:../type-aliases/HandlerResult.md<Result>>

Verifies the input and returns the result.

Parameters

======= input

unknown

The input to verify.

======= options?

The options for the handler.

Returns

link:../type-aliases/HandlerResult.md<Result> | Promise<link:../type-aliases/HandlerResult.md<Result>>

The result of the verification.

Policies

Policies are reusable classes that enforce business rules on the credential claims during verification.


Interface: CredentialPolicy<PolicyData, ResultData>

Type Parameters

PolicyData

PolicyData extends object = Record<string, unknown>

ResultData

ResultData extends object = undefined

Properties

DESCRIPTION?

optional DESCRIPTION?: string

Optional description of the policy.


NAME

NAME: string

The unique name of the policy that will be used to identify the policy.

Methods

execute()

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

Logic to verify the policy compliance against the given credential.

Parameters

======= input

link:PolicyInput.md<PolicyData>

The policy input containing the credential data and request.

Returns

link:PolicyResult.md<ResultData> | Promise<link:PolicyResult.md<ResultData>>

A promise that resolves to the policy result.


getCredentialConstraints()?

optional getCredentialConstraints(): object | Promise<object>

Returns the credential constraints for the policy.

Returns

object | Promise<object>

Type Definitions

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


@the-hashgraph-group-ag/verifier / CredentialVerifierOptions

Interface: CredentialVerifierOptions

Properties

handlers

handlers: link:VerificationHandler.md<Record<string, unknown>>[]

The handlers that will be used to handle credential formats.


logger?

optional logger?: Logger

The logger to be used by the verifier to log messages.


policies

policies: link:CredentialPolicy.md<Record<string, unknown>, undefined>[]

The policies that will be used to verify the presentation.


@the-hashgraph-group-ag/verifier / VerificationInput

Type Alias: VerificationInput

VerificationInput = unknown


@the-hashgraph-group-ag/verifier / VerificationResult

Interface: VerificationResult<ResultData>

Type Parameters

ResultData

ResultData extends object = undefined

Properties

policyResults?

optional policyResults?: Record<string, link:PolicyResult.md<ResultData>>

The results of the policies that were used to verify the presentation.


verified

verified: true

Whether the presentation is verified or not.


@the-hashgraph-group-ag/verifier / PresentationRequest

Interface: PresentationRequest

Properties

credentials

credentials: unknown[]

The credentials that will be used to verify the presentation.


id

id: string

The unique identifier of the presentation request.


policies

policies: string[]

The names of the policies that will be used to verify the presentation.


Type Alias: HandlerResult<Result>

HandlerResult<Result> = object

Interface for the result of a verification handler.

Type Parameters

Result

Result extends object = Record<string, unknown>

Properties