export type PackageInitParams = { /** base64 secret key for signing webhooks. If provided, enables generating signature and headers to authenticate webhook data. */ webhookSecretKey?: string; /** If provided, enables the usage of the verification module. */ verificationOptions?: VerificationOptions; /** Initializes public key used for verifying and decrypting in this package. If not given, will default to "production". */ mode?: PackageMode; }; export type FieldType = 'section' | 'radiobutton' | 'dropdown' | 'checkbox' | 'nric' | 'email' | 'table' | 'number' | 'rating' | 'yes_no' | 'decimal' | 'textfield' | 'textarea' | 'attachment' | 'date' | 'mobile' | 'homeno' | 'statement' | 'image' | 'country_region' | 'uen' | 'children' | 'address' | 'signature'; export type FormField = { _id: string; question: string; fieldType: FieldType; isHeader?: boolean; signature?: string; } & ({ answer: string; answerArray?: never; } | { answer?: never; answerArray: string[] | string[][]; }); export type FormFieldsV3 = Record; export type EncryptedContent = string; export type EncryptedContentV3 = { submissionPublicKey: string; submissionSecretKey: string; encryptedContent: EncryptedContent; encryptedSubmissionSecretKey: EncryptedContent; }; export type EncryptedAttachmentRecords = Record; export interface DecryptParams { encryptedContent: EncryptedContent; version: number; verifiedContent?: EncryptedContent; attachmentDownloadUrls?: EncryptedAttachmentRecords; } export interface DecryptParamsV3 { encryptedContent: EncryptedContent; encryptedSubmissionSecretKey: EncryptedContent; verifiedContent?: EncryptedContent; version: number; } export type DecryptedContent = { responses: FormField[]; verified?: Record; }; export type DecryptedContentV3 = { submissionSecretKey: string; responses: FormFieldsV3; verified?: Record; }; export type DecryptedFile = { filename: string; content: Uint8Array; }; export type DecryptedAttachments = Record; export type DecryptedContentAndAttachments = { content: DecryptedContent; attachments: DecryptedAttachments; }; export type EncryptedFileContent = { submissionPublicKey: string; nonce: string; binary: Uint8Array; }; export type EncryptedAttachmentContent = { encryptedFile: { submissionPublicKey: string; nonce: string; binary: string; }; }; export type Keypair = { publicKey: string; secretKey: string; }; export type PackageMode = 'staging' | 'production' | 'development' | 'test'; export type VerificationOptions = { publicKey?: string; secretKey?: string; transactionExpiry?: number; }; export type VerifiedAnswer = { fieldId: string; answer: string; }; export type VerificationSignatureOptions = VerifiedAnswer & { transactionId: string; formId: string; }; export type VerificationBasestringOptions = VerificationSignatureOptions & { time: number; }; export type VerificationAuthenticateOptions = VerifiedAnswer & { signatureString: string; submissionCreatedAt: number; };