UNPKG

@vecrea/oid4vc-prex

Version:

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

52 lines (51 loc) 1.39 kB
import { z } from 'zod'; /** * Zod schema for validating name values. * * This schema ensures that a name 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 * nameSchema.parse('abc123'); // Returns 'abc123' * nameSchema.parse('a'); // Returns 'a' * * // Invalid usage (will throw ZodError) * nameSchema.parse(''); // Throws error: String must contain at least 1 character(s) * nameSchema.parse(123); // Throws error: Expected string, received number * * @throws {z.ZodError} Throws a ZodError if the input fails validation */ export declare const nameSchema: z.ZodString; /** * Represents a name. * * A name is a human-friendly value that describes what the object represents. * * @class * @example * // Create a Name instance * const name = new Name('abc123'); * console.log(name.value); // Outputs: 'abc123' */ export declare class Name { value: string; /** * Creates an instance of Name. * * @param {string} value - The value of the name. */ constructor(value: string); /** * Returns the string representation of the Name. * * This method is used for JSON serialization. * * @returns {string} The name value. */ toJSON(): string; }