From bf3cad5bf55e1176ed22e79ddea89b621a4fc288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=B6ssler?= Date: Sat, 16 Dec 2023 15:45:26 +0100 Subject: [PATCH] fix: tests, eslint and docs --- package-lock.json | 8 ++--- package.json | 4 +-- src/ocsp.ts | 2 +- test/certs/le-staging-revoked.pem | 56 +++++++++++++++---------------- test/le-revoked.test.ts | 8 ++--- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3b61a6d..5c4d3ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "@typescript-eslint/eslint-plugin": "^6.5.0", "@typescript-eslint/parser": "^6.5.0", "eslint": "^8.32.0", - "eslint-plugin-security": "^2.1.0", + "eslint-plugin-security": "^1.7.1", "jest": "^29.5.0", "license-checker-rseidelsohn": "^4.2.10", "prettier": "^3.0.3", @@ -3565,9 +3565,9 @@ } }, "node_modules/eslint-plugin-security": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-security/-/eslint-plugin-security-2.1.0.tgz", - "integrity": "sha512-ywxclP954bf8d3gr6KOQ/AFc+PRvWuhOxtPOEtiHmVYiZr/mcgQtmSJq6+hTEXC5ylTjHnPPG+PEnzlDiWMXbQ==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-security/-/eslint-plugin-security-1.7.1.tgz", + "integrity": "sha512-sMStceig8AFglhhT2LqlU5r+/fn9OwsA72O5bBuQVTssPCdQAOQzL+oMn/ZcpeUY6KcNfLJArgcrsSULNjYYdQ==", "dev": true, "dependencies": { "safe-regex": "^2.1.1" diff --git a/package.json b/package.json index 7a2562f..b897389 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "lint": "eslint .", "format": "prettier --write .", "build": "tsup", - "build-docs": "typedoc" + "build-docs": "typedoc --skipErrorChecking" }, "repository": { "type": "git", @@ -46,7 +46,7 @@ "@typescript-eslint/eslint-plugin": "^6.5.0", "@typescript-eslint/parser": "^6.5.0", "eslint": "^8.32.0", - "eslint-plugin-security": "^2.1.0", + "eslint-plugin-security": "^1.7.1", "jest": "^29.5.0", "license-checker-rseidelsohn": "^4.2.10", "prettier": "^3.0.3", diff --git a/src/ocsp.ts b/src/ocsp.ts index fa7d491..37ad07f 100644 --- a/src/ocsp.ts +++ b/src/ocsp.ts @@ -6,7 +6,7 @@ import { OCSPStatusConfig, OCSPStatusResponse } from './index'; const cryptoEngine = new pkijs.CryptoEngine({ crypto: webcrypto as Crypto, }); -pkijs.setEngine('crypto', cryptoEngine); +pkijs.setEngine('crypto', cryptoEngine as pkijs.ICryptoEngine); export async function buildOCSPRequest(cert: pkijs.Certificate, issuerCert: pkijs.Certificate, config: OCSPStatusConfig) { const ocspReq = new pkijs.OCSPRequest(); diff --git a/test/certs/le-staging-revoked.pem b/test/certs/le-staging-revoked.pem index 1e990b1..9e369a3 100644 --- a/test/certs/le-staging-revoked.pem +++ b/test/certs/le-staging-revoked.pem @@ -1,30 +1,30 @@ -----BEGIN CERTIFICATE----- -MIIFHDCCBASgAwIBAgITAPrwMJBK4Y2dP9dC98evjCEFqDANBgkqhkiG9w0BAQsF -ADBZMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXKFNUQUdJTkcpIExldCdzIEVuY3J5 -cHQxKDAmBgNVBAMTHyhTVEFHSU5HKSBBcnRpZmljaWFsIEFwcmljb3QgUjMwHhcN -MjMwODIwMTE1MTUwWhcNMjMxMTE4MTE1MTQ5WjAUMRIwEAYDVQQDEwl0aW55dGsu -ZGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2kLmYtVHF/3RwtGTl -e9h0qRf2MJCNuAlURdeVlRra0VGw49yI0UcFn4PUbwXIvIXjo9USq2q38Bpuhfuu -xEnMA9l83GeObobkqVBM1kcgW8TAVyuieaXfxXtZz6B58Iwea8v3RXVbxJCg38cW -vxEHf0sA9VnpnhMulU++u7hP/IopqNYzQnd4CMZULoLO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I99XN0tdLmUw +XQYIKwYBBQUHAQEEUTBPMCUGCCsGAQUFBzABhhlodHRwOi8vc3RnLXIzLm8ubGVu +Y3Iub3JnMCYGCCsGAQUFBzAChhpodHRwOi8vc3RnLXIzLmkubGVuY3Iub3JnLzAn +BgNVHREEIDAegg4qLnRrb2Vzc2xlci5kZYIMdGtvZXNzbGVyLmRlMBMGA1UdIAQM +MAowCAYGZ4EMAQIBMIIBBAYKKwYBBAHWeQIEAgSB9QSB8gDwAHYAFuhpwdGV6tfD ++Jca4/B2AfeM4badMahSGLaDfzGoFQgAAAGMcu8UKAAABAMARzBFAiAZ0Nm1O4dz +BbRBYHhjNAuMQmzZuKycJ04lVPh+hMNGcwIhANVSHrskpghjtItJaEaXeCjaNncI +qLLxpr3k6B74RnoHAHYAsMyD5aX5fWuvfAnMKEkEhyrH6IsTLGNQt8b9JuFsbHcA +AAGMcu8UBQAABAMARzBFAiEA53GVn/OqrwHA0/0ef7oLI5eVoBgT18uJOoHYoyPT +fgMCIGJ5oVlpfMzr/q1cS1GgymVRzrMlpwqU3B0uEqi4Ov2nMA0GCSqGSIb3DQEB +CwUAA4IBAQA1CzrbWvB5jyhrF7Lrmktl3iwpJgp/c9y4QgYOG2zwU+Us3tbc3KWu +R35CZ/FvENcMtu/5UV9DkH6w+PheV47k/vkEYTkcWFpPNkNsZY22ehsgIJBQap6D +ybJ+rIrPRoozy7ZNpVjcaQkkFtJnqiKn2ljmDmc8+IS5xNBBREBsvpwq7GTLsOSF +fJ0iT38Q0/u9JtENstXg0hjJojsR3R1f3oixFUzUg8TYTMxf03wB25BH8dWe+smX +0fBwfVyr+SB6BiCS1dFRnSOIS7oVKUJPB6m1bTyKenMrrJ2Gk8mfIOSbh7EsfYzI +dRyt2ydWrDIBb3r57+E+iMatC0I3DlXe -----END CERTIFICATE----- diff --git a/test/le-revoked.test.ts b/test/le-revoked.test.ts index da37cfe..1320b17 100644 --- a/test/le-revoked.test.ts +++ b/test/le-revoked.test.ts @@ -13,7 +13,7 @@ beforeAll(async () => { test('Check revoked Lets Encrypt cert', async () => { const result = await getCertStatus(cert); expect(result.status).toBe('revoked'); - expect(result.revocationTime?.getTime()).toBe(1694016850000); + expect(result.revocationTime?.getTime()).toBe(1702737476000); }); test('Get OCSP and issuer URLs', async () => { @@ -35,7 +35,7 @@ test('Set ocsp url manually', async () => { ocspUrl: 'http://stg-r3.o.lencr.org', }); expect(result.status).toBe('revoked'); - expect(result.revocationTime?.getTime()).toBe(1694016850000); + expect(result.revocationTime?.getTime()).toBe(1702737476000); }); test('Set ca manually', async () => { @@ -43,11 +43,11 @@ test('Set ca manually', async () => { ca: intermediateCA, }); expect(result.status).toBe('revoked'); - expect(result.revocationTime?.getTime()).toBe(1694016850000); + expect(result.revocationTime?.getTime()).toBe(1702737476000); }); test('Pass X509Certificate object', async () => { const result = await getCertStatus(new X509Certificate(cert)); expect(result.status).toBe('revoked'); - expect(result.revocationTime?.getTime()).toBe(1694016850000); + expect(result.revocationTime?.getTime()).toBe(1702737476000); });