From b2ab2e4326b3307721e35b146a6d668138669873 Mon Sep 17 00:00:00 2001 From: Christian Paquin Date: Fri, 12 Mar 2021 12:04:01 -0500 Subject: [PATCH] Cleaned up TODOs --- TODO.md | 1 - src/shcKeyValidator.ts | 1 + ...xample-00-f-qr-code-numeric-wrong_qr_mode.txt | 1 - tests/card.test.ts | 16 +--------------- 4 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 testdata/test-example-00-f-qr-code-numeric-wrong_qr_mode.txt diff --git a/TODO.md b/TODO.md index 0ae20ac..309f8cd 100644 --- a/TODO.md +++ b/TODO.md @@ -3,7 +3,6 @@ Assigned to (C)hristian, (L)arry, (K)aren, (?) Unassigned Priority: P1 (needed for release), P2, P3, ... *Release checklist* -- [ ] Review dependencies to OSS release [tool](https://msrtcrypto.visualstudio.com/Security%20and%20Cryptography/_componentGovernance/176514?_a=components&typeId=-2) (C) - [ ] Remove azure pipeline yml file - [ ] grep for TODO and FIXME - [ ] run tests from a fresh clone on Windows and Linux (and mac) \ No newline at end of file diff --git a/src/shcKeyValidator.ts b/src/shcKeyValidator.ts index ec0d68b..b330dc4 100644 --- a/src/shcKeyValidator.ts +++ b/src/shcKeyValidator.ts @@ -35,6 +35,7 @@ export async function verifyHealthCardIssuerKey(keySet: KeySet, log = new Log('V // check for private key material (as to happen before the following store.add, because the returned // value will be the corresponding public key) // TODO: this is RSA/ECDSA specific, find a different API to detect private keys more broadly + // (although the spec mandates ECDSA, for now...) if ((key as (JWK.Key & { d: string })).d) { log.error(keyName + ': ' + "key contains private key material.", ErrorCode.INVALID_KEY_PRIVATE); } diff --git a/testdata/test-example-00-f-qr-code-numeric-wrong_qr_mode.txt b/testdata/test-example-00-f-qr-code-numeric-wrong_qr_mode.txt deleted file mode 100644 index 6cd1fbf..0000000 --- a/testdata/test-example-00-f-qr-code-numeric-wrong_qr_mode.txt +++ /dev/null @@ -1 +0,0 @@ -shc:/5676290952432060346029243740446031222959532654603460292540772804336028702864716745222809286133314564376531415906402203064504590856435503414245413640370636654171372412363803043756220467374075323239254334433260573601064135315371707424357641442734412941253409636865757209633741202438336731073633336938034257215862295570331234125503655352206925737240360662693477321034694508235636740471222171572507434306284042723667713169596957282410696154305740272023590462282764206465045833003575105738420841414145552031682950596210206407281056571008365369575357237334694170434154620025702959587645286965773732045962243544536121405003326441082472251175543212397269104369696925643523635661562740373153437261357733581039642863234443614570266843122557734431430059223327636867423471356928401133334372523200343171692334337466597509260665212307635306211134276225444540607166323852722305252020755503671255076620675068092932236711206975201264595658284569732520746941407520550659612334677508690552342928430004533977355463583245272233676826670468210803695640253245652760280666006434386152683859602610254104103130093150122710583235654050050703072561203569723723380733740560402744376767043272310635682000536055336863423971244475095431316759231261585924686638686532227426233144272233295463536603243771507645302822712408122939333570621244266038665331522673612926062650732766315358343204214227327654287512275464432371030773400910063363755563006361450534700664423204573733446776546143251134545310401257397774290670506541361172550864293569287221736111010453722456054320601104036668440877413828285236452304036841752211423112262508615005396562442133327161535504685274605409253240045534734466246256583406710861615859247336692420 \ No newline at end of file diff --git a/tests/card.test.ts b/tests/card.test.ts index 55bd2a3..e5f28bc 100644 --- a/tests/card.test.ts +++ b/tests/card.test.ts @@ -15,7 +15,7 @@ type flatLogItems = { title: string, message: string, code: ErrorCode, level: Lo async function testCard(fileName: string | string[], fileType: ValidationType = 'healthcard', levels: LogLevels[] = [LogLevels.WARNING, LogLevels.ERROR, LogLevels.FATAL]): Promise { if (typeof fileName === 'string') fileName = [fileName]; const files = []; - for (const fn of fileName) { // TODO: I tried a map here, but TS didn't like the async callback + for (const fn of fileName) { files.push(await getFileData(path.join(testdataDir, fn))); } const log = (await validateCard(files, fileType)).log; @@ -91,26 +91,12 @@ test("Cards: invalid issuer url", async () => { expect(results[0].code).toBe(ErrorCode.ISSUER_KEY_DOWNLOAD_ERROR); }); -// TODO: Test not working: fix it -// test("Cards: invalid QR mode", async () => { -// const results = await testCard('test-example-00-f-qr-code-numeric-wrong_qr_mode.txt', 'qr'); -// expect(results).toHaveLength(1); -// expect(results[0].code).toBe(ErrorCode.ERROR); // TODO: Create error code for this case -// }); - test("Cards: invalid QR header", async () => { const results = await testCard(['test-example-00-f-qr-code-numeric-wrong_qr_header.txt'], 'qrnumeric'); expect(results).toHaveLength(1); expect(results[0].code).toBe(ErrorCode.INVALID_NUMERIC_QR_HEADER); }); -// TODO: FIX this test -// test("Cards:JWS too long", async () => { -// const results = await testCard(['test-example-00-d-jws-jws_too_long.txt'], 'jws'); -// expect(results).toHaveLength(1); -// expect(results[0].code).toBe(ErrorCode.JWS_TOO_LONG); -// }); - test("Cards: wrong file extension", async () => { const results = await testCard(['test-example-00-e-file.wrong-extension'], 'healthcard', [LogLevels.WARNING, LogLevels.ERROR, LogLevels.FATAL]); expect(results).toHaveLength(1);