UNPKG

@vecrea/oid4vc-prex

Version:

A TypeScript library for handling OpenID for Verifiable Credentials (OID4VC) Presentation Exchange operations

51 lines (50 loc) 1.51 kB
import { z } from 'zod'; /** * Zod schema for validating Input Descriptor ID values. * * This schema ensures that a id is a non-empty string. * It applies the following validations: * - The value must be a string. * - The string must have a minimum length of 1 character. * * @type {z.ZodString} * * @example * // Valid usage * inputDescriptorIdSchema.parse('abc123'); // Returns 'abc123' * inputDescriptorIdSchema.parse('a'); // Returns 'a' * * // Invalid usage (will throw ZodError) * inputDescriptorIdSchema.parse(''); // Throws error: String must contain at least 1 character(s) * inputDescriptorIdSchema.parse(123); // Throws error: Expected string, received number * * @throws {z.ZodError} Throws a ZodError if the input fails validation */ export declare const inputDescriptorIdSchema: z.ZodString; /** * Represents a Input Descriptor ID. * * @class * @example * // Create a valid InputDescriptorId instance * const validInputDescriptorId = new InputDescriptorId('abc123'); * console.log(validInputDescriptorId.value); // Outputs: 'abc123' * */ export declare class InputDescriptorId { value: string; /** * Creates an instance of InputDescriptorId. * * @param {string} value - The value of the id. */ constructor(value: string); /** * Returns the string representation of the InputDescriptorId. * * This method is used for JSON serialization. * * @returns {string} The id value. */ toJSON(): string; }