Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any CDN with a minified version of a single file with dependencies to be used in the browser? #127

Open
insinfo opened this issue Jun 24, 2024 · 1 comment

Comments

@insinfo
Copy link

insinfo commented Jun 24, 2024

Is there any CDN with a minified version of a single file with dependencies to be used in the browser?

@insinfo
Copy link
Author

insinfo commented Jun 24, 2024

@MohammedEssehemy

I cloned the project on my machine and modified the lib/index.js file by adding window.verifyPDF = verifyPDF; and used browserify ./lib/index.js -o ./dist/bundle.js to generate the unified file, I created a simple index.html with inline script to test, it seems to work but I am receiving a return of a digitally signed and valid PDF file authenticity: false and verified: false, how to solve this ?

I'm going to use this lib in a frontend project with AgularDart so I need it to work outside of a module.

./lib/index.js

const verifyPDF = require('./verifyPDF');
const { getCertificatesInfoFromPDF } = require('./certificateDetails');

Object.assign(verifyPDF, { getCertificatesInfoFromPDF });
window.verifyPDF = verifyPDF;
module.exports = verifyPDF;

index.html

<!DOCTYPE html>
<html lang="pt-br" dir="ltr" class="custom-scrollbars">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>teste</title>
  <script defer src="assets/js/verify-pdf/verify-pdf/dist/bundle.js"></script>
  <script >  
    window.onload = function () {      
      document.querySelector('input[type="file"]').addEventListener('change', function (e) {            
        readFile(e);
      });
    }
    const readFile = (e) => {
      const file = e.target.files[0]
      let reader = new FileReader();
      reader.onload = function (e) {
        let result = verifyPDF(reader.result);
        console.log(result);
      }
      reader.readAsArrayBuffer(file);
    };
  </script>
</head>
<body>
  <input type="file">
</body>
</html>

PDF

Listagem_Processos_%282%29_assinado.pdf

https://validar.iti.gov.br/relatorio.html
image

{"verified":false,"authenticity":false,"integrity":true,"expired":false,"signatures":[{"verified":false,"authenticity":false,"integrity":true,"expired":false,"meta":{"certs":[{"clientCertificate":true,"issuedBy":{"countryName":"BR","organizationName":"Gov-Br","organizationalUnitName":"AC Intermediaria do Governo Federal do Brasil v1","commonName":"AC Final do Governo Federal do Brasil v1"},"issuedTo":{"commonName":"ISAQUE NEVES SANT ANA"},"validityPeriod":{"notBefore":"2024-06-24T21:11:31.000Z","notAfter":"2025-06-24T21:11:31.000Z"},"pemCertificate":"-----BEGIN CERTIFICATE-----\r\nMIIGJDCCBAygAwIBAgIJAOgdUmg2gqgPMA0GCSqGSIb3DQEBCwUAMIGMMQswCQYD\r\nVQQGEwJCUjEPMA0GA1UECgwGR292LUJyMTkwNwYDVQQLDDBBQyBJbnRlcm1lZGlh\r\ncmlhIGRvIEdvdmVybm8gRmVkZXJhbCBkbyBCcmFzaWwgdjExMTAvBgNVBAMMKEFD\r\nIEZpbmFsIGRvIEdvdmVybm8gRmVkZXJhbCBkbyBCcmFzaWwgdjEwHhcNMjQwNjI0\r\nMjExMTMxWhcNMjUwNjI0MjExMTMxWjAgMR4wHAYDVQQDDBVJU0FRVUUgTkVWRVMg\r\nU0FOVCBBTkEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC63Asj0IHw\r\nUL6LHu6CPIwdOmSzNINJQAIpLzWq3hG0gObcss5fWt3A5wpcQ8GRBaP/0lFMziS5\r\nts/CUVN/NyQB4qXrLOQRYqdX9k6M+77MWgf/04xWalCa0HQa3PC/EsxS3bTN1uEx\r\nnDVzYpdKN7/G7aqSj1TrlJeGyqMzf0ch8ny332tTQukQfi3Hxjt8V4RMMV584Oo/\r\nYWH5Cn6arScCqof8xWdOONU4XX7iihzQDuKnvSvVR0Gf0/BeGME+ZHWB/OfIBLPx\r\nJtvalMFjvsdV/bZXBVDhX7dusXrVPb83uktu9bXxqgpsMKQb6gA/jaxThTbWrW0z\r\nIVqIiUH0DPFnAgMBAAGjggHyMIIB7jCBlQYDVR0RBIGNMIGKoDgGBWBMAQMBoC8E\r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8BX42DpgdKprqg8zTrZpxbdrZqWAYzzKk+\r\nixWUjiGnXAvRMAKB+RESdMjvtD2jU9BQXRx3yTxmwCg8A0WNcB+L/j4cXji1PJ5U\r\nJKUkCOFjDqovV50z/9KLOX2AOfKtHADGDkLNenhmee6yk86uPzkFuj+YTz15iqgh\r\n6isuYpOwcGkhZ5Cu5gpDZdl0EwEput4QXy1VbDWZW8dVpKcaH8LKbbMFPSCDnMQU\r\n77rt+EBoJjVE8YXzJYqWC/kFRyQOBheeivb48MIlUtE+JbTGHgV74+D4xvpJ8pQr\r\nKiIEJZMOJgwCR352jV0R3zZZshAqLI6jFhO7STdcNJf+tOlUApvlcA==\r\n-----END CERTIFICATE-----\r\n"}],"signatureMeta":{"reason":null,"contactInfo":null,"location":null,"name":null}}}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant