@vecrea/oid4vc-prex
Version:
A TypeScript library for handling OpenID for Verifiable Credentials (OID4VC) Presentation Exchange operations
28 lines (27 loc) • 928 B
TypeScript
import { z } from 'zod';
/**
* Zod schema for validating Json Object values.
*
* This schema ensures that a value is a JSON object.
* It applies the following validations:
* - The value must be a JSON object.
* - The object must have string keys and unknown values.
*
* @type {z.ZodString}
*
* @example
* // Valid usage
* jsonObjectSchema.parse({ key: 'value' }); // Returns { key: 'value' }
* jsonObjectSchema.parse({ key: 123 }); // Returns { key: 123 }
*
* // Invalid usage (will throw ZodError)
* jsonObjectSchema.parse(''); // Throws error: Expected object, received string
* jsonObjectSchema.parse(123); // Throws error: Expected object, received number
*
* @throws {z.ZodError} Throws a ZodError if the input fails validation
*/
export declare const jsonObjectSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
/**
* Type of a JSON object.
*/
export type JsonObject = z.infer<typeof jsonObjectSchema>;