@vecrea/oid4vc-prex
Version:
A TypeScript library for handling OpenID for Verifiable Credentials (OID4VC) Presentation Exchange operations
71 lines (70 loc) • 3.49 kB
TypeScript
import { z } from 'zod';
import { Id } from './Id';
import { Name } from './Name';
import { Purpose } from './Purpose';
import { Format, FormatJSON } from './Format';
import { InputDescriptor, InputDescriptorJSON } from './InputDescriptor';
import { SubmissionRequirement, SubmissionRequirementJSON } from './SubmissionRequirement';
/**
* Zod schema for validating presentation definition values.
*
* This schema ensures that a presentation definition is an object with the following properties:
* - id: The value must be a string.
* - name: An optional string.
* - purpose: An optional string.
* - format: An optional object that must be an instance of Format.
* - input_descriptors: An optional array of objects that must be InputDescriptor json.
* - submission_requirements: An optional array of objects that must be SubmissionRequirement json.
*/
export declare const presentationDefinitionSchema: z.ZodType<PresentationDefinitionJSON>;
/**
* Type of a PresentationDefinition JSON object.
*/
export type PresentationDefinitionJSON = {
id: string;
name?: string;
purpose?: string;
format?: FormatJSON;
input_descriptors?: InputDescriptorJSON[];
submission_requirements?: SubmissionRequirementJSON[];
};
/**
* Represents a presentation definition.
*
* @class
* @property {Id} id The id of the presentation definition.
* @property {Name} [name] The name of the presentation definition.
* @property {Purpose} [purpose] The purpose of the presentation definition.
* @property {Format} [format] The format of the presentation definition.
* @property {InputDescriptor[]} [inputDescriptors] The input descriptors of the presentation definition.
* @property {SubmissionRequirement[]} [submissionRequirements] The submission requirements of the presentation definition.
*/
export declare class PresentationDefinition {
id: Id;
name?: Name | undefined;
purpose?: Purpose | undefined;
format?: Format | undefined;
inputDescriptors?: InputDescriptor[] | undefined;
submissionRequirements?: SubmissionRequirement[] | undefined;
/**
* Creates a new PresentationDefinition instance.
* @property {Id} id The id of the presentation definition.
* @property {Name} [name] The name of the presentation definition.
* @property {Purpose} [purpose] The purpose of the presentation definition.
* @property {Format} [format] The format of the presentation definition.
* @property {InputDescriptor[]} [inputDescriptors] The input descriptors of the presentation definition.
* @property {SubmissionRequirement[]} [submissionRequirements] The submission requirements of the presentation definition.
*/
constructor(id: Id, name?: Name | undefined, purpose?: Purpose | undefined, format?: Format | undefined, inputDescriptors?: InputDescriptor[] | undefined, submissionRequirements?: SubmissionRequirement[] | undefined);
/**
* Convert a presentation definition JSON object to a PresentationDefinition instance.
* @returns {PresentationDefinitionJSON} A presentation definition JSON object.
*/
toJSON(): PresentationDefinitionJSON;
/**
* Convert a presentation definition JSON object to a PresentationDefinition instance.
* @param {PresentationDefinitionJSON} json - The presentation definition JSON object.
* @returns {PresentationDefinition} A new PresentationDefinition instance.
*/
static fromJSON(json: unknown): PresentationDefinition;
}