/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type SigningKey = { id?: string | undefined; /** * Name of the signing key */ name?: string | undefined; /** * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ userId?: string | undefined; /** * Timestamp (in milliseconds) at which the signing-key was created */ createdAt?: number | undefined; /** * Timestamp (in milliseconds) at which the signing-key was last used */ lastSeen?: number | undefined; publicKey: string; /** * Disable the signing key to allow rotation safely */ disabled?: boolean | undefined; /** * The ID of the project */ projectId?: string | undefined; }; /** @internal */ export const SigningKey$inboundSchema: z.ZodType< SigningKey, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), name: z.string().optional(), userId: z.string().optional(), createdAt: z.number().optional(), lastSeen: z.number().optional(), publicKey: z.string(), disabled: z.boolean().optional(), projectId: z.string().optional(), }); /** @internal */ export type SigningKey$Outbound = { id?: string | undefined; name?: string | undefined; userId?: string | undefined; createdAt?: number | undefined; lastSeen?: number | undefined; publicKey: string; disabled?: boolean | undefined; projectId?: string | undefined; }; /** @internal */ export const SigningKey$outboundSchema: z.ZodType< SigningKey$Outbound, z.ZodTypeDef, SigningKey > = z.object({ id: z.string().optional(), name: z.string().optional(), userId: z.string().optional(), createdAt: z.number().optional(), lastSeen: z.number().optional(), publicKey: z.string(), disabled: z.boolean().optional(), projectId: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SigningKey$ { /** @deprecated use `SigningKey$inboundSchema` instead. */ export const inboundSchema = SigningKey$inboundSchema; /** @deprecated use `SigningKey$outboundSchema` instead. */ export const outboundSchema = SigningKey$outboundSchema; /** @deprecated use `SigningKey$Outbound` instead. */ export type Outbound = SigningKey$Outbound; } export function signingKeyToJSON(signingKey: SigningKey): string { return JSON.stringify(SigningKey$outboundSchema.parse(signingKey)); } export function signingKeyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SigningKey$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SigningKey' from JSON`, ); }