2025-08-20 11:30:57 +01:00
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { useToolOperation } from '../shared/useToolOperation';
|
|
|
|
import { createStandardErrorHandler } from '../../../utils/toolErrorHandler';
|
2025-08-22 14:40:27 +01:00
|
|
|
import { RemoveCertificateSignParameters, defaultParameters } from './useRemoveCertificateSignParameters';
|
|
|
|
|
|
|
|
// Static function that can be used by both the hook and automation executor
|
|
|
|
export const buildRemoveCertificateSignFormData = (parameters: RemoveCertificateSignParameters, file: File): FormData => {
|
|
|
|
const formData = new FormData();
|
|
|
|
formData.append("fileInput", file);
|
|
|
|
return formData;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Static configuration object
|
|
|
|
export const removeCertificateSignOperationConfig = {
|
|
|
|
operationType: 'remove-certificate-sign',
|
|
|
|
endpoint: '/api/v1/security/remove-cert-sign',
|
|
|
|
buildFormData: buildRemoveCertificateSignFormData,
|
|
|
|
filePrefix: 'unsigned_', // Will be overridden in hook with translation
|
|
|
|
multiFileEndpoint: false,
|
|
|
|
defaultParameters,
|
|
|
|
} as const;
|
2025-08-20 11:30:57 +01:00
|
|
|
|
|
|
|
export const useRemoveCertificateSignOperation = () => {
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
return useToolOperation<RemoveCertificateSignParameters>({
|
2025-08-22 14:40:27 +01:00
|
|
|
...removeCertificateSignOperationConfig,
|
2025-08-20 11:30:57 +01:00
|
|
|
filePrefix: t('removeCertSign.filenamePrefix', 'unsigned') + '_',
|
|
|
|
getErrorMessage: createStandardErrorHandler(t('removeCertSign.error.failed', 'An error occurred while removing certificate signatures.'))
|
|
|
|
});
|
|
|
|
};
|