@icure/api 8.0.64 → 8.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/icc-api/api/internal/IccExchangeDataApi.d.ts +2 -0
- package/icc-api/api/internal/IccExchangeDataApi.js +10 -0
- package/icc-api/api/internal/IccExchangeDataApi.js.map +1 -1
- package/icc-api/iccApi.d.ts +0 -1
- package/icc-api/iccApi.js +0 -1
- package/icc-api/iccApi.js.map +1 -1
- package/icc-api/index.d.ts +0 -1
- package/icc-api/index.js +0 -1
- package/icc-api/index.js.map +1 -1
- package/icc-x-api/crypto/AccessControlSecretUtils.d.ts +4 -13
- package/icc-x-api/crypto/AccessControlSecretUtils.js +19 -29
- package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -1
- package/icc-x-api/crypto/BaseExchangeDataManager.d.ts +8 -3
- package/icc-x-api/crypto/BaseExchangeDataManager.js +45 -10
- package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/BaseExchangeKeysManager.d.ts +2 -3
- package/icc-x-api/crypto/BaseExchangeKeysManager.js +17 -20
- package/icc-x-api/crypto/BaseExchangeKeysManager.js.map +1 -1
- package/icc-x-api/crypto/CryptoPrimitives.d.ts +2 -0
- package/icc-x-api/crypto/CryptoPrimitives.js +3 -0
- package/icc-x-api/crypto/CryptoPrimitives.js.map +1 -1
- package/icc-x-api/crypto/DelegationsDeAnonymization.d.ts +3 -3
- package/icc-x-api/crypto/DelegationsDeAnonymization.js +7 -7
- package/icc-x-api/crypto/DelegationsDeAnonymization.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataManager.d.ts +19 -29
- package/icc-x-api/crypto/ExchangeDataManager.js +200 -225
- package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataMapManager.js +6 -4
- package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -1
- package/icc-x-api/crypto/ExchangeKeysManager.d.ts +4 -16
- package/icc-x-api/crypto/ExchangeKeysManager.js +44 -41
- package/icc-x-api/crypto/ExchangeKeysManager.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtils.d.ts +47 -25
- package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +19 -18
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +213 -134
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -1
- package/icc-x-api/crypto/HMACUtils.d.ts +2 -2
- package/icc-x-api/crypto/HMACUtils.js +3 -4
- package/icc-x-api/crypto/HMACUtils.js.map +1 -1
- package/icc-x-api/crypto/NativeCryptoPrimitivesBridge.d.ts +1 -0
- package/icc-x-api/crypto/NativeCryptoPrimitivesBridge.js +5 -0
- package/icc-x-api/crypto/NativeCryptoPrimitivesBridge.js.map +1 -1
- package/icc-x-api/crypto/SecureDelegationsManager.d.ts +0 -1
- package/icc-x-api/crypto/SecureDelegationsManager.js +17 -49
- package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -1
- package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +59 -90
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js +470 -56
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -1
- package/icc-x-api/crypto/ShamirKeysManager.js +1 -1
- package/icc-x-api/crypto/ShamirKeysManager.js.map +1 -1
- package/icc-x-api/crypto/TransferKeysManager.d.ts +1 -3
- package/icc-x-api/crypto/TransferKeysManager.js +2 -4
- package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.d.ts +2 -2
- package/icc-x-api/icc-accesslog-x-api.js +7 -3
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.js +4 -2
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +0 -1
- package/icc-x-api/icc-contact-x-api.js +33 -48
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.js +1 -1
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +2 -2
- package/icc-x-api/icc-document-x-api.js +45 -42
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.js +3 -1
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.js +4 -4
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.js +4 -2
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.js +4 -2
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.js +5 -7
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-topic-x-api.js +2 -2
- package/icc-x-api/icc-topic-x-api.js.map +1 -1
- package/icc-x-api/index.d.ts +6 -2
- package/icc-x-api/index.js +16 -20
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/utils/crypto-utils.d.ts +6 -4
- package/icc-x-api/utils/crypto-utils.js +27 -6
- package/icc-x-api/utils/crypto-utils.js.map +1 -1
- package/icc-x-api/utils/simple-lru-cache.d.ts +19 -0
- package/icc-x-api/utils/simple-lru-cache.js +90 -0
- package/icc-x-api/utils/simple-lru-cache.js.map +1 -0
- package/package.json +4 -2
- package/test/icc-x-api/crud/entities-crud-test-interface.js +0 -8
- package/test/icc-x-api/crud/entities-crud-test-interface.js.map +1 -1
- package/test/icc-x-api/crypto/exchange-data-manager-test.js +75 -93
- package/test/icc-x-api/crypto/exchange-data-manager-test.js.map +1 -1
- package/test/icc-x-api/crypto/legacy-metadata-migration-test.js.map +1 -1
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js +28 -16
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js.map +1 -1
- package/test/utils/FakeEncryptionKeysManager.d.ts +1 -0
- package/test/utils/FakeEncryptionKeysManager.js +11 -0
- package/test/utils/FakeEncryptionKeysManager.js.map +1 -1
- package/test/utils/FakeExchangeDataApi.d.ts +4 -2
- package/test/utils/FakeExchangeDataApi.js +24 -6
- package/test/utils/FakeExchangeDataApi.js.map +1 -1
- package/test/utils/FakeExchangeDataManager.d.ts +10 -10
- package/test/utils/FakeExchangeDataManager.js +12 -22
- package/test/utils/FakeExchangeDataManager.js.map +1 -1
- package/test/utils/TestApi.js +1 -0
- package/test/utils/TestApi.js.map +1 -1
- package/icc-api/api/IccArticleApi.d.ts +0 -72
- package/icc-api/api/IccArticleApi.js +0 -149
- package/icc-api/api/IccArticleApi.js.map +0 -1
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.d.ts +0 -33
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js +0 -141
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js.map +0 -1
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.d.ts +0 -46
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js +0 -312
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js.map +0 -1
- package/icc-x-api/crypto/UserSignatureKeysManager.d.ts +0 -26
- package/icc-x-api/crypto/UserSignatureKeysManager.js +0 -78
- package/icc-x-api/crypto/UserSignatureKeysManager.js.map +0 -1
- package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.d.ts +0 -1
- package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.js +0 -393
- package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.js.map +0 -1
- package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.d.ts +0 -1
- package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.js +0 -213
- package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.js.map +0 -1
- package/test/icc-x-api/crypto/signature-keys-manager-test.d.ts +0 -1
- package/test/icc-x-api/crypto/signature-keys-manager-test.js +0 -44
- package/test/icc-x-api/crypto/signature-keys-manager-test.js.map +0 -1
- package/test/utils/FakeSignatureKeysManager.d.ts +0 -16
- package/test/utils/FakeSignatureKeysManager.js +0 -54
- package/test/utils/FakeSignatureKeysManager.js.map +0 -1
|
@@ -2,6 +2,7 @@ import { XHR } from '../XHR';
|
|
|
2
2
|
import { AuthenticationProvider } from '../../../icc-x-api';
|
|
3
3
|
import { ExchangeData } from '../../model/internal/ExchangeData';
|
|
4
4
|
import { PaginatedListExchangeData } from '../../model/PaginatedListExchangeData';
|
|
5
|
+
import { ListOfIds } from '../../model/ListOfIds';
|
|
5
6
|
export declare class IccExchangeDataApi {
|
|
6
7
|
host: string;
|
|
7
8
|
headers: Array<XHR.Header>;
|
|
@@ -13,6 +14,7 @@ export declare class IccExchangeDataApi {
|
|
|
13
14
|
createExchangeData(body?: ExchangeData): Promise<ExchangeData>;
|
|
14
15
|
modifyExchangeData(body?: ExchangeData): Promise<ExchangeData>;
|
|
15
16
|
getExchangeDataById(exchangeDataId: string): Promise<ExchangeData>;
|
|
17
|
+
getExchangeDataByIds(body: ListOfIds): Promise<ExchangeData[]>;
|
|
16
18
|
getExchangeDataByDelegatorDelegate(delegatorId: string, delegateId: string): Promise<ExchangeData[]>;
|
|
17
19
|
getExchangeDataByParticipant(dataOwnerId: string, startDocumentId?: string, limit?: number): Promise<PaginatedListExchangeData>;
|
|
18
20
|
getExchangeDataParticipantCounterparts(dataOwnerId: string, counterpartTypes: string): Promise<string[]>;
|
|
@@ -58,6 +58,16 @@ class IccExchangeDataApi {
|
|
|
58
58
|
.catch((err) => this.handleError(err));
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
+
getExchangeDataByIds(body) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const _url = this.host + `/exchangedata/byIds` + '?ts=' + new Date().getTime();
|
|
64
|
+
let headers = this.headers;
|
|
65
|
+
headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
|
|
66
|
+
return XHR_1.XHR.sendCommand('POST', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
|
|
67
|
+
.then((doc) => doc.body.map((it) => new ExchangeData_1.ExchangeData(it)))
|
|
68
|
+
.catch((err) => this.handleError(err));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
61
71
|
getExchangeDataByDelegatorDelegate(delegatorId, delegateId) {
|
|
62
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
73
|
const _url = this.host +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IccExchangeDataApi.js","sourceRoot":"","sources":["../../../../icc-api/api/internal/IccExchangeDataApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAA4B;AAC5B,kDAAqF;AACrF,oEAAgE;AAChE,qFAAiF;AACjF,sDAAkD;AAElD,MAAa,kBAAkB;IAM7B,YACE,IAAY,EACZ,OAAY,EACZ,sBAA+C,EAC/C,SAAyE;QAEzE,IAAI,CAAC,IAAI,GAAG,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAA;QAChC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,SAAG,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC7E,IAAI,CAAC,sBAAsB,GAAG,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,oCAAwB,EAAE,CAAA;QAChH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAED,UAAU,CAAC,CAAoB;QAC7B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAA;IAClB,CAAC;IAED,WAAW,CAAC,C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M,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC,CAAA;YACvH,OAAO,SAAG,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,CAAC;iBACxH,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAE,GAAG,CAAC,IAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;iBACpF,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;QAC1C,CAAC;KAAA;CACF;AA/FD,gDA+FC","sourcesContent":["import { XHR } from '../XHR'\nimport { AuthenticationProvider, NoAuthenticationProvider } from '../../../icc-x-api'\nimport { ExchangeData } from '../../model/internal/ExchangeData'\nimport { PaginatedListExchangeData } from '../../model/PaginatedListExchangeData'\nimport { iccRestApiPath } from '../IccRestApiPath'\n\nexport class IccExchangeDataApi {\n host: string\n headers: Array<XHR.Header>\n authenticationProvider: AuthenticationProvider\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n constructor(\n host: string,\n headers: any,\n authenticationProvider?: AuthenticationProvider,\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n ) {\n this.host = iccRestApiPath(host)\n this.headers = Object.keys(headers).map((k) => new XHR.Header(k, headers[k]))\n this.authenticationProvider = !!authenticationProvider ? authenticationProvider : new NoAuthenticationProvider()\n this.fetchImpl = fetchImpl\n }\n\n setHeaders(h: Array<XHR.Header>) {\n this.headers = h\n }\n\n handleError(e: XHR.XHRError): never {\n throw e\n }\n\n async createExchangeData(body?: ExchangeData): Promise<ExchangeData> {\n const _url = this.host + `/exchangedata` + '?ts=' + new Date().getTime()\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new ExchangeData(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n async modifyExchangeData(body?: ExchangeData): Promise<ExchangeData> {\n const _url = this.host + `/exchangedata` + '?ts=' + new Date().getTime()\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('PUT', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new ExchangeData(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n async getExchangeDataById(exchangeDataId: string): Promise<ExchangeData> {\n const _url = this.host + `/exchangedata/${encodeURIComponent(String(exchangeDataId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new ExchangeData(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n async getExchangeDataByDelegatorDelegate(delegatorId: string, delegateId: string): Promise<ExchangeData[]> {\n const _url =\n this.host +\n `/exchangedata/byDelegatorDelegate/${encodeURIComponent(String(delegatorId))}/${encodeURIComponent(String(delegateId))}` +\n '?ts=' +\n new Date().getTime()\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new ExchangeData(it)))\n .catch((err) => this.handleError(err))\n }\n\n async getExchangeDataByParticipant(dataOwnerId: string, startDocumentId?: string, limit?: number): Promise<PaginatedListExchangeData> {\n const _url =\n this.host +\n `/exchangedata/byParticipant/${encodeURIComponent(String(dataOwnerId))}` +\n '?ts=' +\n new Date().getTime() +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListExchangeData(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n async getExchangeDataParticipantCounterparts(dataOwnerId: string, counterpartTypes: string): Promise<string[]> {\n const _url =\n this.host +\n `/exchangedata/byParticipant/${encodeURIComponent(String(dataOwnerId))}/counterparts` +\n '?ts=' +\n new Date().getTime() +\n '&counterpartsTypes=' +\n encodeURIComponent(String(counterpartTypes))\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => JSON.parse(JSON.stringify(it))))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IccExchangeDataApi.js","sourceRoot":"","sources":["../../../../icc-api/api/internal/IccExchangeDataApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAA4B;AAC5B,kDAAqF;AACrF,oEAAgE;AAChE,qFAAiF;AACjF,sDAAkD;AAGlD,MAAa,kBAAkB;IAM7B,YACE,IAAY,EACZ,OAAY,EACZ,sBAA+C,EAC/C,SAAyE;QAEzE,IAAI,CAAC,IAAI,GAAG,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAA;QAChC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,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,EAAE,kBAAkB,CAAC,CAAC,CAAA;YACvH,OAAO,SAAG,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,CAAC;iBACxH,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAE,GAAG,CAAC,IAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;iBACpF,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;QAC1C,CAAC;KAAA;CACF;AAxGD,gDAwGC","sourcesContent":["import { XHR } from '../XHR'\nimport { AuthenticationProvider, NoAuthenticationProvider } from '../../../icc-x-api'\nimport { ExchangeData } from '../../model/internal/ExchangeData'\nimport { PaginatedListExchangeData } from '../../model/PaginatedListExchangeData'\nimport { iccRestApiPath } from '../IccRestApiPath'\nimport { ListOfIds } from '../../model/ListOfIds'\n\nexport class IccExchangeDataApi {\n host: string\n headers: Array<XHR.Header>\n authenticationProvider: AuthenticationProvider\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n constructor(\n host: string,\n headers: any,\n authenticationProvider?: AuthenticationProvider,\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n ) {\n this.host = iccRestApiPath(host)\n this.headers = Object.keys(headers).map((k) => new XHR.Header(k, headers[k]))\n this.authenticationProvider = !!authenticationProvider ? authenticationProvider : new NoAuthenticationProvider()\n this.fetchImpl = fetchImpl\n }\n\n setHeaders(h: Array<XHR.Header>) {\n this.headers = h\n }\n\n handleError(e: XHR.XHRError): never {\n throw e\n }\n\n async createExchangeData(body?: ExchangeData): Promise<ExchangeData> {\n const _url = this.host + `/exchangedata` + '?ts=' + new Date().getTime()\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new ExchangeData(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n async modifyExchangeData(body?: ExchangeData): Promise<ExchangeData> {\n const _url = this.host + `/exchangedata` + '?ts=' + new Date().getTime()\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('PUT', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new ExchangeData(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n async getExchangeDataById(exchangeDataId: string): Promise<ExchangeData> {\n const _url = this.host + `/exchangedata/${encodeURIComponent(String(exchangeDataId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new ExchangeData(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n async getExchangeDataByIds(body: ListOfIds): Promise<ExchangeData[]> {\n const _url = this.host + `/exchangedata/byIds` + '?ts=' + new Date().getTime()\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new ExchangeData(it)))\n .catch((err) => this.handleError(err))\n }\n\n async getExchangeDataByDelegatorDelegate(delegatorId: string, delegateId: string): Promise<ExchangeData[]> {\n const _url =\n this.host +\n `/exchangedata/byDelegatorDelegate/${encodeURIComponent(String(delegatorId))}/${encodeURIComponent(String(delegateId))}` +\n '?ts=' +\n new Date().getTime()\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new ExchangeData(it)))\n .catch((err) => this.handleError(err))\n }\n\n async getExchangeDataByParticipant(dataOwnerId: string, startDocumentId?: string, limit?: number): Promise<PaginatedListExchangeData> {\n const _url =\n this.host +\n `/exchangedata/byParticipant/${encodeURIComponent(String(dataOwnerId))}` +\n '?ts=' +\n new Date().getTime() +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListExchangeData(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n async getExchangeDataParticipantCounterparts(dataOwnerId: string, counterpartTypes: string): Promise<string[]> {\n const _url =\n this.host +\n `/exchangedata/byParticipant/${encodeURIComponent(String(dataOwnerId))}/counterparts` +\n '?ts=' +\n new Date().getTime() +\n '&counterpartsTypes=' +\n encodeURIComponent(String(counterpartTypes))\n let headers = this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => JSON.parse(JSON.stringify(it))))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
|
package/icc-api/iccApi.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from './api/IccAccesslogApi';
|
|
|
2
2
|
export * from './api/IccAgendaApi';
|
|
3
3
|
export * from './api/IccAnonymousAccessApi';
|
|
4
4
|
export * from './api/IccApplicationsettingsApi';
|
|
5
|
-
export * from './api/IccArticleApi';
|
|
6
5
|
export * from './api/IccAuthApi';
|
|
7
6
|
export * from './api/IccBeefactApi';
|
|
8
7
|
export * from './api/IccBekmehrApi';
|
package/icc-api/iccApi.js
CHANGED
|
@@ -18,7 +18,6 @@ __exportStar(require("./api/IccAccesslogApi"), exports);
|
|
|
18
18
|
__exportStar(require("./api/IccAgendaApi"), exports);
|
|
19
19
|
__exportStar(require("./api/IccAnonymousAccessApi"), exports);
|
|
20
20
|
__exportStar(require("./api/IccApplicationsettingsApi"), exports);
|
|
21
|
-
__exportStar(require("./api/IccArticleApi"), exports);
|
|
22
21
|
__exportStar(require("./api/IccAuthApi"), exports);
|
|
23
22
|
__exportStar(require("./api/IccBeefactApi"), exports);
|
|
24
23
|
__exportStar(require("./api/IccBekmehrApi"), exports);
|
package/icc-api/iccApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iccApi.js","sourceRoot":"","sources":["../../icc-api/iccApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,qDAAkC;AAClC,8DAA2C;AAC3C,kEAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"iccApi.js","sourceRoot":"","sources":["../../icc-api/iccApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,qDAAkC;AAClC,8DAA2C;AAC3C,kEAA+C;AAC/C,mDAAgC;AAChC,sDAAmC;AACnC,sDAAmC;AACnC,6DAA0C;AAC1C,6DAA0C;AAC1C,sDAAmC;AACnC,2DAAwC;AACxC,+DAA4C;AAC5C,6DAA0C;AAC1C,qEAAkD;AAClD,mDAAgC;AAChC,sDAAmC;AACnC,wDAAqC;AACrC,qDAAkC;AAClC,0DAAuC;AACvC,uDAAoC;AACpC,wDAAqC;AACrC,6DAA0C;AAC1C,mDAAgC;AAChC,gEAA6C;AAC7C,oDAAiC;AACjC,sDAAmC;AACnC,uDAAoC;AACpC,oDAAiC;AACjC,wDAAqC;AACrC,sDAAmC;AACnC,sDAAmC;AACnC,8DAA2C;AAC3C,oDAAiC;AACjC,8DAA2C;AAC3C,sDAAmC;AACnC,sDAAmC;AACnC,yDAAsC;AACtC,oDAAiC;AACjC,qDAAkC;AAClC,sDAAmC;AACnC,0DAAuC;AACvC,2DAAwC;AACxC,wDAAqC;AACrC,kDAA+B;AAC/B,mDAAgC","sourcesContent":["export * from './api/IccAccesslogApi'\nexport * from './api/IccAgendaApi'\nexport * from './api/IccAnonymousAccessApi'\nexport * from './api/IccApplicationsettingsApi'\nexport * from './api/IccAuthApi'\nexport * from './api/IccBeefactApi'\nexport * from './api/IccBekmehrApi'\nexport * from './api/IccBeresultexportApi'\nexport * from './api/IccBeresultimportApi'\nexport * from './api/IccBesamv2Api'\nexport * from './api/IccCalendarItemApi'\nexport * from './api/IccCalendarItemTypeApi'\nexport * from './api/IccClassificationApi'\nexport * from './api/IccClassificationTemplateApi'\nexport * from './api/IccCodeApi'\nexport * from './api/IccContactApi'\nexport * from './api/IccDataownerApi'\nexport * from './api/IccDeviceApi'\nexport * from './api/IccDoctemplateApi'\nexport * from './api/IccDocumentApi'\nexport * from './api/IccEntityrefApi'\nexport * from './api/IccEntitytemplateApi'\nexport * from './api/IccFormApi'\nexport * from './api/IccFrontendmigrationApi'\nexport * from './api/IccGroupApi'\nexport * from './api/IccHcpartyApi'\nexport * from './api/IccHelementApi'\nexport * from './api/IccIcureApi'\nexport * from './api/IccInsuranceApi'\nexport * from './api/IccInvoiceApi'\nexport * from './api/IccKeywordApi'\nexport * from './api/IccMaintenanceTaskApi'\nexport * from './api/IccMedexApi'\nexport * from './api/IccMedicallocationApi'\nexport * from './api/IccMessageApi'\nexport * from './api/IccPatientApi'\nexport * from './api/IccPermissionApi'\nexport * from './api/IccPlaceApi'\nexport * from './api/IccPubsubApi'\nexport * from './api/IccReceiptApi'\nexport * from './api/IccReplicationApi'\nexport * from './api/IccTarificationApi'\nexport * from './api/IccTimeTableApi'\nexport * from './api/IccTmpApi'\nexport * from './api/IccUserApi'\n"]}
|
package/icc-api/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from './api/IccAccesslogApi';
|
|
|
2
2
|
export * from './api/IccAgendaApi';
|
|
3
3
|
export * from './api/IccAnonymousAccessApi';
|
|
4
4
|
export * from './api/IccApplicationsettingsApi';
|
|
5
|
-
export * from './api/IccArticleApi';
|
|
6
5
|
export * from './api/IccAuthApi';
|
|
7
6
|
export * from './api/IccBeefactApi';
|
|
8
7
|
export * from './api/IccBekmehrApi';
|
package/icc-api/index.js
CHANGED
|
@@ -18,7 +18,6 @@ __exportStar(require("./api/IccAccesslogApi"), exports);
|
|
|
18
18
|
__exportStar(require("./api/IccAgendaApi"), exports);
|
|
19
19
|
__exportStar(require("./api/IccAnonymousAccessApi"), exports);
|
|
20
20
|
__exportStar(require("./api/IccApplicationsettingsApi"), exports);
|
|
21
|
-
__exportStar(require("./api/IccArticleApi"), exports);
|
|
22
21
|
__exportStar(require("./api/IccAuthApi"), exports);
|
|
23
22
|
__exportStar(require("./api/IccBeefactApi"), exports);
|
|
24
23
|
__exportStar(require("./api/IccBekmehrApi"), exports);
|
package/icc-api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../icc-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,qDAAkC;AAClC,8DAA2C;AAC3C,kEAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../icc-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,qDAAkC;AAClC,8DAA2C;AAC3C,kEAA+C;AAC/C,mDAAgC;AAChC,sDAAmC;AACnC,sDAAmC;AACnC,wDAAqC;AACrC,6DAA0C;AAC1C,6DAA0C;AAC1C,sDAAmC;AACnC,2DAAwC;AACxC,+DAA4C;AAC5C,6DAA0C;AAC1C,qEAAkD;AAClD,mDAAgC;AAChC,sDAAmC;AACnC,qDAAkC;AAClC,0DAAuC;AACvC,uDAAoC;AACpC,wDAAqC;AACrC,6DAA0C;AAC1C,mDAAgC;AAChC,gEAA6C;AAC7C,oDAAiC;AACjC,sDAAmC;AACnC,uDAAoC;AACpC,oDAAiC;AACjC,wDAAqC;AACrC,sDAAmC;AACnC,sDAAmC;AACnC,oDAAiC;AACjC,8DAA2C;AAC3C,sDAAmC;AACnC,sDAAmC;AACnC,yDAAsC;AACtC,oDAAiC;AACjC,qDAAkC;AAClC,sDAAmC;AACnC,0DAAuC;AACvC,2DAAwC;AACxC,wDAAqC;AACrC,kDAA+B;AAC/B,mDAAgC;AAChC,oDAAiC","sourcesContent":["export * from './api/IccAccesslogApi'\nexport * from './api/IccAgendaApi'\nexport * from './api/IccAnonymousAccessApi'\nexport * from './api/IccApplicationsettingsApi'\nexport * from './api/IccAuthApi'\nexport * from './api/IccBeefactApi'\nexport * from './api/IccBekmehrApi'\nexport * from './api/IccBemikronoApi'\nexport * from './api/IccBeresultexportApi'\nexport * from './api/IccBeresultimportApi'\nexport * from './api/IccBesamv2Api'\nexport * from './api/IccCalendarItemApi'\nexport * from './api/IccCalendarItemTypeApi'\nexport * from './api/IccClassificationApi'\nexport * from './api/IccClassificationTemplateApi'\nexport * from './api/IccCodeApi'\nexport * from './api/IccContactApi'\nexport * from './api/IccDeviceApi'\nexport * from './api/IccDoctemplateApi'\nexport * from './api/IccDocumentApi'\nexport * from './api/IccEntityrefApi'\nexport * from './api/IccEntitytemplateApi'\nexport * from './api/IccFormApi'\nexport * from './api/IccFrontendmigrationApi'\nexport * from './api/IccGroupApi'\nexport * from './api/IccHcpartyApi'\nexport * from './api/IccHelementApi'\nexport * from './api/IccIcureApi'\nexport * from './api/IccInsuranceApi'\nexport * from './api/IccInvoiceApi'\nexport * from './api/IccKeywordApi'\nexport * from './api/IccMedexApi'\nexport * from './api/IccMedicallocationApi'\nexport * from './api/IccMessageApi'\nexport * from './api/IccPatientApi'\nexport * from './api/IccPermissionApi'\nexport * from './api/IccPlaceApi'\nexport * from './api/IccPubsubApi'\nexport * from './api/IccReceiptApi'\nexport * from './api/IccReplicationApi'\nexport * from './api/IccTarificationApi'\nexport * from './api/IccTimeTableApi'\nexport * from './api/IccTmpApi'\nexport * from './api/IccUserApi'\nexport * from './api/IccTopicApi'\n"]}
|
|
@@ -17,13 +17,9 @@ export declare class AccessControlSecretUtils {
|
|
|
17
17
|
* These keys will be sent to the icure server for access control of data owners which require anonymous delegations.
|
|
18
18
|
* @param accessControlSecret an access control secret
|
|
19
19
|
* @param entityTypeName an entity type name
|
|
20
|
-
* @param secretForeignKey optionally a secret foreign key to include in the secret. "" and undefined are equivalent.
|
|
21
20
|
*/
|
|
22
|
-
accessControlKeyFor(accessControlSecret: string, entityTypeName: EntityWithDelegationTypeName
|
|
23
|
-
|
|
24
|
-
* Get the access control keys for proving access to an entity of provided type with the provided secret foreign keys.
|
|
25
|
-
*/
|
|
26
|
-
accessControlKeysFor(accessControlSecret: string, entityTypeName: EntityWithDelegationTypeName, secretForeignKeys: string[]): Promise<ArrayBuffer[]>;
|
|
21
|
+
accessControlKeyFor(accessControlSecret: string, entityTypeName: EntityWithDelegationTypeName): Promise<ArrayBuffer>;
|
|
22
|
+
allAccessControlKeyFor(accessControlSecret: string): Promise<ArrayBuffer[]>;
|
|
27
23
|
/**
|
|
28
24
|
* Get value to use as key in secure delegations for entities of the provided type with the provided secret foreign key. The combination of secret
|
|
29
25
|
* foreign keys and entity type ensures that unauthorised people will not be able to draw links between entities of different types of data or
|
|
@@ -31,13 +27,8 @@ export declare class AccessControlSecretUtils {
|
|
|
31
27
|
* These keys will be used in the secure delegations map of security metadata.
|
|
32
28
|
* @param accessControlSecret an access control secret
|
|
33
29
|
* @param entityTypeName an entity type name
|
|
34
|
-
* @param secretForeignKey optionally a secret foreign key to include in the secret. "" and undefined are equivalent.
|
|
35
|
-
*/
|
|
36
|
-
secureDelegationKeyFor(accessControlSecret: string, entityTypeName: EntityWithDelegationTypeName, secretForeignKey: string | undefined): Promise<string>;
|
|
37
|
-
/**
|
|
38
|
-
* Get the secure delegations keys which can be used on an entity of provided type with the provided secret foreign keys.
|
|
39
30
|
*/
|
|
40
|
-
|
|
31
|
+
secureDelegationKeyFor(accessControlSecret: string, entityTypeName: EntityWithDelegationTypeName): Promise<string>;
|
|
32
|
+
allSecureDelegationKeysFor(accessControlSecret: string): Promise<string[]>;
|
|
41
33
|
getEncodedAccessControlKeys(accessControlSecrets: string[], entityTypeName: EntityWithDelegationTypeName): Promise<string>;
|
|
42
|
-
private getKeys;
|
|
43
34
|
}
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AccessControlSecretUtils = void 0;
|
|
13
|
+
const EntityWithDelegationTypeName_1 = require("../utils/EntityWithDelegationTypeName");
|
|
13
14
|
const utils_1 = require("../utils");
|
|
14
15
|
const ACCESS_CONTROL_KEY_LENGTH_BYTES = 16;
|
|
15
16
|
/**
|
|
@@ -32,21 +33,19 @@ class AccessControlSecretUtils {
|
|
|
32
33
|
* These keys will be sent to the icure server for access control of data owners which require anonymous delegations.
|
|
33
34
|
* @param accessControlSecret an access control secret
|
|
34
35
|
* @param entityTypeName an entity type name
|
|
35
|
-
* @param secretForeignKey optionally a secret foreign key to include in the secret. "" and undefined are equivalent.
|
|
36
36
|
*/
|
|
37
|
-
accessControlKeyFor(accessControlSecret, entityTypeName
|
|
37
|
+
accessControlKeyFor(accessControlSecret, entityTypeName) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
|
|
40
|
-
// Ignore secret foreign key for now
|
|
41
|
-
return (yield this.primitives.sha256((0, utils_1.utf8_2ua)(accessControlSecret + entityTypeName /* + (secretForeignKey ?? '')*/))).slice(0, ACCESS_CONTROL_KEY_LENGTH_BYTES);
|
|
39
|
+
return (yield this.primitives.sha256((0, utils_1.utf8_2ua)(accessControlSecret + entityTypeName))).slice(0, ACCESS_CONTROL_KEY_LENGTH_BYTES);
|
|
42
40
|
});
|
|
43
41
|
}
|
|
44
|
-
|
|
45
|
-
* Get the access control keys for proving access to an entity of provided type with the provided secret foreign keys.
|
|
46
|
-
*/
|
|
47
|
-
accessControlKeysFor(accessControlSecret, entityTypeName, secretForeignKeys) {
|
|
42
|
+
allAccessControlKeyFor(accessControlSecret) {
|
|
48
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
|
|
44
|
+
const res = [];
|
|
45
|
+
for (const entityTypeName of EntityWithDelegationTypeName_1.entityWithDelegationTypeNames) {
|
|
46
|
+
res.push((yield this.primitives.sha256((0, utils_1.utf8_2ua)(accessControlSecret + entityTypeName))).slice(0, ACCESS_CONTROL_KEY_LENGTH_BYTES));
|
|
47
|
+
}
|
|
48
|
+
return res;
|
|
50
49
|
});
|
|
51
50
|
}
|
|
52
51
|
/**
|
|
@@ -56,19 +55,20 @@ class AccessControlSecretUtils {
|
|
|
56
55
|
* These keys will be used in the secure delegations map of security metadata.
|
|
57
56
|
* @param accessControlSecret an access control secret
|
|
58
57
|
* @param entityTypeName an entity type name
|
|
59
|
-
* @param secretForeignKey optionally a secret foreign key to include in the secret. "" and undefined are equivalent.
|
|
60
58
|
*/
|
|
61
|
-
secureDelegationKeyFor(accessControlSecret, entityTypeName
|
|
59
|
+
secureDelegationKeyFor(accessControlSecret, entityTypeName) {
|
|
62
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
return (0, utils_1.ua2hex)(yield this.primitives.sha256(yield this.accessControlKeyFor(accessControlSecret, entityTypeName
|
|
61
|
+
return (0, utils_1.ua2hex)(yield this.primitives.sha256(yield this.accessControlKeyFor(accessControlSecret, entityTypeName)));
|
|
64
62
|
});
|
|
65
63
|
}
|
|
66
|
-
|
|
67
|
-
* Get the secure delegations keys which can be used on an entity of provided type with the provided secret foreign keys.
|
|
68
|
-
*/
|
|
69
|
-
secureDelegationKeysFor(accessControlSecret, entityTypeName, secretForeignKeys) {
|
|
64
|
+
allSecureDelegationKeysFor(accessControlSecret) {
|
|
70
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
|
|
66
|
+
const accessControlKeys = yield this.allAccessControlKeyFor(accessControlSecret);
|
|
67
|
+
const res = [];
|
|
68
|
+
for (const accessControlKey of accessControlKeys) {
|
|
69
|
+
res.push((0, utils_1.ua2hex)(yield this.primitives.sha256(accessControlKey)));
|
|
70
|
+
}
|
|
71
|
+
return res;
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
getEncodedAccessControlKeys(accessControlSecrets, entityTypeName) {
|
|
@@ -76,22 +76,12 @@ class AccessControlSecretUtils {
|
|
|
76
76
|
const fullBuffer = new Uint8Array(accessControlSecrets.length * this.accessControlKeyLengthBytes);
|
|
77
77
|
for (let i = 0; i < accessControlSecrets.length; i++) {
|
|
78
78
|
const accessControlSecret = accessControlSecrets[i];
|
|
79
|
-
const key = yield this.accessControlKeyFor(accessControlSecret, entityTypeName
|
|
79
|
+
const key = yield this.accessControlKeyFor(accessControlSecret, entityTypeName);
|
|
80
80
|
fullBuffer.set(new Uint8Array(key), i * this.accessControlKeyLengthBytes);
|
|
81
81
|
}
|
|
82
82
|
return (0, utils_1.ua2b64)(fullBuffer);
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
getKeys(accessControlSecret, entityTypeName, secretForeignKeys, getKey) {
|
|
86
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
// Usage of sfks in secure delegation key should be configurable: it is not necessary for all users and it has some performance impact
|
|
88
|
-
// if (!secretForeignKeys.length) {
|
|
89
|
-
return [yield getKey(accessControlSecret, entityTypeName, undefined)];
|
|
90
|
-
// } else {
|
|
91
|
-
// return await Promise.all(secretForeignKeys.map((sfk) => getKey(accessControlSecret, entityTypeName, sfk)))
|
|
92
|
-
// }
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
85
|
}
|
|
96
86
|
exports.AccessControlSecretUtils = AccessControlSecretUtils;
|
|
97
87
|
//# sourceMappingURL=AccessControlSecretUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessControlSecretUtils.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/AccessControlSecretUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"AccessControlSecretUtils.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/AccessControlSecretUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wFAAmH;AACnH,oCAAmD;AAEnD,MAAM,+BAA+B,GAAG,EAAE,CAAA;AAE1C;;GAEG;AACH,MAAa,wBAAwB;IACnC,YAA6B,UAA4B;QAA5B,eAAU,GAAV,UAAU,CAAkB;IAAG,CAAC;IAE7D;;OAEG;IACH,IAAI,2BAA2B;QAC7B,OAAO,+BAA+B,CAAA;IACxC,CAAC;IAED;;;;;;;OAOG;IACG,mBAAmB,CAAC,mBAA2B,EAAE,cAA4C;;YACjG,OAAO,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAA,gBAAQ,EAAC,mBAAmB,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,+BAA+B,CAAC,CAAA;QACjI,CAAC;KAAA;IAEK,sBAAsB,CAAC,mBAA2B;;YACtD,MAAM,GAAG,GAAkB,EAAE,CAAA;YAC7B,KAAK,MAAM,cAAc,IAAI,4DAA6B,EAAE;gBAC1D,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAA,gBAAQ,EAAC,mBAAmB,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,+BAA+B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;KAAA;CACF;AA5DD,4DA4DC","sourcesContent":["import { CryptoPrimitives } from './CryptoPrimitives'\nimport { EntityWithDelegationTypeName, entityWithDelegationTypeNames } from '../utils/EntityWithDelegationTypeName'\nimport { ua2b64, ua2hex, utf8_2ua } from '../utils'\n\nconst ACCESS_CONTROL_KEY_LENGTH_BYTES = 16\n\n/**\n * @internal this class is intended for internal use only and may be changed without notice.\n */\nexport class AccessControlSecretUtils {\n constructor(private readonly primitives: CryptoPrimitives) {}\n\n /**\n * Size of the access control keys returned by this class.\n */\n get accessControlKeyLengthBytes(): number {\n return ACCESS_CONTROL_KEY_LENGTH_BYTES\n }\n\n /**\n * Get the access control key to use for entities of the provided type and using the provided secret foreign key. The combination of secret foreign\n * keys and entity type ensures that unauthorised people will not be able to draw links between entities of different types of data or different\n * confidentiality levels.\n * These keys will be sent to the icure server for access control of data owners which require anonymous delegations.\n * @param accessControlSecret an access control secret\n * @param entityTypeName an entity type name\n */\n async accessControlKeyFor(accessControlSecret: string, entityTypeName: EntityWithDelegationTypeName): Promise<ArrayBuffer> {\n return (await this.primitives.sha256(utf8_2ua(accessControlSecret + entityTypeName))).slice(0, ACCESS_CONTROL_KEY_LENGTH_BYTES)\n }\n\n async allAccessControlKeyFor(accessControlSecret: string): Promise<ArrayBuffer[]> {\n const res: ArrayBuffer[] = []\n for (const entityTypeName of entityWithDelegationTypeNames) {\n res.push((await this.primitives.sha256(utf8_2ua(accessControlSecret + entityTypeName))).slice(0, ACCESS_CONTROL_KEY_LENGTH_BYTES))\n }\n return res\n }\n\n /**\n * Get value to use as key in secure delegations for entities of the provided type with the provided secret foreign key. The combination of secret\n * foreign keys and entity type ensures that unauthorised people will not be able to draw links between entities of different types of data or\n * different confidentiality levels.\n * These keys will be used in the secure delegations map of security metadata.\n * @param accessControlSecret an access control secret\n * @param entityTypeName an entity type name\n */\n async secureDelegationKeyFor(accessControlSecret: string, entityTypeName: EntityWithDelegationTypeName): Promise<string> {\n return ua2hex(await this.primitives.sha256(await this.accessControlKeyFor(accessControlSecret, entityTypeName)))\n }\n\n async allSecureDelegationKeysFor(accessControlSecret: string): Promise<string[]> {\n const accessControlKeys = await this.allAccessControlKeyFor(accessControlSecret)\n const res: string[] = []\n for (const accessControlKey of accessControlKeys) {\n res.push(ua2hex(await this.primitives.sha256(accessControlKey)))\n }\n return res\n }\n\n async getEncodedAccessControlKeys(accessControlSecrets: string[], entityTypeName: EntityWithDelegationTypeName): Promise<string> {\n const fullBuffer = new Uint8Array(accessControlSecrets.length * this.accessControlKeyLengthBytes)\n for (let i = 0; i < accessControlSecrets.length; i++) {\n const accessControlSecret = accessControlSecrets[i]\n const key = await this.accessControlKeyFor(accessControlSecret, entityTypeName)\n fullBuffer.set(new Uint8Array(key), i * this.accessControlKeyLengthBytes)\n }\n return ua2b64(fullBuffer)\n }\n}\n"]}
|
|
@@ -13,7 +13,8 @@ export declare class BaseExchangeDataManager {
|
|
|
13
13
|
private readonly dataOwnerApi;
|
|
14
14
|
private readonly primitives;
|
|
15
15
|
private readonly selfRequiresAnonymousDelegations;
|
|
16
|
-
|
|
16
|
+
private readonly doNotUseBulkGet;
|
|
17
|
+
constructor(api: IccExchangeDataApi, dataOwnerApi: IccDataOwnerXApi, primitives: CryptoPrimitives, selfRequiresAnonymousDelegations: boolean, doNotUseBulkGet: boolean);
|
|
17
18
|
/**
|
|
18
19
|
* Get all the exchange data where the current data owner is the delegator or the delegate. However, some data owners, generally HCPs, may have a
|
|
19
20
|
* prohibitively high amount of exchange data. If the crypto strategies specify that the current data owner requires anonymous delegation this
|
|
@@ -35,6 +36,7 @@ export declare class BaseExchangeDataManager {
|
|
|
35
36
|
* @return the exchange data with the provided id or undefined if no exchange data with such id could be found.
|
|
36
37
|
*/
|
|
37
38
|
getExchangeDataById(exchangeDataId: string): Promise<ExchangeData | undefined>;
|
|
39
|
+
getExchangeDataByIds(exchangeDataIds: string[]): Promise<ExchangeData[]>;
|
|
38
40
|
/**
|
|
39
41
|
* Verifies the authenticity of the exchange data by checking the signature.
|
|
40
42
|
* Note that all exchange data created by data owners other than the current data owner (including members of his hierarchy)
|
|
@@ -44,7 +46,7 @@ export declare class BaseExchangeDataManager {
|
|
|
44
46
|
* - decryptedAccessControlSecret the access control secret decrypted from the exchange data.
|
|
45
47
|
* - decryptedExchangeKey the exchange key decrypted from the exchange data.
|
|
46
48
|
* - decryptedSharedSignatureKey the shared signature key decrypted from the exchange data.
|
|
47
|
-
* @param
|
|
49
|
+
* @param verificationKeys verification keys for delegator signature by fingerprint.
|
|
48
50
|
* @param verifyAsDelegator if true the method will also verify that the hmac key used for the signature was created by the delegator of the
|
|
49
51
|
* exchange data. If true and the data was not created by the current data owner this method will return false.
|
|
50
52
|
* @return the exchange data which could be verified given his signature and the available verification keys.
|
|
@@ -55,7 +57,9 @@ export declare class BaseExchangeDataManager {
|
|
|
55
57
|
decryptedAccessControlSecret: string;
|
|
56
58
|
decryptedExchangeKey: CryptoKey;
|
|
57
59
|
decryptedSharedSignatureKey: CryptoKey;
|
|
58
|
-
},
|
|
60
|
+
}, verificationKeys: {
|
|
61
|
+
[fp: string]: CryptoKey;
|
|
62
|
+
}, verifyAsDelegator: boolean): Promise<boolean>;
|
|
59
63
|
/**
|
|
60
64
|
* Extracts and decrypts the access control secret from the provided exchange data.
|
|
61
65
|
* These need to be hashed together with the entity class and confidentiality level in order to get the actual access control key
|
|
@@ -171,6 +175,7 @@ export declare class BaseExchangeDataManager {
|
|
|
171
175
|
private importAccessControlSecret;
|
|
172
176
|
private exportAccessControlSecret;
|
|
173
177
|
private encryptDataWithKeys;
|
|
178
|
+
private extractHmacFromRsaPrivate;
|
|
174
179
|
private signDataWithDelegatorKeys;
|
|
175
180
|
private verifyDelegatorSignature;
|
|
176
181
|
private signDataWithSharedKey;
|
|
@@ -12,21 +12,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.BaseExchangeDataManager = void 0;
|
|
13
13
|
const ExchangeData_1 = require("../../icc-api/model/internal/ExchangeData");
|
|
14
14
|
const XHR_1 = require("../../icc-api/api/XHR");
|
|
15
|
-
var XHRError = XHR_1.XHR.XHRError;
|
|
16
15
|
const utils_1 = require("../utils");
|
|
17
16
|
const _ = require("lodash");
|
|
18
17
|
const utils_2 = require("./utils");
|
|
18
|
+
var XHRError = XHR_1.XHR.XHRError;
|
|
19
19
|
/**
|
|
20
20
|
* @internal this class is intended for internal use only and may be modified without notice
|
|
21
21
|
* Functions to create and get exchange data.
|
|
22
22
|
* The methods of this api require to pass the appropriate keys for encryption/decryption manually.
|
|
23
23
|
*/
|
|
24
24
|
class BaseExchangeDataManager {
|
|
25
|
-
constructor(api, dataOwnerApi, primitives, selfRequiresAnonymousDelegations) {
|
|
25
|
+
constructor(api, dataOwnerApi, primitives, selfRequiresAnonymousDelegations, doNotUseBulkGet) {
|
|
26
26
|
this.api = api;
|
|
27
27
|
this.dataOwnerApi = dataOwnerApi;
|
|
28
28
|
this.primitives = primitives;
|
|
29
29
|
this.selfRequiresAnonymousDelegations = selfRequiresAnonymousDelegations;
|
|
30
|
+
this.doNotUseBulkGet = doNotUseBulkGet;
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
33
|
* Get all the exchange data where the current data owner is the delegator or the delegate. However, some data owners, generally HCPs, may have a
|
|
@@ -78,6 +79,28 @@ class BaseExchangeDataManager {
|
|
|
78
79
|
});
|
|
79
80
|
});
|
|
80
81
|
}
|
|
82
|
+
getExchangeDataByIds(exchangeDataIds) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
if (this.doNotUseBulkGet) {
|
|
85
|
+
const res = [];
|
|
86
|
+
for (const exchangeDataId of exchangeDataIds) {
|
|
87
|
+
const curr = yield this.api.getExchangeDataById(exchangeDataId).catch((e) => {
|
|
88
|
+
if (e instanceof XHRError && (e.statusCode === 404 || e.statusCode === 403)) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
else
|
|
92
|
+
throw e;
|
|
93
|
+
});
|
|
94
|
+
if (curr)
|
|
95
|
+
res.push(curr);
|
|
96
|
+
}
|
|
97
|
+
return res;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return yield this.api.getExchangeDataByIds({ ids: exchangeDataIds });
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
81
104
|
/**
|
|
82
105
|
* Verifies the authenticity of the exchange data by checking the signature.
|
|
83
106
|
* Note that all exchange data created by data owners other than the current data owner (including members of his hierarchy)
|
|
@@ -87,17 +110,17 @@ class BaseExchangeDataManager {
|
|
|
87
110
|
* - decryptedAccessControlSecret the access control secret decrypted from the exchange data.
|
|
88
111
|
* - decryptedExchangeKey the exchange key decrypted from the exchange data.
|
|
89
112
|
* - decryptedSharedSignatureKey the shared signature key decrypted from the exchange data.
|
|
90
|
-
* @param
|
|
113
|
+
* @param verificationKeys verification keys for delegator signature by fingerprint.
|
|
91
114
|
* @param verifyAsDelegator if true the method will also verify that the hmac key used for the signature was created by the delegator of the
|
|
92
115
|
* exchange data. If true and the data was not created by the current data owner this method will return false.
|
|
93
116
|
* @return the exchange data which could be verified given his signature and the available verification keys.
|
|
94
117
|
* @throws if any of the provided exchange data has been created by a data owner other than the current data owner.
|
|
95
118
|
*/
|
|
96
|
-
verifyExchangeData(data,
|
|
119
|
+
verifyExchangeData(data, verificationKeys, verifyAsDelegator) {
|
|
97
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
121
|
if (verifyAsDelegator && data.exchangeData.delegator !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
|
|
99
122
|
return false;
|
|
100
|
-
if (verifyAsDelegator && !(yield this.verifyDelegatorSignature(data.exchangeData, data.decryptedSharedSignatureKey,
|
|
123
|
+
if (verifyAsDelegator && !(yield this.verifyDelegatorSignature(data.exchangeData, data.decryptedSharedSignatureKey, verificationKeys)))
|
|
101
124
|
return false;
|
|
102
125
|
const sharedSignatureData = yield this.bytesToSignForSharedSignature({
|
|
103
126
|
decryptedAccessControlSecret: data.decryptedAccessControlSecret,
|
|
@@ -300,7 +323,7 @@ class BaseExchangeDataManager {
|
|
|
300
323
|
decryptedAccessControlSecret: accessControlSecret,
|
|
301
324
|
decryptedExchangeKey: exchangeKey,
|
|
302
325
|
decryptedSharedSignatureKey: sharedSignatureKey,
|
|
303
|
-
},
|
|
326
|
+
}, {}, false);
|
|
304
327
|
if (isVerified) {
|
|
305
328
|
updatedExchangeData.sharedSignature = yield this.signDataWithSharedKey(yield this.bytesToSignForSharedSignature({
|
|
306
329
|
delegate: updatedExchangeData.delegate,
|
|
@@ -394,23 +417,35 @@ class BaseExchangeDataManager {
|
|
|
394
417
|
return res;
|
|
395
418
|
});
|
|
396
419
|
}
|
|
420
|
+
extractHmacFromRsaPrivate(privateRsaKey) {
|
|
421
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
422
|
+
if (privateRsaKey.algorithm.name != 'RSA-OAEP' && !privateRsaKey.usages.includes('decrypt')) {
|
|
423
|
+
throw new Error('Internal error: got unexpected key for signature/verification');
|
|
424
|
+
}
|
|
425
|
+
const keyBytes = yield this.primitives.RSA.exportKey(privateRsaKey, 'pkcs8');
|
|
426
|
+
const keyAsHmacBytes = yield this.primitives.sha512(keyBytes);
|
|
427
|
+
return yield this.primitives.HMAC.importKey(keyAsHmacBytes, false);
|
|
428
|
+
});
|
|
429
|
+
}
|
|
397
430
|
signDataWithDelegatorKeys(rawData, keys) {
|
|
398
431
|
return __awaiter(this, void 0, void 0, function* () {
|
|
399
432
|
const res = {};
|
|
400
433
|
for (const [fp, key] of Object.entries(keys)) {
|
|
401
|
-
res[fp] = (0, utils_1.ua2b64)(yield this.primitives.
|
|
434
|
+
res[(0, utils_2.fingerprintV1toV2)(fp)] = (0, utils_1.ua2b64)(yield this.primitives.HMAC.sign(yield this.extractHmacFromRsaPrivate(key), new Uint8Array(rawData)));
|
|
402
435
|
}
|
|
403
436
|
return res;
|
|
404
437
|
});
|
|
405
438
|
}
|
|
406
|
-
verifyDelegatorSignature(exchangeData, decryptedSharedSignatureKey,
|
|
439
|
+
verifyDelegatorSignature(exchangeData, decryptedSharedSignatureKey, verificationKeys) {
|
|
407
440
|
return __awaiter(this, void 0, void 0, function* () {
|
|
408
441
|
const delegatorSignatureData = yield this.bytesToSignForDelegatorSignature({
|
|
409
442
|
sharedSignatureKey: decryptedSharedSignatureKey,
|
|
410
443
|
});
|
|
444
|
+
const keysByV2Fp = Object.fromEntries(Object.entries(verificationKeys).map(([fp, key]) => [(0, utils_2.fingerprintV1toV2)(fp), key]));
|
|
411
445
|
for (const [fp, signature] of Object.entries(exchangeData.delegatorSignature)) {
|
|
412
|
-
const verificationKey =
|
|
413
|
-
if (verificationKey &&
|
|
446
|
+
const verificationKey = keysByV2Fp[fp];
|
|
447
|
+
if (verificationKey &&
|
|
448
|
+
(yield this.primitives.HMAC.verify(yield this.extractHmacFromRsaPrivate(verificationKey), delegatorSignatureData, (0, utils_1.b64_2ua)(signature))))
|
|
414
449
|
return true;
|
|
415
450
|
}
|
|
416
451
|
return false;
|