import z, { ZodError } from "zod"; //#region src/array.d.ts /** * Only primitive types allowed * Must have not duplicate entries (will always return false in this case) */ declare function arrayEqualsIgnoreOrder(a: Array, b: Array): boolean; //#endregion //#region src/config.d.ts interface Oid4vcTsConfig { /** * Whether to allow insecure http urls. * * @default false */ allowInsecureUrls: boolean; } declare function setGlobalConfig(config: Oid4vcTsConfig): void; declare function getGlobalConfig(): Oid4vcTsConfig; //#endregion //#region src/globals.d.ts declare const _URL: { new (url: string | URL, base?: string | URL): URL; prototype: URL; canParse(url: string | URL, base?: string | URL): boolean; createObjectURL(obj: Blob | MediaSource): string; parse(url: string | URL, base?: string | URL): URL | null; revokeObjectURL(url: string): void; }; declare const _URLSearchParams: { new (init?: string[][] | Record | string | URLSearchParams): URLSearchParams; prototype: URLSearchParams; }; type Fetch = typeof fetch; type FetchResponse = Response; declare const _Headers: typeof globalThis.Headers; type FetchHeaders = globalThis.Headers; type FetchRequestInit = RequestInit; //#endregion //#region src/content-type.d.ts declare enum ContentType { XWwwFormUrlencoded = "application/x-www-form-urlencoded", Json = "application/json", JwkSet = "application/jwk-set+json", OAuthAuthorizationRequestJwt = "application/oauth-authz-req+jwt", Jwt = "application/jwt", Html = "text/html" } declare function isContentType(contentType: ContentType, value: string): boolean; declare function isResponseContentType(contentType: ContentType | ContentType[], response: FetchResponse): boolean; //#endregion //#region src/date.d.ts /** * Get the time in seconds since epoch for a date. * If date is not provided the current time will be used. */ declare function dateToSeconds(date?: Date): number; declare function addSecondsToDate(date: Date, seconds: number): Date; //#endregion //#region src/encoding.d.ts declare function decodeUtf8String(string: string): Uint8Array; declare function encodeToUtf8String(data: Uint8Array): string; /** * Also supports base64 url */ declare function decodeBase64(base64: string): Uint8Array; declare function encodeToBase64(data: Uint8Array | string): string; declare function encodeToBase64Url(data: Uint8Array | string): string; //#endregion //#region src/error/OpenId4VcBaseError.d.ts declare abstract class OpenId4VcBaseError extends Error {} //#endregion //#region src/error/InvalidFetchResponseError.d.ts declare class InvalidFetchResponseError extends OpenId4VcBaseError { readonly textResponse: string; readonly response: FetchResponse; constructor(message: string, textResponse: string, response: FetchResponse); } //#endregion //#region src/error/JsonParseError.d.ts declare class JsonParseError extends OpenId4VcBaseError { constructor(message: string, jsonString: string); } //#endregion //#region src/error/ValidationError.d.ts declare class ValidationError extends OpenId4VcBaseError { zodError: ZodError | undefined; constructor(message: string, zodError?: ZodError); } //#endregion //#region src/fetcher.d.ts /** * A type utility which represents the function returned * from createZodFetcher */ type ZodFetcher = (schema: Schema, expectedContentType: ContentType | ContentType[], ...args: Parameters) => Promise<{ response: Awaited>; result?: z.ZodSafeParseResult>; }>; declare function createFetcher(fetcher?: typeof fetch): Fetch; /** * Creates a `fetchWithZod` function that takes in a schema of * the expected response, and the arguments to the fetcher * you provided. * * @example * * const fetchWithZod = createZodFetcher((url) => { * return fetch(url).then((res) => res.json()); * }); * * const response = await fetchWithZod( * z.object({ * hello: z.string(), * }), * "https://example.com", * ); */ declare function createZodFetcher(fetcher?: Fetch): ZodFetcher; //#endregion //#region src/object.d.ts declare function isObject(item: unknown): item is Record; /** * Deep merge two objects. * @param target * @param ...sources */ declare function mergeDeep(target: unknown, ...sources: Array): unknown; //#endregion //#region src/parse.d.ts type BaseSchema = z.ZodTypeAny; type InferOutputUnion = { [K in keyof T]: z.infer }[number]; declare function stringToJsonWithErrorHandling(string: string, errorMessage?: string): any; declare function parseIfJson(data: T): T | Record; declare function parseWithErrorHandling(schema: Schema, data: unknown, customErrorMessage?: string): z.infer; //#endregion //#region src/path.d.ts /** * Combine multiple uri parts into a single uri taking into account slashes. * * @param parts the parts to combine * @returns the combined url */ declare function joinUriParts(base: string, parts: string[]): string; //#endregion //#region src/type.d.ts type Simplify = { [KeyType in keyof T]: T[KeyType] } & {}; type Optional = Omit & Partial>; type StringWithAutoCompletion = T | (string & {}); type OrPromise = T | Promise; type NonEmptyArray = [T, ...T[]]; //#endregion //#region src/url.d.ts declare function getQueryParams(url: string): Record; declare function objectToQueryParams(object: Record): InstanceType; //#endregion //#region src/validation.d.ts declare const zHttpsUrl: z.ZodURL; declare const zDataUrl: z.ZodString; declare const zInteger: z.ZodNumber; /** * NumericDate as defined in RFC 7519 Section 2 * A JSON numeric value representing the number of seconds from * 1970-01-01T00:00:00Z UTC until the specified UTC date/time, * ignoring leap seconds. Non-integer values can be represented. */ declare const zNumericDate: z.ZodNumber; declare const zHttpMethod: z.ZodEnum<{ GET: "GET"; POST: "POST"; PUT: "PUT"; DELETE: "DELETE"; HEAD: "HEAD"; OPTIONS: "OPTIONS"; TRACE: "TRACE"; CONNECT: "CONNECT"; PATCH: "PATCH"; }>; type HttpMethod = z.infer; declare const zStringToJson: z.ZodPipe>; declare const zIs: (schema: Schema, data: unknown) => data is z.infer; //#endregion //#region src/www-authenticate.d.ts interface WwwAuthenticateHeaderChallenge { scheme: string; /** * Record where the keys are the names, and the value can be 0 (null), 1 (string) or multiple (string[]) * entries */ payload: Record; } declare function parseWwwAuthenticateHeader(str: string): WwwAuthenticateHeaderChallenge[]; declare function encodeWwwAuthenticateHeader(challenges: WwwAuthenticateHeaderChallenge[]): string; //#endregion //#region src/zod-error.d.ts declare function formatZodError(error?: z.ZodError): string; //#endregion export { type BaseSchema, ContentType, type Fetch, type FetchHeaders, type FetchRequestInit, type FetchResponse, _Headers as Headers, type HttpMethod, type InferOutputUnion, InvalidFetchResponseError, JsonParseError, type NonEmptyArray, type Oid4vcTsConfig, OpenId4VcBaseError, type Optional, type OrPromise, type Simplify, type StringWithAutoCompletion, _URL as URL, _URLSearchParams as URLSearchParams, ValidationError, type WwwAuthenticateHeaderChallenge, type ZodFetcher, addSecondsToDate, arrayEqualsIgnoreOrder, createFetcher, createZodFetcher, dateToSeconds, decodeBase64, decodeUtf8String, encodeToBase64, encodeToBase64Url, encodeToUtf8String, encodeWwwAuthenticateHeader, formatZodError, getGlobalConfig, getQueryParams, isContentType, isObject, isResponseContentType, joinUriParts, mergeDeep, objectToQueryParams, parseIfJson, parseWithErrorHandling, parseWwwAuthenticateHeader, setGlobalConfig, stringToJsonWithErrorHandling, zDataUrl, zHttpMethod, zHttpsUrl, zInteger, zIs, zNumericDate, zStringToJson }; //# sourceMappingURL=index.d.mts.map