/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type KeyUsage = { /** * Whether the keyCertSign bit is set. */ certificateSign?: boolean | undefined; /** * Whether the contentCommitment (formerly called nonRepudiation) bit is set. */ contentCommitment?: boolean | undefined; /** * Whether the cRLSign bit is set. */ crlSign?: boolean | undefined; /** * Whether the dataEncipherment bit is set. */ dataEncipherment?: boolean | undefined; /** * Whether the decipherOnly bit is set. */ decipherOnly?: boolean | undefined; /** * Whether the digitalSignature bit is set. */ digitalSignature?: boolean | undefined; /** * Whether the encipherOnly bit is set. */ encipherOnly?: boolean | undefined; /** * Whether the keyAgreement bit is set. */ keyAgreement?: boolean | undefined; /** * Whether the keyEncipherment bit is set. */ keyEncipherment?: boolean | undefined; /** * The integer value of the bitmask in the extension. */ value?: number | undefined; }; /** @internal */ export const KeyUsage$inboundSchema: z.ZodType< KeyUsage, z.ZodTypeDef, unknown > = z.object({ certificate_sign: z.boolean().optional(), content_commitment: z.boolean().optional(), crl_sign: z.boolean().optional(), data_encipherment: z.boolean().optional(), decipher_only: z.boolean().optional(), digital_signature: z.boolean().optional(), encipher_only: z.boolean().optional(), key_agreement: z.boolean().optional(), key_encipherment: z.boolean().optional(), value: z.number().int().optional(), }).transform((v) => { return remap$(v, { "certificate_sign": "certificateSign", "content_commitment": "contentCommitment", "crl_sign": "crlSign", "data_encipherment": "dataEncipherment", "decipher_only": "decipherOnly", "digital_signature": "digitalSignature", "encipher_only": "encipherOnly", "key_agreement": "keyAgreement", "key_encipherment": "keyEncipherment", }); }); export function keyUsageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => KeyUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'KeyUsage' from JSON`, ); }