Skip to content
Snippets Groups Projects
Commit 38714470 authored by Damyan Mitev's avatar Damyan Mitev :beach:
Browse files

remove redundant func def

parent 20f06b90
Branches 268-convert-odt-file-to-pdf
Tags
3 merge requests!48269 implement workflow for signing already uploaded document dev,!47269 implement workflow for signing already uploaded document,!41268 convert odt file to pdf
...@@ -1067,64 +1067,6 @@ const connection = Penpal.connectToParent({ ...@@ -1067,64 +1067,6 @@ const connection = Penpal.connectToParent({
return encodeResponse("200", response.data, "PDF signed"); return encodeResponse("200", response.data, "PDF signed");
}, },
signPdf: async (passportUUID, pdfRaw /*array buffer*/) => {
//TODO api is not finished
const authenticationPublicKey = localStorage.getItem("authenticatedIdentity");
if (
!authenticationPublicKey ||
!window.loadedIdentities[authenticationPublicKey] ||
!extendPinCodeTtl(authenticationPublicKey)
) {
return encodeResponse("400", "", "Identity not authenticated");
}
let response = await getCertificateForPassport(passportUUID, true);
if (response.code !== "200") {
return encodeResponse("400", "", response.status);
}
const {
x509Certificate: passportCertificate,
privateKey: passportPrivateKey,
chain: passportChain
} = response.data;
const keys =
await createOneTimePassportCertificate(
makeid() + "-" + passportUUID, null, passportPrivateKey, passportCertificate);
const { privateKeyPEM: privateKeyOneTime, certificatePEM: certificateOneTime } = keys;
passportChain.push(passportCertificate);
const signedPdf = await signPdf(pdfRaw, certificateOneTime, passportChain, privateKeyOneTime);
//for test
response.data.signedPdf = signedPdf;
//for test
// response = await executeRestfulFunction(
// "private", window.viamApi, window.viamApi.passportGetEmailWithHeaderByPassport, null, passportUUID, emailMessage);
//
// if (response.code !== "200") {
// return encodeResponse("400", "", response.status);
// }
//
// const signedEmail = await signEmail(response.data, certificateOneTime, passportChain, privateKeyOneTime);
//
// response = await executeRestfulFunction(
// "private", window.viamApi, window.viamApi.signResignEmail, null, passportUUID, signedEmail);
//
// if (response.code !== "200") {
// return encodeResponse("400", "", response.status);
// }
return encodeResponse("200", response.data, "PDF signed");
},
documentCreateDocument: async (path, passportUUID, contenttype) => { documentCreateDocument: async (path, passportUUID, contenttype) => {
const authenticationPublicKey = localStorage.getItem("authenticatedIdentity"); const authenticationPublicKey = localStorage.getItem("authenticatedIdentity");
if ( if (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment