@vecrea/oid4vc-prex
Version:
A TypeScript library for handling OpenID for Verifiable Credentials (OID4VC) Presentation Exchange operations
51 lines (50 loc) • 1.34 kB
TypeScript
import { z } from 'zod';
/**
* Zod schema for validating group values.
*
* This schema ensures that a group 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
* groupSchema.parse('abc123'); // Returns 'abc123'
* groupSchema.parse('a'); // Returns 'a'
*
* // Invalid usage (will throw ZodError)
* groupSchema.parse(''); // Throws error: String must contain at least 1 character(s)
* groupSchema.parse(123); // Throws error: Expected string, received number
*
* @throws {z.ZodError} Throws a ZodError if the input fails validation
*/
export declare const groupSchema: z.ZodString;
/**
* Represents a group.
*
* @class
* @example
* // Create a valid Group instance
* const validId = new Group('abc123');
* console.log(validId.value); // Outputs: 'abc123'
*
*/
export declare class Group {
value: string;
/**
* Creates an instance of Group.
*
* @param {string} value - The value of the group.
*/
constructor(value: string);
/**
* Returns the string representation of the Group.
*
* This method is used for JSON serialization.
*
* @returns {string} The group value.
*/
toJSON(): string;
}