/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { RootStoreChain, RootStoreChain$inboundSchema, } from "./rootstorechain.js"; /** * The certificate's type. Options include root, intermediate, or leaf. */ export const Type = { Unknown: "", Root: "root", Intermediate: "intermediate", Leaf: "leaf", } as const; /** * The certificate's type. Options include root, intermediate, or leaf. */ export type Type = OpenEnum; export type RootStore = { /** * A path of trusted signing certificates up to a root certificate present in a root store, represented as an ordered list of SHA-256 fingerprints. */ chains?: Array | null | undefined; /** * Whether the certificate has ever been considered valid by the root store. */ everValid?: boolean | undefined; /** * Whether there ever existed a trusted path of signing certificates from a certificate present in the root certificate store. */ hadTrustedPath?: boolean | undefined; /** * Whether there currently exists a trusted path of signing certificates from a certificate present in the root certificate store. */ hasTrustedPath?: boolean | undefined; /** * Whether the certificate is in the revocation set (e.g. OneCRL) associated with the root store. */ inRevocationSet?: boolean | undefined; /** * Whether the certificate is currently considered valid by the root store: a summary of the trust path, revoked, blocklisted/allowlisted, and expired fields. */ isValid?: boolean | undefined; /** * The SHA-256 fingerprints of the certificate's immediate parents in its trust path(s). */ parents?: Array | null | undefined; /** * The certificate's type. Options include root, intermediate, or leaf. */ type?: Type | undefined; }; /** @internal */ export const Type$inboundSchema: z.ZodType = openEnums.inboundSchema(Type); /** @internal */ export const RootStore$inboundSchema: z.ZodType< RootStore, z.ZodTypeDef, unknown > = z.object({ chains: z.nullable(z.array(RootStoreChain$inboundSchema)).optional(), ever_valid: z.boolean().optional(), had_trusted_path: z.boolean().optional(), has_trusted_path: z.boolean().optional(), in_revocation_set: z.boolean().optional(), is_valid: z.boolean().optional(), parents: z.nullable(z.array(z.string())).optional(), type: Type$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "ever_valid": "everValid", "had_trusted_path": "hadTrustedPath", "has_trusted_path": "hasTrustedPath", "in_revocation_set": "inRevocationSet", "is_valid": "isValid", }); }); export function rootStoreFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RootStore$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RootStore' from JSON`, ); }