MCPcopy Index your code
hub / github.com/OpenSignLabs/OpenSign / decryptPdf

Function decryptPdf

apps/OpenSign/src/constant/Utils.js:4524–4538  ·  view source on GitHub ↗
(file, password)

Source from the content-addressed store, hash-verified

4522 *
4523 */
4524export const decryptPdf = async (file, password) => {
4525 const name = generatePdfName(16);
4526 const baseApi = localStorage.getItem("baseUrl") || "";
4527 const url = removeTrailingSegment(baseApi) + "/decryptpdf?ts=" + Date.now();
4528 let formData = new FormData();
4529 formData.append("file", file);
4530 formData.append("password", password);
4531 const config = {
4532 headers: { "content-type": "multipart/form-data" },
4533 responseType: "blob"
4534 };
4535 const response = await axios.post(url, formData, config);
4536 const pdfBlob = new Blob([response.data], { type: "application/pdf" });
4537 return new File([pdfBlob], name, { type: "application/pdf" });
4538};
4539
4540/**
4541 * Convert a Base64 string to a File object.

Callers 5

handleFileUploadFunction · 0.90
handleFileUploadFunction · 0.90
handleFileUploadFunction · 0.90
FormsFunction · 0.90
handlePasswordSubmitFunction · 0.90

Calls 2

removeTrailingSegmentFunction · 0.85
generatePdfNameFunction · 0.70

Tested by

no test coverage detected