/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Information needed to decrypt Apple Pay payment data. * * @remarks * * Refer to [Apple's documentation](https://developer.apple.com/documentation/passkit/payment-token-format-reference#Header-keys-and-values) * for more information. */ export type ApplePayHeader = { /** * Base64-encoded ephemeral public key, used for ECC-encrypted payment data. */ ephemeralPublicKey?: string | undefined; /** * A base64-encoded, SHA-256 hash of the merchant's public key. */ publicKeyHash: string; /** * A device-generated identifier for the transaction. */ transactionId: string; }; /** @internal */ export const ApplePayHeader$inboundSchema: z.ZodType< ApplePayHeader, z.ZodTypeDef, unknown > = z.object({ ephemeralPublicKey: z.string().optional(), publicKeyHash: z.string(), transactionId: z.string(), }); /** @internal */ export type ApplePayHeader$Outbound = { ephemeralPublicKey?: string | undefined; publicKeyHash: string; transactionId: string; }; /** @internal */ export const ApplePayHeader$outboundSchema: z.ZodType< ApplePayHeader$Outbound, z.ZodTypeDef, ApplePayHeader > = z.object({ ephemeralPublicKey: z.string().optional(), publicKeyHash: z.string(), transactionId: z.string(), }); export function applePayHeaderToJSON(applePayHeader: ApplePayHeader): string { return JSON.stringify(ApplePayHeader$outboundSchema.parse(applePayHeader)); } export function applePayHeaderFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ApplePayHeader$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ApplePayHeader' from JSON`, ); }