The @zcloak/ctype module defines a way to verify the credential subject(claims) data type, which is based on json-schema for validation.

Integration steps

  1. Installation: yarn add @zcloak/ctype
  2. Import the necessary classes and functions.
import { validateSubject, validateSubjectPartial } from '@zcloak/ctype';
...

Key Classes and Functions

Validating Credential Type

The Validate CType functions provide a convenient way to validate the structure of subject data based on a CType schema, allowing you to ensure that the data conforms to the expected format defined by the schema.

Key methods include:

validateSubject(params)

export function validateSubject(ctype: BaseCType, subject: any): ValidatorResult {
  //......
}

ValidateSubjectPartial(params)

export function validateSubjectPartial(ctype: BaseCType, subject: any): ValidatorResult {
  //......
}