/* * 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 { TlsChain, TlsChain$inboundSchema } from "./tlschain.js"; import { TlsVersionData, TlsVersionData$inboundSchema, } from "./tlsversiondata.js"; /** * Certificate version v1(0), v2(1), v3(2). */ export const VersionSelected = { Unknown: "", SsLv2: "ss_lv_2", SsLv3: "ss_lv_3", Tlsv10: "tlsv1_0", Tlsv11: "tlsv1_1", Tlsv12: "tlsv1_2", Tlsv13: "tlsv1_3", Dtlsv10: "dtlsv1_0", Dtlsv12: "dtlsv1_2", Dtlsv13: "dtlsv1_3", } as const; /** * Certificate version v1(0), v2(1), v3(2). */ export type VersionSelected = OpenEnum; export type Tls = { /** * Cipher suite chosen for the exchange. */ cipherSelected?: string | undefined; /** * The SHA-256 digest of the entire raw certificate. Its unique identifier, which Censys uses to index certificates records. */ fingerprintSha256?: string | undefined; /** * The JA3S fingerprint for this service. */ ja3s?: string | undefined; ja4s?: string | undefined; /** * Certificate chain information. */ presentedChain?: Array | null | undefined; /** * Certificate version v1(0), v2(1), v3(2). */ versionSelected?: VersionSelected | undefined; versions?: Array | null | undefined; }; /** @internal */ export const VersionSelected$inboundSchema: z.ZodType< VersionSelected, z.ZodTypeDef, unknown > = openEnums.inboundSchema(VersionSelected); /** @internal */ export const Tls$inboundSchema: z.ZodType = z .object({ cipher_selected: z.string().optional(), fingerprint_sha256: z.string().optional(), ja3s: z.string().optional(), ja4s: z.string().optional(), presented_chain: z.nullable(z.array(TlsChain$inboundSchema)).optional(), version_selected: VersionSelected$inboundSchema.optional(), versions: z.nullable(z.array(TlsVersionData$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "cipher_selected": "cipherSelected", "fingerprint_sha256": "fingerprintSha256", "presented_chain": "presentedChain", "version_selected": "versionSelected", }); }); export function tlsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Tls$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Tls' from JSON`, ); }