Closed erickximenes closed 4 years ago
I am bringing the certificate from the database, they are in base64, when it comes time to sign the PDF, it expects a buffer. What do I do?
Code to save the certificate to the database certificado: req.files.certificado.data.toString('base64'),
certificado: req.files.certificado.data.toString('base64'),
Code to sign const p12Buffer = await req.user.certificado; const signedPdf = signer.sign(output, p12Buffer, { passphrase: req.user.sen_cert });
const p12Buffer = await req.user.certificado;
const signedPdf = signer.sign(output, p12Buffer, { passphrase: req.user.sen_cert });
I am bringing the certificate from the database, they are in base64, when it comes time to sign the PDF, it expects a buffer. What do I do?
Code to save the certificate to the database
certificado: req.files.certificado.data.toString('base64'),
Code to sign
const p12Buffer = await req.user.certificado;
const signedPdf = signer.sign(output, p12Buffer, { passphrase: req.user.sen_cert });