diff --git a/dist/index.test.js b/dist/index.test.js index 894a4fe..9ec6533 100644 --- a/dist/index.test.js +++ b/dist/index.test.js @@ -46,7 +46,7 @@ describe('index', () => { privateKey = priv; dataRequest = { healthDepartment: 'Test Health Department', - keyOfHealthDepartment: publicKey, + key: Buffer.from(publicKey, 'utf-8').toString('base64'), keyReferenz: 'random-string-keyref', start: '2011-10-05T14:48:00.000Z', end: '2021-10-05T14:48:00.000Z', @@ -67,7 +67,7 @@ describe('index', () => { end: '2021-10-05T14:48:00.000Z', }); expect(mockedAxios.get).toHaveBeenCalledWith('/data-requests/12345-abcde'); - mockedAxios.post.mockResolvedValue({ status: 200, data: { success: true } }); + mockedAxios.post.mockResolvedValue({ status: 201, data: { success: true } }); await iris.sendContactsEvents('12345-abcde', submission, { firstName: 'Hans', lastName: 'Müller', diff --git a/dist/index.test.js.map b/dist/index.test.js.map index ae4eb6b..cd9a59f 100644 --- a/dist/index.test.js.map +++ b/dist/index.test.js.map @@ -1 +1 @@ -{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":";;AAAA,iCAA0B;AAC1B,iCAAiC;AAEjC,wBAAqB;AAIrB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnB,MAAM,WAAW,GAAG,eAAkC,CAAC;AAEvD,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,IAAI,UAAkB,CAAC;IACvB,IAAI,SAAiB,CAAC;IACtB,IAAI,WAA+B,CAAC;IACpC,MAAM,UAAU,GAAuB;QACrC,QAAQ,EAAE;YACR,cAAc,EAAE,EAAE;YAClB,YAAY,EAAE;gBACZ,SAAS,EAAE,MAAM;gBACjB,QAAQ,EAAE,QAAQ;aACnB;SACF;QACD,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,YAAY,EAAE;gBACZ,SAAS,EAAE,MAAM;gBACjB,QAAQ,EAAE,QAAQ;aACnB;SACF;KACF,CAAC;IACF,SAAS,CAAC,CAAC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AC,CAAC,CAAC,CAAC;QAExD,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1G,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEzG,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CACxC,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,EAC7C,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAC5C,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QAClH,IAAI,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACvF,iBAAiB,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/lib/Iris.js b/dist/lib/Iris.js index ab2a0ac..465b8a2 100644 --- a/dist/lib/Iris.js +++ b/dist/lib/Iris.js @@ -22,7 +22,7 @@ class Iris { } const dataRequest = response.data; this.codeKeyMap.set(code, { - keyOfHealthDepartment: dataRequest.keyOfHealthDepartment, + key: dataRequest.key, keyReferenz: dataRequest.keyReferenz, }); return { @@ -37,15 +37,15 @@ class Iris { throw new Error("Code could not be found in key map. Did you perform 'getDataRequest' before?"); } const keys = this.codeKeyMap.get(code); - const { dataToTransport, keyToTransport, nonce } = crypto_1.encryptData(keys.keyOfHealthDepartment, data); + const { dataToTransport, keyToTransport, nonce } = crypto_1.encryptData(keys.key, data); const response = await this.axiosInstance.post(`/data-submissions/${code}/contacts_events`, { - checkCode: [util_1.getNameCheckHash(user.firstName, user.lastName), util_1.getBirthDateCheckHash(user.birthDate)].filter(c => !!c), + checkCode: [util_1.getNameCheckHash(user.firstName, user.lastName), util_1.getBirthDateCheckHash(user.birthDate)].filter((c) => !!c), secret: keyToTransport, keyReferenz: keys.keyReferenz, encryptedData: dataToTransport, - nonce + nonce, }); - if (response.status !== 200) { + if (response.status !== 201) { console.error('IRIS Gateway responded the following data', response.data); throw new Error(`Request failed with status Code ${response.status}`); } diff --git a/dist/lib/Iris.js.map b/dist/lib/Iris.js.map index d81208e..a3f1a8a 100644 --- a/dist/lib/Iris.js.map +++ b/dist/lib/Iris.js.map @@ -1 +1 @@ -{"version":3,"file":"Iris.js","sourceRoot":"","sources":["../../src/lib/Iris.ts"],"names":[],"mappings":";;AAAA,iCAA6C;AAE7C,qCAAuC;AACvC,iCAAiE;AAWjE,MAAM,cAAc,GAAgB;IAClC,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAqB,IAAI;IAIvB,YAAY,OAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAgB,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,GAAG,eAAK,CAAC,MAAM,CAAC;YAChC,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,IAAc;QACjC,MAAM,QAAQ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AAE,eAAe;YAC9B,KAAK;SAC6B,CAAC,CAAC;QACtC,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;YAC3B,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC1E,MAAM,IAAI,KAAK,CAAC,mCAAmC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;SACvE;IACH,CAAC;CACF;AAnDD,uBAmDC"} \ No newline at end of file diff --git a/dist/lib/crypto.js b/dist/lib/crypto.js index e00eb22..6e09326 100644 --- a/dist/lib/crypto.js +++ b/dist/lib/crypto.js @@ -8,7 +8,7 @@ function encryptData(keyOfHealthDepartment, data) { const cipher = crypto.createCipheriv('AES-256-CBC', key, nonce); const dataString = JSON.stringify(data); const encryptedData = Buffer.concat([cipher.update(dataString, 'utf8'), cipher.final()]); - const encryptedKey = crypto.publicEncrypt({ key: keyOfHealthDepartment }, key); + const encryptedKey = crypto.publicEncrypt({ key: Buffer.from(keyOfHealthDepartment, 'base64') }, key); return { dataToTransport: encryptedData.toString('base64'), keyToTransport: encryptedKey.toString('base64'), diff --git a/dist/lib/crypto.js.map b/dist/lib/crypto.js.map index 767dc06..9cd1e68 100644 --- a/dist/lib/crypto.js.map +++ b/dist/lib/crypto.js.map @@ -1 +1 @@ -{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src/lib/crypto.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEjC,SAAgB,WAAW,CACzB,qBAA6B,EAC7B,IAAI;IAEJ,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACrC,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,C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Ae,EAAE,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACjD,cAAc,EAAE,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC/C,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;KAChC,CAAC;AACJ,CAAC;AAfD,kCAeC"} \ No newline at end of file diff --git a/dist/types/IrisCodeKeyMap.d.ts b/dist/types/IrisCodeKeyMap.d.ts index 1860130..1e2c8df 100644 --- a/dist/types/IrisCodeKeyMap.d.ts +++ b/dist/types/IrisCodeKeyMap.d.ts @@ -1,4 +1,4 @@ import IrisDataRequestDTO from './dto/IrisDataRequestDTO'; import IrisCode from './IrisCode'; -declare type IrisCodeKeyMap = Map>; +declare type IrisCodeKeyMap = Map>; export default IrisCodeKeyMap; diff --git a/dist/types/dto/IrisDataRequestDTO.d.ts b/dist/types/dto/IrisDataRequestDTO.d.ts index 4f0e0ca..e5acd0c 100644 --- a/dist/types/dto/IrisDataRequestDTO.d.ts +++ b/dist/types/dto/IrisDataRequestDTO.d.ts @@ -1,6 +1,6 @@ export default interface IrisDataRequestDTO { healthDepartment: string; - keyOfHealthDepartment: string; + key: string; keyReferenz: string; start?: string; end?: string; diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index ed73029..5f880f7 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.1.4](https://github.com/InOG-projects/IRIS-library-js/compare/v1.1.3...v1.1.4) (2021-03-21) + + +### Bug Fixes + +* adjust data request format of health office key ([8fcf3eb](https://github.com/InOG-projects/IRIS-library-js/commit/8fcf3ebf3a69d693cea9f76180017e10622a277a)) + ## [1.1.3](https://github.com/InOG-projects/IRIS-library-js/compare/v1.1.2...v1.1.3) (2021-03-21) diff --git a/package.json b/package.json index 0efc35f..81954de 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "type": "git", "url": "https://github.com/InOG-projects/IRIS-library-js.git" }, - "version": "1.1.3", + "version": "1.1.4", "dependencies": { "axios": "^0.21.1" },