@icure/api 8.0.11 → 8.0.13

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.
@@ -134,9 +134,8 @@ export declare class IccHcpartyApi {
134
134
  /**
135
135
  * General information about the healthcare Party
136
136
  * @summary Get healthcareParties by their IDs
137
- * @param healthcarePartyIds
138
137
  */
139
- getHealthcareParties(healthcarePartyIds: string): Promise<Array<HealthcareParty>>;
138
+ getHealthcareParties(body?: ListOfIds): Promise<Array<HealthcareParty>>;
140
139
  /**
141
140
  * Return a list of children hcp.
142
141
  * @summary Find children of an healthcare parties
@@ -258,13 +258,13 @@ class IccHcpartyApi {
258
258
  /**
259
259
  * General information about the healthcare Party
260
260
  * @summary Get healthcareParties by their IDs
261
- * @param healthcarePartyIds
262
261
  */
263
- getHealthcareParties(healthcarePartyIds) {
264
- let _body = null;
265
- const _url = this.host + `/hcparty/byIds/${encodeURIComponent(String(healthcarePartyIds))}` + '?ts=' + new Date().getTime();
262
+ getHealthcareParties(body) {
263
+ let _body = body;
264
+ const _url = this.host + '/hcparty/byIds?ts=' + new Date().getTime();
266
265
  let headers = this.headers;
267
- return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
266
+ headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
267
+ return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
268
268
  .then((doc) => doc.body.map((it) => new HealthcareParty_1.HealthcareParty(it)))
269
269
  .catch((err) => this.handleError(err));
270
270
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IccHcpartyApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccHcpartyApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAE3B,wFAAoF;AACpF,0DAAsD;AAEtD,8DAA0D;AAE1D,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OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,CAAC;aAC1H,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,2DAA4B,CAAC,GAAG,CAAC,IAAY,CAAC,CAAC;aACjE,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;CACF;AApfD,sCAofC","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\nimport { XHR } from './XHR'\nimport { AbstractFilterHealthcareParty } from '../model/AbstractFilterHealthcareParty'\nimport { DataOwnerRegistrationSuccess } from '../model/DataOwnerRegistrationSuccess'\nimport { DocIdentifier } from '../model/DocIdentifier'\nimport { FilterChainHealthcareParty } from '../model/FilterChainHealthcareParty'\nimport { HealthcareParty } from '../model/HealthcareParty'\nimport { ListOfIds } from '../model/ListOfIds'\nimport { PaginatedListHealthcareParty } from '../model/PaginatedListHealthcareParty'\nimport { PublicKey } from '../model/PublicKey'\nimport { AuthenticationProvider, NoAuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider'\nimport { iccRestApiPath } from './IccRestApiPath'\n\nexport class IccHcpartyApi {\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 /**\n * One of Name or Last name+First name, Nihii, and Public key are required.\n * @summary Create a healthcare party\n * @param body\n */\n async createHealthcareParty(body?: HealthcareParty): Promise<HealthcareParty> {\n const _url = this.host + `/hcparty` + '?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 HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * One of Name or Last name+First name, Nihii, and Public key are required.\n * @summary Create a healthcare party\n * @param body\n * @param groupId\n */\n async createHealthcarePartyInGroup(groupId: string, body?: HealthcareParty): Promise<HealthcareParty> {\n const _url = this.host + `/hcparty/inGroup/${encodeURIComponent(String(groupId))}` + '?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 HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a healthcare parties in batch.\n * @param healthcarePartyIds a ListOfIds containing the ids of the healthcare parties to delete.\n * @return a Promise that will resolve in an Array of DocIdentifiers of the successfully deleted healthcare parties.\n */\n async deleteHealthcareParties(healthcarePartyIds: ListOfIds): Promise<Array<DocIdentifier>> {\n return XHR.sendCommand(\n 'POST',\n this.host + `/hcparty/delete/batch` + '?ts=' + new Date().getTime(),\n this.headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json')),\n healthcarePartyIds,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => (doc.body as Array<JSON>).map((it) => new DocIdentifier(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a single healthcare party by id.\n *\n * @param healthcarePartyId the id of the healthcare party to delete.\n * @return a Promise that will resolve in the DocIdentifier of the healthcare party.\n */\n async deleteHealthcareParty(healthcarePartyId: string): Promise<DocIdentifier> {\n return XHR.sendCommand(\n 'DELETE',\n this.host + `/hcparty/${encodeURIComponent(healthcarePartyId)}` + '?ts=' + new Date().getTime(),\n this.headers,\n null,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => new DocIdentifier(doc.body))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a healthcare parties in batch in a specific group\n * @param groupId the id of the group where to delete the healthcare parties.\n * @param healthcarePartyIds a ListOfIds containing the ids of the healthcare parties to delete.\n * @return a Promise that will resolve in an Array of DocIdentifiers of the successfully deleted healthcare parties.\n */\n async deleteHealthcarePartiesInGroup(groupId: string, healthcarePartyIds: ListOfIds): Promise<Array<DocIdentifier>> {\n return XHR.sendCommand(\n 'POST',\n this.host + `/hcparty/delete/batch/inGroup/${encodeURIComponent(groupId)}` + '?ts=' + new Date().getTime(),\n this.headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json')),\n healthcarePartyIds,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => (doc.body as Array<JSON>).map((it) => new DocIdentifier(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a single healthcare party by id in a specific group.\n *\n * @param groupId the id of the group where to delete the healthcare party.\n * @param healthcarePartyId the id of the healthcare party to delete.\n * @return a Promise that will resolve in the DocIdentifier of the healthcare party.\n */\n async deleteHealthcarePartyInGroup(groupId: string, healthcarePartyId: string): Promise<DocIdentifier> {\n return XHR.sendCommand(\n 'DELETE',\n this.host + `/hcparty/${encodeURIComponent(healthcarePartyId)}/inGroup/${encodeURIComponent(groupId)}` + '?ts=' + new Date().getTime(),\n this.headers,\n null,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => new DocIdentifier(doc.body))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare party along with next start keys and Document ID. If the nextStartKey is Null it means that this is the last page.\n * @summary Filter healthcare parties for the current user (HcParty)\n * @param body\n * @param startDocumentId A HealthcareParty document ID\n * @param limit Number of rows\n */\n async filterHealthPartiesBy(startDocumentId?: string, limit?: number, body?: FilterChainHealthcareParty): Promise<PaginatedListHealthcareParty> {\n const _url =\n this.host +\n `/hcparty/filter` +\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('POST', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListHealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare parties.\n * @summary Find healthcare parties by name with(out) pagination\n * @param name The Last name search value\n * @param startKey A healthcare party Last name\n * @param startDocumentId A healthcare party document ID\n * @param limit Number of rows\n * @param desc Descending\n */\n findByName(name?: string, startKey?: string, startDocumentId?: string, limit?: number, desc?: boolean): Promise<PaginatedListHealthcareParty> {\n let _body = null\n\n const _url =\n this.host +\n `/hcparty/byName` +\n '?ts=' +\n new Date().getTime() +\n (name ? '&name=' + encodeURIComponent(String(name)) : '') +\n (startKey ? '&startKey=' + encodeURIComponent(String(startKey)) : '') +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '') +\n (desc ? '&desc=' + encodeURIComponent(String(desc)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListHealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare parties.\n * @summary Find healthcare parties by name with(out) pagination\n * @param type The type of the HCP (persphysician)\n * @param spec The speciality of the HCP\n * @param firstCode The first postCode for the HCP\n * @param lastCode The last postCode for the HCP\n * @param limit Number of rows\n */\n findBySpecialityAndPostCode(\n type: string,\n spec: string,\n firstCode: string,\n lastCode: string,\n limit?: number\n ): Promise<PaginatedListHealthcareParty> {\n let _body = null\n\n const _url =\n this.host +\n `/hcparty/bySpecialityAndPostCode/${encodeURIComponent(String(type))}/${encodeURIComponent(String(spec))}/${encodeURIComponent(\n String(firstCode)\n )}/to/${encodeURIComponent(String(lastCode))}` +\n '?ts=' +\n new Date().getTime() +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListHealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare parties.\n * @summary Find healthcare parties by nihii or ssin with(out) pagination\n * @param searchValue\n * @param startKey A healthcare party Last name\n * @param startDocumentId A healthcare party document ID\n * @param limit Number of rows\n * @param desc Descending\n */\n findBySsinOrNihii(\n searchValue: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n desc?: boolean\n ): Promise<PaginatedListHealthcareParty> {\n let _body = null\n\n const _url =\n this.host +\n `/hcparty/byNihiiOrSsin/${encodeURIComponent(String(searchValue))}` +\n '?ts=' +\n new Date().getTime() +\n (startKey ? '&startKey=' + encodeURIComponent(String(startKey)) : '') +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '') +\n (desc ? '&desc=' + encodeURIComponent(String(desc)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListHealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * (key, value) of the map is as follows: (ID of the owner of the encrypted AES key, encrypted AES keys)\n * @summary Get the HcParty encrypted AES keys indexed by owner.\n * @param healthcarePartyId\n */\n getAesExchangeKeysForDelegate(\n healthcarePartyId: string\n ): Promise<{ [delegatorId: string]: { [delegatorPubKeyFingerprint: string]: { [delegatePubKeyFingerprint: string]: string } } }> {\n let _body = null\n\n const _url = this.host + `/hcparty/${encodeURIComponent(String(healthcarePartyId))}/aesExchangeKeys` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the current healthcare Party\n * @summary Get the current healthcare party if logged in.\n */\n getCurrentHealthcareParty(): Promise<HealthcareParty> {\n let _body = null\n\n const _url = this.host + `/hcparty/current` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * (key, value) of the map is as follows: (ID of the owner of the encrypted AES key, encrypted AES key)\n * @summary Get the HcParty encrypted AES keys indexed by owner. As a HCp may now have multiple AES keys, this service is deprecated. Use /{healthcarePartyId}/aesExchangeKeys\n * @param healthcarePartyId\n */\n getHcPartyKeysForDelegate(healthcarePartyId: string): Promise<{ [key: string]: string }> {\n let _body = null\n\n const _url = this.host + `/hcparty/${encodeURIComponent(String(healthcarePartyId))}/keys` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the healthcare Party\n * @summary Get healthcareParties by their IDs\n * @param healthcarePartyIds\n */\n getHealthcareParties(healthcarePartyIds: string): Promise<Array<HealthcareParty>> {\n let _body = null\n\n const _url = this.host + `/hcparty/byIds/${encodeURIComponent(String(healthcarePartyIds))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new HealthcareParty(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Return a list of children hcp.\n * @summary Find children of an healthcare parties\n * @param parentId\n */\n getHealthcarePartiesByParentId(parentId: string): Promise<Array<HealthcareParty>> {\n let _body = null\n\n const _url = this.host + `/hcparty/${encodeURIComponent(String(parentId))}/children` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new HealthcareParty(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the healthcare Party\n * @summary Get healthcareParties by their IDs\n * @param body\n * @param groupId\n */\n getHealthcarePartiesInGroup(groupId: string, body?: ListOfIds): Promise<Array<HealthcareParty>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/hcparty/inGroup/${encodeURIComponent(String(groupId))}/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 HealthcareParty(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the healthcare Party\n * @summary Get a healthcareParty by his ID\n * @param healthcarePartyId\n */\n getHealthcareParty(healthcarePartyId: string): Promise<HealthcareParty> {\n let _body = null\n\n const _url = this.host + `/hcparty/${encodeURIComponent(String(healthcarePartyId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns the public key of a healthcare party in Hex\n * @summary Get public key of a healthcare party\n * @param healthcarePartyId\n */\n getPublicKey(healthcarePartyId: string): Promise<PublicKey> {\n let _body = null\n\n const _url = this.host + `/hcparty/${encodeURIComponent(String(healthcarePartyId))}/publicKey` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PublicKey(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare parties.\n * @summary Find healthcare parties by name with(out) pagination\n * @param name The Last name search value\n */\n listByName(name: string): Promise<Array<HealthcareParty>> {\n let _body = null\n\n const _url = this.host + `/hcparty/byNameStrict/${encodeURIComponent(String(name))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new HealthcareParty(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare parties.\n * @summary List healthcare parties with(out) pagination\n * @param startKey A healthcare party Last name\n * @param startDocumentId A healthcare party document ID\n * @param limit Number of rows\n * @param desc Descending\n */\n listHealthcareParties(startKey?: string, startDocumentId?: string, limit?: number, desc?: boolean): Promise<PaginatedListHealthcareParty> {\n let _body = null\n\n const _url =\n this.host +\n `/hcparty` +\n '?ts=' +\n new Date().getTime() +\n (startKey ? '&startKey=' + encodeURIComponent(String(startKey)) : '') +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '') +\n (desc ? '&desc=' + encodeURIComponent(String(desc)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListHealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Get ids of healthcare party matching the provided filter for the current user (HcParty)\n * @param body\n */\n matchHealthcarePartiesBy(body?: AbstractFilterHealthcareParty): Promise<Array<string>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/hcparty/match` + '?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) => JSON.parse(JSON.stringify(it))))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * No particular return value. It's just a message.\n * @summary Modify a Healthcare Party.\n * @param body\n */\n modifyHealthcareParty(body?: HealthcareParty): Promise<HealthcareParty> {\n let _body = null\n _body = body\n\n const _url = this.host + `/hcparty` + '?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 HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * No particular return value. It's just a message.\n * @summary Modify a Healthcare Party.\n * @param body\n * @param groupId\n */\n modifyHealthcarePartyInGroup(groupId: string, body?: HealthcareParty): Promise<HealthcareParty> {\n let _body = null\n _body = body\n\n const _url = this.host + `/hcparty/inGroup/${encodeURIComponent(String(groupId))}` + '?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 HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Register a new hcp into the system\n * @summary Register a hcp\n * @param body\n * @param groupId\n * @param parentHcPartyId\n * @param token\n * @param useShortToken\n */\n registerHealthcareParty(\n groupId: string,\n parentHcPartyId?: string,\n token?: string,\n useShortToken?: boolean,\n body?: HealthcareParty\n ): Promise<DataOwnerRegistrationSuccess> {\n let _body = null\n _body = body\n\n const _url =\n this.host +\n `/hcparty/register/inGroup/${encodeURIComponent(String(groupId))}` +\n '?ts=' +\n new Date().getTime() +\n (parentHcPartyId ? '&parentHcPartyId=' + encodeURIComponent(String(parentHcPartyId)) : '') +\n (token ? '&token=' + encodeURIComponent(String(token)) : '') +\n (useShortToken ? '&useShortToken=' + encodeURIComponent(String(useShortToken)) : '')\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 DataOwnerRegistrationSuccess(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
1
+ {"version":3,"file":"IccHcpartyApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccHcpartyApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAE3B,wFAAoF;AACpF,0DAAsD;AAEtD,8DAA0D;AAE1D,wFAAoF;AACpF,kDAA8C;AAC9C,wFAA8G;AAC9G,qDAAiD;AAEjD,MAAa,aAAa;IAMxB,YACE,IAAY,EACZ,OAAY,EACZ,sBAA+C,EAC/C,SAAyE;QAEzE,IAAI,CAAC,IAAI,GAAG,IAAA,+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AE,SAAS,EAAE,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,CAAC;aAC1H,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,2DAA4B,CAAC,GAAG,CAAC,IAAY,CAAC,CAAC;aACjE,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;CACF;AApfD,sCAofC","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\nimport { XHR } from './XHR'\nimport { AbstractFilterHealthcareParty } from '../model/AbstractFilterHealthcareParty'\nimport { DataOwnerRegistrationSuccess } from '../model/DataOwnerRegistrationSuccess'\nimport { DocIdentifier } from '../model/DocIdentifier'\nimport { FilterChainHealthcareParty } from '../model/FilterChainHealthcareParty'\nimport { HealthcareParty } from '../model/HealthcareParty'\nimport { ListOfIds } from '../model/ListOfIds'\nimport { PaginatedListHealthcareParty } from '../model/PaginatedListHealthcareParty'\nimport { PublicKey } from '../model/PublicKey'\nimport { AuthenticationProvider, NoAuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider'\nimport { iccRestApiPath } from './IccRestApiPath'\n\nexport class IccHcpartyApi {\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 /**\n * One of Name or Last name+First name, Nihii, and Public key are required.\n * @summary Create a healthcare party\n * @param body\n */\n async createHealthcareParty(body?: HealthcareParty): Promise<HealthcareParty> {\n const _url = this.host + `/hcparty` + '?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 HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * One of Name or Last name+First name, Nihii, and Public key are required.\n * @summary Create a healthcare party\n * @param body\n * @param groupId\n */\n async createHealthcarePartyInGroup(groupId: string, body?: HealthcareParty): Promise<HealthcareParty> {\n const _url = this.host + `/hcparty/inGroup/${encodeURIComponent(String(groupId))}` + '?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 HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a healthcare parties in batch.\n * @param healthcarePartyIds a ListOfIds containing the ids of the healthcare parties to delete.\n * @return a Promise that will resolve in an Array of DocIdentifiers of the successfully deleted healthcare parties.\n */\n async deleteHealthcareParties(healthcarePartyIds: ListOfIds): Promise<Array<DocIdentifier>> {\n return XHR.sendCommand(\n 'POST',\n this.host + `/hcparty/delete/batch` + '?ts=' + new Date().getTime(),\n this.headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json')),\n healthcarePartyIds,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => (doc.body as Array<JSON>).map((it) => new DocIdentifier(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a single healthcare party by id.\n *\n * @param healthcarePartyId the id of the healthcare party to delete.\n * @return a Promise that will resolve in the DocIdentifier of the healthcare party.\n */\n async deleteHealthcareParty(healthcarePartyId: string): Promise<DocIdentifier> {\n return XHR.sendCommand(\n 'DELETE',\n this.host + `/hcparty/${encodeURIComponent(healthcarePartyId)}` + '?ts=' + new Date().getTime(),\n this.headers,\n null,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => new DocIdentifier(doc.body))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a healthcare parties in batch in a specific group\n * @param groupId the id of the group where to delete the healthcare parties.\n * @param healthcarePartyIds a ListOfIds containing the ids of the healthcare parties to delete.\n * @return a Promise that will resolve in an Array of DocIdentifiers of the successfully deleted healthcare parties.\n */\n async deleteHealthcarePartiesInGroup(groupId: string, healthcarePartyIds: ListOfIds): Promise<Array<DocIdentifier>> {\n return XHR.sendCommand(\n 'POST',\n this.host + `/hcparty/delete/batch/inGroup/${encodeURIComponent(groupId)}` + '?ts=' + new Date().getTime(),\n this.headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json')),\n healthcarePartyIds,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => (doc.body as Array<JSON>).map((it) => new DocIdentifier(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a single healthcare party by id in a specific group.\n *\n * @param groupId the id of the group where to delete the healthcare party.\n * @param healthcarePartyId the id of the healthcare party to delete.\n * @return a Promise that will resolve in the DocIdentifier of the healthcare party.\n */\n async deleteHealthcarePartyInGroup(groupId: string, healthcarePartyId: string): Promise<DocIdentifier> {\n return XHR.sendCommand(\n 'DELETE',\n this.host + `/hcparty/${encodeURIComponent(healthcarePartyId)}/inGroup/${encodeURIComponent(groupId)}` + '?ts=' + new Date().getTime(),\n this.headers,\n null,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => new DocIdentifier(doc.body))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare party along with next start keys and Document ID. If the nextStartKey is Null it means that this is the last page.\n * @summary Filter healthcare parties for the current user (HcParty)\n * @param body\n * @param startDocumentId A HealthcareParty document ID\n * @param limit Number of rows\n */\n async filterHealthPartiesBy(startDocumentId?: string, limit?: number, body?: FilterChainHealthcareParty): Promise<PaginatedListHealthcareParty> {\n const _url =\n this.host +\n `/hcparty/filter` +\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('POST', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListHealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare parties.\n * @summary Find healthcare parties by name with(out) pagination\n * @param name The Last name search value\n * @param startKey A healthcare party Last name\n * @param startDocumentId A healthcare party document ID\n * @param limit Number of rows\n * @param desc Descending\n */\n findByName(name?: string, startKey?: string, startDocumentId?: string, limit?: number, desc?: boolean): Promise<PaginatedListHealthcareParty> {\n let _body = null\n\n const _url =\n this.host +\n `/hcparty/byName` +\n '?ts=' +\n new Date().getTime() +\n (name ? '&name=' + encodeURIComponent(String(name)) : '') +\n (startKey ? '&startKey=' + encodeURIComponent(String(startKey)) : '') +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '') +\n (desc ? '&desc=' + encodeURIComponent(String(desc)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListHealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare parties.\n * @summary Find healthcare parties by name with(out) pagination\n * @param type The type of the HCP (persphysician)\n * @param spec The speciality of the HCP\n * @param firstCode The first postCode for the HCP\n * @param lastCode The last postCode for the HCP\n * @param limit Number of rows\n */\n findBySpecialityAndPostCode(\n type: string,\n spec: string,\n firstCode: string,\n lastCode: string,\n limit?: number\n ): Promise<PaginatedListHealthcareParty> {\n let _body = null\n\n const _url =\n this.host +\n `/hcparty/bySpecialityAndPostCode/${encodeURIComponent(String(type))}/${encodeURIComponent(String(spec))}/${encodeURIComponent(\n String(firstCode)\n )}/to/${encodeURIComponent(String(lastCode))}` +\n '?ts=' +\n new Date().getTime() +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListHealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare parties.\n * @summary Find healthcare parties by nihii or ssin with(out) pagination\n * @param searchValue\n * @param startKey A healthcare party Last name\n * @param startDocumentId A healthcare party document ID\n * @param limit Number of rows\n * @param desc Descending\n */\n findBySsinOrNihii(\n searchValue: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n desc?: boolean\n ): Promise<PaginatedListHealthcareParty> {\n let _body = null\n\n const _url =\n this.host +\n `/hcparty/byNihiiOrSsin/${encodeURIComponent(String(searchValue))}` +\n '?ts=' +\n new Date().getTime() +\n (startKey ? '&startKey=' + encodeURIComponent(String(startKey)) : '') +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '') +\n (desc ? '&desc=' + encodeURIComponent(String(desc)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListHealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * (key, value) of the map is as follows: (ID of the owner of the encrypted AES key, encrypted AES keys)\n * @summary Get the HcParty encrypted AES keys indexed by owner.\n * @param healthcarePartyId\n */\n getAesExchangeKeysForDelegate(\n healthcarePartyId: string\n ): Promise<{ [delegatorId: string]: { [delegatorPubKeyFingerprint: string]: { [delegatePubKeyFingerprint: string]: string } } }> {\n let _body = null\n\n const _url = this.host + `/hcparty/${encodeURIComponent(String(healthcarePartyId))}/aesExchangeKeys` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the current healthcare Party\n * @summary Get the current healthcare party if logged in.\n */\n getCurrentHealthcareParty(): Promise<HealthcareParty> {\n let _body = null\n\n const _url = this.host + `/hcparty/current` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * (key, value) of the map is as follows: (ID of the owner of the encrypted AES key, encrypted AES key)\n * @summary Get the HcParty encrypted AES keys indexed by owner. As a HCp may now have multiple AES keys, this service is deprecated. Use /{healthcarePartyId}/aesExchangeKeys\n * @param healthcarePartyId\n */\n getHcPartyKeysForDelegate(healthcarePartyId: string): Promise<{ [key: string]: string }> {\n let _body = null\n\n const _url = this.host + `/hcparty/${encodeURIComponent(String(healthcarePartyId))}/keys` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the healthcare Party\n * @summary Get healthcareParties by their IDs\n */\n getHealthcareParties(body?: ListOfIds): Promise<Array<HealthcareParty>> {\n let _body = body\n\n const _url = this.host + '/hcparty/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 HealthcareParty(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Return a list of children hcp.\n * @summary Find children of an healthcare parties\n * @param parentId\n */\n getHealthcarePartiesByParentId(parentId: string): Promise<Array<HealthcareParty>> {\n let _body = null\n\n const _url = this.host + `/hcparty/${encodeURIComponent(String(parentId))}/children` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new HealthcareParty(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the healthcare Party\n * @summary Get healthcareParties by their IDs\n * @param body\n * @param groupId\n */\n getHealthcarePartiesInGroup(groupId: string, body?: ListOfIds): Promise<Array<HealthcareParty>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/hcparty/inGroup/${encodeURIComponent(String(groupId))}/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 HealthcareParty(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the healthcare Party\n * @summary Get a healthcareParty by his ID\n * @param healthcarePartyId\n */\n getHealthcareParty(healthcarePartyId: string): Promise<HealthcareParty> {\n let _body = null\n\n const _url = this.host + `/hcparty/${encodeURIComponent(String(healthcarePartyId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns the public key of a healthcare party in Hex\n * @summary Get public key of a healthcare party\n * @param healthcarePartyId\n */\n getPublicKey(healthcarePartyId: string): Promise<PublicKey> {\n let _body = null\n\n const _url = this.host + `/hcparty/${encodeURIComponent(String(healthcarePartyId))}/publicKey` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PublicKey(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare parties.\n * @summary Find healthcare parties by name with(out) pagination\n * @param name The Last name search value\n */\n listByName(name: string): Promise<Array<HealthcareParty>> {\n let _body = null\n\n const _url = this.host + `/hcparty/byNameStrict/${encodeURIComponent(String(name))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new HealthcareParty(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of healthcare parties.\n * @summary List healthcare parties with(out) pagination\n * @param startKey A healthcare party Last name\n * @param startDocumentId A healthcare party document ID\n * @param limit Number of rows\n * @param desc Descending\n */\n listHealthcareParties(startKey?: string, startDocumentId?: string, limit?: number, desc?: boolean): Promise<PaginatedListHealthcareParty> {\n let _body = null\n\n const _url =\n this.host +\n `/hcparty` +\n '?ts=' +\n new Date().getTime() +\n (startKey ? '&startKey=' + encodeURIComponent(String(startKey)) : '') +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '') +\n (desc ? '&desc=' + encodeURIComponent(String(desc)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListHealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Get ids of healthcare party matching the provided filter for the current user (HcParty)\n * @param body\n */\n matchHealthcarePartiesBy(body?: AbstractFilterHealthcareParty): Promise<Array<string>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/hcparty/match` + '?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) => JSON.parse(JSON.stringify(it))))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * No particular return value. It's just a message.\n * @summary Modify a Healthcare Party.\n * @param body\n */\n modifyHealthcareParty(body?: HealthcareParty): Promise<HealthcareParty> {\n let _body = null\n _body = body\n\n const _url = this.host + `/hcparty` + '?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 HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * No particular return value. It's just a message.\n * @summary Modify a Healthcare Party.\n * @param body\n * @param groupId\n */\n modifyHealthcarePartyInGroup(groupId: string, body?: HealthcareParty): Promise<HealthcareParty> {\n let _body = null\n _body = body\n\n const _url = this.host + `/hcparty/inGroup/${encodeURIComponent(String(groupId))}` + '?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 HealthcareParty(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Register a new hcp into the system\n * @summary Register a hcp\n * @param body\n * @param groupId\n * @param parentHcPartyId\n * @param token\n * @param useShortToken\n */\n registerHealthcareParty(\n groupId: string,\n parentHcPartyId?: string,\n token?: string,\n useShortToken?: boolean,\n body?: HealthcareParty\n ): Promise<DataOwnerRegistrationSuccess> {\n let _body = null\n _body = body\n\n const _url =\n this.host +\n `/hcparty/register/inGroup/${encodeURIComponent(String(groupId))}` +\n '?ts=' +\n new Date().getTime() +\n (parentHcPartyId ? '&parentHcPartyId=' + encodeURIComponent(String(parentHcPartyId)) : '') +\n (token ? '&token=' + encodeURIComponent(String(token)) : '') +\n (useShortToken ? '&useShortToken=' + encodeURIComponent(String(useShortToken)) : '')\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 DataOwnerRegistrationSuccess(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
@@ -188,7 +188,7 @@ class SecureDelegationsManager {
188
188
  else if (delegateInfo.requiresAnonymousDelegations && !this.selfNeedsAnonymousDelegations) {
189
189
  return {
190
190
  explicitDelegator: selfId,
191
- encryptedExchangeDataId: yield this.secureDelegationsEncryption.encryptExchangeDataId(exchangeData.id, Object.fromEntries(this.userKeys.getSelfVerifiedKeys().map((keyInfo) => [keyInfo.fingerprint, keyInfo.pair.publicKey]))),
191
+ encryptedExchangeDataId: yield this.secureDelegationsEncryption.encryptExchangeDataId(exchangeData.id, Object.fromEntries(this.userKeys.getSelfVerifiedKeys().map((keyInfo) => [(0, utils_1.fingerprintV1toV2)(keyInfo.fingerprint), keyInfo.pair.publicKey]))),
192
192
  };
193
193
  }
194
194
  else if (!delegateInfo.requiresAnonymousDelegations && this.selfNeedsAnonymousDelegations) {
@@ -1 +1 @@
1
- {"version":3,"file":"SecureDelegationsManager.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/SecureDelegationsManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wFAAoF;AAKpF,oFAA6E;AAC7E,mCAA2F;AAK3F,oCAAyC;AAIzC,2EAAuE;AACvE,sHAAkH;AAClH,IAAO,mBAAmB,GAAG,qEAAiC,CAAC,mBAAmB,CAAA;AAClF,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AACzD,2EAAuE;AAEvE,+BAAkC;AAElC,MAAa,wBAAwB;IACnC,YACmB,mBAAwC,EACxC,sBAA8C,EAC9C,2BAAwD,EACxD,wBAAkD,EAClD,QAAmC,EACnC,UAA4B,EAC5B,YAA8B,EAC9B,gBAAkC,EAClC,6BAAsC;QARtC,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,gCAA2B,GAA3B,2BAA2B,CAA6B;QACxD,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,aAAQ,GAAR,QAAQ,CAA2B;QACnC,eAAU,GAAV,UAAU,CAAkB;QAC5B,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,kCAA6B,GAA7B,6BAA6B,CAAS;QAGxC,uBAAkB,GAO/B,IAAI,oDAAuB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;IATvD,CAAC;IAWJ;;;;;;;;;;OAUG;IACG,sCAAsC,CAC1C,MAA2C,EAC3C,UAAwC,EACxC,SAAmB,EACnB,eAAyB,EACzB,cAAwB,EACxB,eAA2E;;YAE3E,MAAM,cAAc,GAA4B,EAAE,MAAM,E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AAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAA;QACrG,MAAM,yBAAyB,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAA;QAC5D,MAAM,yBAAyB,GAAG,MAAA,gBAAgB,CAAC,iBAAiB,0CAAG,yBAAyB,CAAC,CAAA;QACjG,OAAO,CACL,MAAA,gBAAgB,CAAC,CAAC,CAAC,mCACnB,CAAC,CAAC,CAAC,yBAAyB,IAAI,CAAC,CAAC,yBAAyB;YACzD,CAAC,CAAC,EAAE,YAAY,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE;YAC1F,CAAC,CAAC,SAAS,CAAC,CACf,CAAA;IACH,CAAC;CACF;AAjaD,4DAiaC","sourcesContent":["import { EntityShareRequest } from '../../icc-api/model/requests/EntityShareRequest'\nimport { IccDataOwnerXApi } from '../icc-data-owner-x-api'\nimport { UserEncryptionKeysManager } from './UserEncryptionKeysManager'\nimport { CryptoStrategies } from './CryptoStrategies'\nimport { EncryptedEntityWithType, EntityWithDelegationTypeName } from '../utils/EntityWithDelegationTypeName'\nimport { LruTemporisedAsyncCache } from '../utils/lru-temporised-async-cache'\nimport { fingerprintV2, hexPublicKeysWithSha1Of, hexPublicKeysWithSha256Of } from './utils'\nimport { ExchangeDataManager } from './ExchangeDataManager'\nimport { ExchangeData } from '../../icc-api/model/internal/ExchangeData'\nimport { SecureDelegationsEncryption } from './SecureDelegationsEncryption'\nimport { CryptoPrimitives } from './CryptoPrimitives'\nimport { hex2ua, ua2hex } from '../utils'\nimport { AccessControlSecretUtils } from './AccessControlSecretUtils'\nimport { EntityShareOrMetadataUpdateRequest } from '../../icc-api/model/requests/EntityShareOrMetadataUpdateRequest'\nimport { EncryptedEntity, EncryptedEntityStub } from '../../icc-api/model/models'\nimport { SecureDelegation } from '../../icc-api/model/SecureDelegation'\nimport { EntitySharedMetadataUpdateRequest } from '../../icc-api/model/requests/EntitySharedMetadataUpdateRequest'\nimport EntryUpdateTypeEnum = EntitySharedMetadataUpdateRequest.EntryUpdateTypeEnum\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport { SecurityMetadata } from '../../icc-api/model/SecurityMetadata'\nimport { ExchangeDataMapManager } from './ExchangeDataMapManager'\nimport { ShaVersion } from './RSA'\n\nexport class SecureDelegationsManager {\n constructor(\n private readonly exchangeDataManager: ExchangeDataManager,\n private readonly exchangeDataMapManager: ExchangeDataMapManager,\n private readonly secureDelegationsEncryption: SecureDelegationsEncryption,\n private readonly accessControlSecretUtils: AccessControlSecretUtils,\n private readonly userKeys: UserEncryptionKeysManager,\n private readonly primitives: CryptoPrimitives,\n private readonly dataOwnerApi: IccDataOwnerXApi,\n private readonly cryptoStrategies: CryptoStrategies,\n private readonly selfNeedsAnonymousDelegations: boolean\n ) {}\n\n private readonly dataOwnerInfoCache: LruTemporisedAsyncCache<\n string,\n {\n requiresAnonymousDelegations: boolean\n availablePublicKeysHexWithSha1: string[]\n availablePublicKeysHexWithSha256: string[]\n }\n > = new LruTemporisedAsyncCache(100, () => 30 * 60 * 1000)\n\n /**\n * Note: this method does not save the updated entity.\n * @param entity an entity, must already have secret foreign keys initialised.\n * @param entityType the type of the entity\n * @param secretIds the initial secret ids to include and share with the auto-delegations\n * @param owningEntityIds the initial owning entity ids to include and share with the auto-delegations\n * @param encryptionKeys the initial encryption keys to include and share with the auto-delegations\n * @param autoDelegations the data owners which will initially have access to the entity in addition to the current data owner and the access level\n * they will have on the entity.\n * @return the entity with the security metadata initialised for the provided parameters.\n */\n async entityWithInitialisedEncryptedMetadata<T extends EncryptedEntity>(\n entity: T & { secretForeignKeys: string[] },\n entityType: EntityWithDelegationTypeName,\n secretIds: string[],\n owningEntityIds: string[],\n encryptionKeys: string[],\n autoDelegations: { [delegateId: string]: SecureDelegation.AccessLevelEnum }\n ): Promise<T> {\n const entityWithType: EncryptedEntityWithType = { entity, type: entityType }\n const rootDelegationInfo = await this.makeSecureDelegationInfo(\n entityWithType,\n await this.dataOwnerApi.getCurrentDataOwnerId(),\n secretIds,\n encryptionKeys,\n owningEntityIds,\n AccessLevelEnum.WRITE,\n undefined\n )\n const selfId = await this.dataOwnerApi.getCurrentDataOwnerId()\n const otherDelegationsInfo: {\n canonicalDelegationKey: string\n canonicalAccessControlKey: string\n delegation: SecureDelegation\n delegationKeyEquivalences: { [p: string]: string }\n encryptedExchangeDataId: { [fp: string]: string } | undefined\n }[] = []\n for (const [delegateId, permissions] of Object.entries(autoDelegations)) {\n if (delegateId !== selfId) {\n otherDelegationsInfo.push(\n await this.makeSecureDelegationInfo(\n entityWithType,\n delegateId,\n secretIds,\n encryptionKeys,\n owningEntityIds,\n permissions,\n rootDelegationInfo.canonicalDelegationKey\n )\n )\n }\n }\n const secureDelegations = Object.fromEntries(\n [rootDelegationInfo, ...otherDelegationsInfo].map(({ canonicalDelegationKey, delegation }) => [canonicalDelegationKey, delegation])\n )\n const keysEquivalences = {\n ...rootDelegationInfo.delegationKeyEquivalences,\n }\n for (const { delegationKeyEquivalences: otherKeyEquivalences } of otherDelegationsInfo) {\n Object.assign(keysEquivalences, otherKeyEquivalences)\n }\n const newExchangeDataMaps = Object.fromEntries(\n otherDelegationsInfo\n .filter(({ encryptedExchangeDataId }) => !!encryptedExchangeDataId)\n .map(({ canonicalAccessControlKey, encryptedExchangeDataId }) => [canonicalAccessControlKey, encryptedExchangeDataId!])\n )\n await this.exchangeDataMapManager.createExchangeDataMaps(newExchangeDataMaps)\n return {\n ...entity,\n securityMetadata: new SecurityMetadata({ secureDelegations, keysEquivalences }),\n }\n }\n\n /**\n * Make a request for sharing an entity with a delegate or to update existing shared metadata by adding additional secretIds, encryptionKeys or\n * owningEntityIds if there is already some metadata shared between the current data owner and the delegate. In case there is already a delegation\n * for the delegate, and it already contains all the provided metadata, this method returns undefined, since there is no need to make any request to\n * share the provided data.\n * @param entityWithType an entity with type\n * @param delegateId the id of the delegate\n * @param shareSecretIds the secret ids to share\n * @param shareEncryptionKeys the encryption keys to share\n * @param shareOwningEntityIds the owning entity ids to share\n * @param newDelegationPermissions the permissions to grant to the delegate in case a new delegation needs to be created. If this method creates an\n * update request instead of a share request, this parameter is ignored.\n * @return the request to share the entity, or the request to update the shared metadata for the entity, or undefined if there is no need to update\n * the entity to allow the delegate to access the provided data.\n */\n async makeShareOrUpdateRequestParams(\n entityWithType: EncryptedEntityWithType,\n delegateId: string,\n shareSecretIds: string[],\n shareEncryptionKeys: string[],\n shareOwningEntityIds: string[],\n newDelegationPermissions: EntityShareRequest.RequestedPermissionInternal\n ): Promise<EntityShareOrMetadataUpdateRequest | undefined> {\n const exchangeDataInfo = await this.exchangeDataManager.getOrCreateEncryptionDataTo(\n delegateId,\n entityWithType.type,\n entityWithType.entity.secretForeignKeys ?? [],\n false\n )\n const accessControlHashes = await this.accessControlSecretUtils.secureDelegationKeysFor(\n exchangeDataInfo.accessControlSecret,\n entityWithType.type,\n entityWithType.entity.secretForeignKeys ?? []\n )\n const existingSecureDelegation = this.getExistingCanonicalKeyAndSecureDelegation(entityWithType.entity, accessControlHashes)\n if (existingSecureDelegation) {\n const updateParams = await this.makeUpdateRequestParams(\n existingSecureDelegation.canonicalKey,\n existingSecureDelegation.secureDelegation,\n exchangeDataInfo,\n shareSecretIds,\n shareEncryptionKeys,\n shareOwningEntityIds\n )\n return updateParams ? { update: updateParams } : undefined\n } else {\n const accessControlKeys = (\n await this.accessControlSecretUtils.accessControlKeysFor(\n exchangeDataInfo.accessControlSecret,\n entityWithType.type,\n entityWithType.entity.secretForeignKeys ?? []\n )\n ).map((x) => ua2hex(x))\n return {\n share: await this.makeShareRequestParams(\n exchangeDataInfo,\n accessControlKeys,\n delegateId,\n shareSecretIds,\n shareEncryptionKeys,\n shareOwningEntityIds,\n newDelegationPermissions\n ),\n }\n }\n }\n\n private async makeUpdateRequestParams(\n canonicalKey: string,\n existingDelegation: SecureDelegation,\n exchangeDataInfo: { exchangeData: ExchangeData; accessControlSecret: string; exchangeKey: CryptoKey },\n shareSecretIds: string[],\n shareEncryptionKeys: string[],\n shareOwningEntityIds: string[]\n ): Promise<EntitySharedMetadataUpdateRequest | undefined> {\n const existingSecretIds = new Set(await this.secureDelegationsEncryption.decryptSecretIds(existingDelegation, exchangeDataInfo.exchangeKey))\n const existingEncryptionKeys = new Set(\n await this.secureDelegationsEncryption.decryptEncryptionKeys(existingDelegation, exchangeDataInfo.exchangeKey)\n )\n const existingOwningEntityIds = new Set(\n await this.secureDelegationsEncryption.decryptOwningEntityIds(existingDelegation, exchangeDataInfo.exchangeKey)\n )\n const newSecretIds = shareSecretIds.filter((id) => !existingSecretIds.has(id))\n const newEncryptionKeys = shareEncryptionKeys.filter((key) => !existingEncryptionKeys.has(key))\n const newOwningEntityIds = shareOwningEntityIds.filter((id) => !existingOwningEntityIds.has(id))\n if (newSecretIds.length || newEncryptionKeys.length || newOwningEntityIds.length) {\n const encryptedNewSecretIds = await this.secureDelegationsEncryption.encryptSecretIds(newSecretIds, exchangeDataInfo.exchangeKey)\n const encryptedNewEncryptionKeys = await this.secureDelegationsEncryption.encryptEncryptionKeys(newEncryptionKeys, exchangeDataInfo.exchangeKey)\n const encryptedNewOwningEntityIds = await this.secureDelegationsEncryption.encryptOwningEntityIds(\n newOwningEntityIds,\n exchangeDataInfo.exchangeKey\n )\n return new EntitySharedMetadataUpdateRequest({\n metadataAccessControlHash: canonicalKey,\n secretIds: Object.fromEntries(encryptedNewSecretIds.map((id) => [id, EntryUpdateTypeEnum.CREATE])),\n encryptionKeys: Object.fromEntries(encryptedNewEncryptionKeys.map((key) => [key, EntryUpdateTypeEnum.CREATE])),\n owningEntityIds: Object.fromEntries(encryptedNewOwningEntityIds.map((id) => [id, EntryUpdateTypeEnum.CREATE])),\n })\n } else return undefined\n }\n\n private async makeShareRequestParams(\n exchangeDataInfo: { exchangeData: ExchangeData; accessControlSecret: string; exchangeKey: CryptoKey },\n accessControlKeys: string[],\n delegateId: string,\n shareSecretIds: string[],\n shareEncryptionKeys: string[],\n shareOwningEntityIds: string[],\n newDelegationPermissions: EntityShareRequest.RequestedPermissionInternal\n ): Promise<EntityShareRequest> {\n return new EntityShareRequest({\n ...(await this.makeSecureDelegationEncryptedData(exchangeDataInfo, delegateId, shareSecretIds, shareEncryptionKeys, shareOwningEntityIds)),\n requestedPermissions: newDelegationPermissions,\n accessControlKeys,\n })\n }\n\n private async makeSecureDelegationInfo(\n entity: EncryptedEntityWithType,\n delegateId: string,\n shareSecretIds: string[],\n shareEncryptionKeys: string[],\n shareOwningEntityIds: string[],\n permissions: AccessLevelEnum,\n parentDelegationKey: string | undefined\n ): Promise<{\n canonicalDelegationKey: string\n canonicalAccessControlKey: string\n delegation: SecureDelegation\n encryptedExchangeDataId: { [fp: string]: string } | undefined\n delegationKeyEquivalences: { [alias: string]: string }\n }> {\n // Be wary of explicit delegator and explicit delegate\n const exchangeDataInfo = await this.exchangeDataManager.getOrCreateEncryptionDataTo(\n delegateId,\n entity.type,\n entity.entity.secretForeignKeys ?? [],\n false\n )\n const accessControlHashes = await this.accessControlSecretUtils.secureDelegationKeysFor(\n exchangeDataInfo.accessControlSecret,\n entity.type,\n entity.entity.secretForeignKeys ?? []\n )\n const accessControlKeys = (\n await this.accessControlSecretUtils.accessControlKeysFor(\n exchangeDataInfo.accessControlSecret,\n entity.type,\n entity.entity.secretForeignKeys ?? []\n )\n ).map((x) => ua2hex(x))\n const accessControlKeysToHashes = accessControlKeys\n .map((key, index) => {\n return [key, accessControlHashes[index]]\n })\n .sort((a, b) => a[1].localeCompare(b[1]))\n\n const canonicalKey = accessControlKeysToHashes[0][1]\n const keyEquivalences = Object.fromEntries(accessControlKeysToHashes.slice(1).map((hash) => [hash[1], canonicalKey]))\n const encryptedDelegationInfo = await this.makeSecureDelegationEncryptedData(\n exchangeDataInfo,\n delegateId,\n shareSecretIds,\n shareEncryptionKeys,\n shareOwningEntityIds\n )\n const delegation = new SecureDelegation({\n delegator: encryptedDelegationInfo?.explicitDelegator,\n delegate: encryptedDelegationInfo?.explicitDelegate,\n secretIds: encryptedDelegationInfo?.secretIds,\n encryptionKeys: encryptedDelegationInfo?.encryptionKeys,\n owningEntityIds: encryptedDelegationInfo?.owningEntityIds,\n parentDelegations: parentDelegationKey ? [parentDelegationKey] : undefined,\n exchangeDataId: encryptedDelegationInfo?.exchangeDataId,\n encryptedExchangeDataId: encryptedDelegationInfo?.encryptedExchangeDataId,\n permissions: permissions,\n })\n return {\n canonicalDelegationKey: canonicalKey,\n canonicalAccessControlKey: accessControlKeysToHashes[0][0],\n delegation,\n encryptedExchangeDataId: encryptedDelegationInfo?.encryptedExchangeDataId,\n delegationKeyEquivalences: keyEquivalences,\n }\n }\n\n private async makeSecureDelegationEncryptedData(\n exchangeDataInfo: { exchangeData: ExchangeData; accessControlSecret: string; exchangeKey: CryptoKey },\n delegateId: string,\n shareSecretIds: string[],\n shareEncryptionKeys: string[],\n shareOwningEntityIds: string[]\n ): Promise<{\n explicitDelegator?: string\n explicitDelegate?: string\n secretIds?: string[]\n encryptionKeys?: string[]\n owningEntityIds?: string[]\n exchangeDataId?: string\n encryptedExchangeDataId?: { [fp: string]: string } // TODO if secure delegation info, check cache before calculating\n }> {\n const selfId = await this.dataOwnerApi.getCurrentDataOwnerId()\n const exchangeDataIdInfo =\n delegateId === selfId\n ? this.makeExchangeDataIdInfoForSelf(selfId, exchangeDataInfo.exchangeData)\n : await this.makeExchangeDataIdInfoForDelegate(selfId, delegateId, exchangeDataInfo.exchangeData)\n const encryptedSecretIds = await this.secureDelegationsEncryption.encryptSecretIds(shareSecretIds, exchangeDataInfo.exchangeKey)\n const encryptedEncryptionKeys = await this.secureDelegationsEncryption.encryptEncryptionKeys(shareEncryptionKeys, exchangeDataInfo.exchangeKey)\n const encryptedOwningEntityIds = await this.secureDelegationsEncryption.encryptOwningEntityIds(shareOwningEntityIds, exchangeDataInfo.exchangeKey)\n return {\n ...exchangeDataIdInfo,\n secretIds: encryptedSecretIds,\n encryptionKeys: encryptedEncryptionKeys,\n owningEntityIds: encryptedOwningEntityIds,\n }\n }\n\n private async makeExchangeDataIdInfoForDelegate(\n selfId: string,\n delegateId: string,\n exchangeData: ExchangeData\n ): Promise<{\n exchangeDataId?: string\n encryptedExchangeDataId?: { [fp: string]: string }\n explicitDelegator?: string\n explicitDelegate?: string\n }> {\n const delegateInfo = await this.getDataOwnerInfo(delegateId)\n if (!delegateInfo.requiresAnonymousDelegations && !this.selfNeedsAnonymousDelegations) {\n return {\n explicitDelegator: selfId,\n explicitDelegate: delegateId,\n exchangeDataId: exchangeData.id,\n }\n } else if (delegateInfo.requiresAnonymousDelegations && !this.selfNeedsAnonymousDelegations) {\n return {\n explicitDelegator: selfId,\n encryptedExchangeDataId: await this.secureDelegationsEncryption.encryptExchangeDataId(\n exchangeData.id!,\n Object.fromEntries(this.userKeys.getSelfVerifiedKeys().map((keyInfo) => [keyInfo.fingerprint, keyInfo.pair.publicKey]))\n ),\n }\n } else if (!delegateInfo.requiresAnonymousDelegations && this.selfNeedsAnonymousDelegations) {\n /**\n * Important: this requires that the exchange data signature also validates the authenticity of the public keys included in there.\n */\n const fingerprintsOfVerifiedExchangeData = new Set(Object.keys(exchangeData.exchangeKey))\n const delegateVerifiedKeys: { [fp: string]: CryptoKey } = {}\n for (const keyHex of [...delegateInfo.availablePublicKeysHexWithSha1, ...delegateInfo.availablePublicKeysHexWithSha256]) {\n const currFp = fingerprintV2(keyHex)\n const shaVersion = delegateInfo.availablePublicKeysHexWithSha1.includes(keyHex) ? ShaVersion.Sha1 : ShaVersion.Sha256\n if (fingerprintsOfVerifiedExchangeData.has(currFp)) {\n delegateVerifiedKeys[currFp] = await this.primitives.RSA.importKey('spki', hex2ua(keyHex), ['encrypt'], shaVersion)\n }\n }\n if (!Object.keys(delegateVerifiedKeys).length)\n throw new Error('Illegal state: could not find any verified key for delegate in verified exchange data.')\n return {\n explicitDelegate: delegateId,\n encryptedExchangeDataId: await this.secureDelegationsEncryption.encryptExchangeDataId(exchangeData.id!, delegateVerifiedKeys),\n }\n } else return {}\n }\n\n private makeExchangeDataIdInfoForSelf(\n selfId: string,\n exchangeData: ExchangeData\n ): {\n exchangeDataId?: string\n encryptedExchangeDataId?: { [fp: string]: string }\n explicitDelegator?: string\n explicitDelegate?: string\n } {\n if (this.selfNeedsAnonymousDelegations) {\n return {}\n } else {\n return {\n exchangeDataId: exchangeData.id,\n explicitDelegator: selfId,\n explicitDelegate: selfId,\n }\n }\n }\n\n private async getDataOwnerInfo(dataOwnerId: string) {\n return this.dataOwnerInfoCache.get(dataOwnerId, async () => {\n const dataOwnerWithType = await this.dataOwnerApi.getCryptoActorStub(dataOwnerId)\n return {\n item: {\n requiresAnonymousDelegations: this.cryptoStrategies.dataOwnerRequiresAnonymousDelegation(dataOwnerWithType),\n availablePublicKeysHexWithSha1: Array.from(hexPublicKeysWithSha1Of(dataOwnerWithType.stub)),\n availablePublicKeysHexWithSha256: Array.from(hexPublicKeysWithSha256Of(dataOwnerWithType.stub)),\n },\n }\n })\n }\n\n private getExistingCanonicalKeyAndSecureDelegation(\n entity: EncryptedEntityStub | EncryptedEntity,\n hashes: string[]\n ): { canonicalKey: string; secureDelegation: SecureDelegation } | undefined {\n const securityMetadata = entity.securityMetadata ?? {}\n const canonicalByEquivalences = Array.from(new Set(hashes.flatMap((hash) => securityMetadata.keysEquivalences?.[hash] ?? [])))\n const directRetrievals = hashes.flatMap((hash) => {\n const retrievedMetadata = securityMetadata.secureDelegations?.[hash]\n return retrievedMetadata ? { canonicalKey: hash, secureDelegation: retrievedMetadata } : []\n })\n if (\n directRetrievals.length > 1 ||\n canonicalByEquivalences.length > 1 ||\n (!!canonicalByEquivalences[0] && !!directRetrievals[0]?.canonicalKey && canonicalByEquivalences[0] !== directRetrievals[0]?.canonicalKey)\n )\n throw new Error('Illegal state: multiple secure delegations matching equivalent hashes of entity.')\n const canonicalFromEquivalences = canonicalByEquivalences[0]\n const retrievedFromEquivalences = securityMetadata.secureDelegations?.[canonicalFromEquivalences]\n return (\n directRetrievals[0] ??\n (!!canonicalFromEquivalences && !!retrievedFromEquivalences\n ? { canonicalKey: canonicalFromEquivalences, secureDelegation: retrievedFromEquivalences }\n : undefined)\n )\n }\n}\n"]}
1
+ {"version":3,"file":"SecureDelegationsManager.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/SecureDelegationsManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wFAAoF;AAKpF,oFAA6E;AAC7E,mCAA8G;AAK9G,oCAAyC;AAIzC,2EAAuE;AACvE,sHAAkH;AAClH,IAAO,mBAAmB,GAAG,qEAAiC,CAAC,mBAAmB,CAAA;AAClF,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AACzD,2EAAuE;AAEvE,+BAAkC;AAElC,MAAa,wBAAwB;IACnC,YACmB,mBAAwC,EACxC,sBAA8C,EAC9C,2BAAwD,EACxD,wBAAkD,EAClD,QAAmC,EACnC,UAA4B,EAC5B,YAA8B,EAC9B,gBAAkC,EAClC,6BAAsC;QARtC,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,gCAA2B,GAA3B,2BAA2B,CAA6B;QACxD,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,aAAQ,GAAR,QAAQ,CAA2B;QACnC,eAAU,GAAV,UAAU,CAAkB;QAC5B,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,kCAA6B,GAA7B,6BAA6B,CAAS;QAGxC,uBAAkB,GAO/B,IAAI,oDAAuB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;IATvD,CAAC;IAWJ;;;;;;;;;;OAUG;IACG,sCAAsC,CAC1C,MAA2C,EAC3C,UAAwC,EACxC,SAAmB,EACnB,eAAyB,EACzB,cAAwB,EACxB,eAA2E;;YAE3E,MAAM,cAAc,GAA4B,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;YAC5E,MAAM,kBAAkB,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F,CAAC,CAAA;QACrG,MAAM,yBAAyB,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAA;QAC5D,MAAM,yBAAyB,GAAG,MAAA,gBAAgB,CAAC,iBAAiB,0CAAG,yBAAyB,CAAC,CAAA;QACjG,OAAO,CACL,MAAA,gBAAgB,CAAC,CAAC,CAAC,mCACnB,CAAC,CAAC,CAAC,yBAAyB,IAAI,CAAC,CAAC,yBAAyB;YACzD,CAAC,CAAC,EAAE,YAAY,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE;YAC1F,CAAC,CAAC,SAAS,CAAC,CACf,CAAA;IACH,CAAC;CACF;AAjaD,4DAiaC","sourcesContent":["import { EntityShareRequest } from '../../icc-api/model/requests/EntityShareRequest'\nimport { IccDataOwnerXApi } from '../icc-data-owner-x-api'\nimport { UserEncryptionKeysManager } from './UserEncryptionKeysManager'\nimport { CryptoStrategies } from './CryptoStrategies'\nimport { EncryptedEntityWithType, EntityWithDelegationTypeName } from '../utils/EntityWithDelegationTypeName'\nimport { LruTemporisedAsyncCache } from '../utils/lru-temporised-async-cache'\nimport { fingerprintV1toV2, fingerprintV2, hexPublicKeysWithSha1Of, hexPublicKeysWithSha256Of } from './utils'\nimport { ExchangeDataManager } from './ExchangeDataManager'\nimport { ExchangeData } from '../../icc-api/model/internal/ExchangeData'\nimport { SecureDelegationsEncryption } from './SecureDelegationsEncryption'\nimport { CryptoPrimitives } from './CryptoPrimitives'\nimport { hex2ua, ua2hex } from '../utils'\nimport { AccessControlSecretUtils } from './AccessControlSecretUtils'\nimport { EntityShareOrMetadataUpdateRequest } from '../../icc-api/model/requests/EntityShareOrMetadataUpdateRequest'\nimport { EncryptedEntity, EncryptedEntityStub } from '../../icc-api/model/models'\nimport { SecureDelegation } from '../../icc-api/model/SecureDelegation'\nimport { EntitySharedMetadataUpdateRequest } from '../../icc-api/model/requests/EntitySharedMetadataUpdateRequest'\nimport EntryUpdateTypeEnum = EntitySharedMetadataUpdateRequest.EntryUpdateTypeEnum\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport { SecurityMetadata } from '../../icc-api/model/SecurityMetadata'\nimport { ExchangeDataMapManager } from './ExchangeDataMapManager'\nimport { ShaVersion } from './RSA'\n\nexport class SecureDelegationsManager {\n constructor(\n private readonly exchangeDataManager: ExchangeDataManager,\n private readonly exchangeDataMapManager: ExchangeDataMapManager,\n private readonly secureDelegationsEncryption: SecureDelegationsEncryption,\n private readonly accessControlSecretUtils: AccessControlSecretUtils,\n private readonly userKeys: UserEncryptionKeysManager,\n private readonly primitives: CryptoPrimitives,\n private readonly dataOwnerApi: IccDataOwnerXApi,\n private readonly cryptoStrategies: CryptoStrategies,\n private readonly selfNeedsAnonymousDelegations: boolean\n ) {}\n\n private readonly dataOwnerInfoCache: LruTemporisedAsyncCache<\n string,\n {\n requiresAnonymousDelegations: boolean\n availablePublicKeysHexWithSha1: string[]\n availablePublicKeysHexWithSha256: string[]\n }\n > = new LruTemporisedAsyncCache(100, () => 30 * 60 * 1000)\n\n /**\n * Note: this method does not save the updated entity.\n * @param entity an entity, must already have secret foreign keys initialised.\n * @param entityType the type of the entity\n * @param secretIds the initial secret ids to include and share with the auto-delegations\n * @param owningEntityIds the initial owning entity ids to include and share with the auto-delegations\n * @param encryptionKeys the initial encryption keys to include and share with the auto-delegations\n * @param autoDelegations the data owners which will initially have access to the entity in addition to the current data owner and the access level\n * they will have on the entity.\n * @return the entity with the security metadata initialised for the provided parameters.\n */\n async entityWithInitialisedEncryptedMetadata<T extends EncryptedEntity>(\n entity: T & { secretForeignKeys: string[] },\n entityType: EntityWithDelegationTypeName,\n secretIds: string[],\n owningEntityIds: string[],\n encryptionKeys: string[],\n autoDelegations: { [delegateId: string]: SecureDelegation.AccessLevelEnum }\n ): Promise<T> {\n const entityWithType: EncryptedEntityWithType = { entity, type: entityType }\n const rootDelegationInfo = await this.makeSecureDelegationInfo(\n entityWithType,\n await this.dataOwnerApi.getCurrentDataOwnerId(),\n secretIds,\n encryptionKeys,\n owningEntityIds,\n AccessLevelEnum.WRITE,\n undefined\n )\n const selfId = await this.dataOwnerApi.getCurrentDataOwnerId()\n const otherDelegationsInfo: {\n canonicalDelegationKey: string\n canonicalAccessControlKey: string\n delegation: SecureDelegation\n delegationKeyEquivalences: { [p: string]: string }\n encryptedExchangeDataId: { [fp: string]: string } | undefined\n }[] = []\n for (const [delegateId, permissions] of Object.entries(autoDelegations)) {\n if (delegateId !== selfId) {\n otherDelegationsInfo.push(\n await this.makeSecureDelegationInfo(\n entityWithType,\n delegateId,\n secretIds,\n encryptionKeys,\n owningEntityIds,\n permissions,\n rootDelegationInfo.canonicalDelegationKey\n )\n )\n }\n }\n const secureDelegations = Object.fromEntries(\n [rootDelegationInfo, ...otherDelegationsInfo].map(({ canonicalDelegationKey, delegation }) => [canonicalDelegationKey, delegation])\n )\n const keysEquivalences = {\n ...rootDelegationInfo.delegationKeyEquivalences,\n }\n for (const { delegationKeyEquivalences: otherKeyEquivalences } of otherDelegationsInfo) {\n Object.assign(keysEquivalences, otherKeyEquivalences)\n }\n const newExchangeDataMaps = Object.fromEntries(\n otherDelegationsInfo\n .filter(({ encryptedExchangeDataId }) => !!encryptedExchangeDataId)\n .map(({ canonicalAccessControlKey, encryptedExchangeDataId }) => [canonicalAccessControlKey, encryptedExchangeDataId!])\n )\n await this.exchangeDataMapManager.createExchangeDataMaps(newExchangeDataMaps)\n return {\n ...entity,\n securityMetadata: new SecurityMetadata({ secureDelegations, keysEquivalences }),\n }\n }\n\n /**\n * Make a request for sharing an entity with a delegate or to update existing shared metadata by adding additional secretIds, encryptionKeys or\n * owningEntityIds if there is already some metadata shared between the current data owner and the delegate. In case there is already a delegation\n * for the delegate, and it already contains all the provided metadata, this method returns undefined, since there is no need to make any request to\n * share the provided data.\n * @param entityWithType an entity with type\n * @param delegateId the id of the delegate\n * @param shareSecretIds the secret ids to share\n * @param shareEncryptionKeys the encryption keys to share\n * @param shareOwningEntityIds the owning entity ids to share\n * @param newDelegationPermissions the permissions to grant to the delegate in case a new delegation needs to be created. If this method creates an\n * update request instead of a share request, this parameter is ignored.\n * @return the request to share the entity, or the request to update the shared metadata for the entity, or undefined if there is no need to update\n * the entity to allow the delegate to access the provided data.\n */\n async makeShareOrUpdateRequestParams(\n entityWithType: EncryptedEntityWithType,\n delegateId: string,\n shareSecretIds: string[],\n shareEncryptionKeys: string[],\n shareOwningEntityIds: string[],\n newDelegationPermissions: EntityShareRequest.RequestedPermissionInternal\n ): Promise<EntityShareOrMetadataUpdateRequest | undefined> {\n const exchangeDataInfo = await this.exchangeDataManager.getOrCreateEncryptionDataTo(\n delegateId,\n entityWithType.type,\n entityWithType.entity.secretForeignKeys ?? [],\n false\n )\n const accessControlHashes = await this.accessControlSecretUtils.secureDelegationKeysFor(\n exchangeDataInfo.accessControlSecret,\n entityWithType.type,\n entityWithType.entity.secretForeignKeys ?? []\n )\n const existingSecureDelegation = this.getExistingCanonicalKeyAndSecureDelegation(entityWithType.entity, accessControlHashes)\n if (existingSecureDelegation) {\n const updateParams = await this.makeUpdateRequestParams(\n existingSecureDelegation.canonicalKey,\n existingSecureDelegation.secureDelegation,\n exchangeDataInfo,\n shareSecretIds,\n shareEncryptionKeys,\n shareOwningEntityIds\n )\n return updateParams ? { update: updateParams } : undefined\n } else {\n const accessControlKeys = (\n await this.accessControlSecretUtils.accessControlKeysFor(\n exchangeDataInfo.accessControlSecret,\n entityWithType.type,\n entityWithType.entity.secretForeignKeys ?? []\n )\n ).map((x) => ua2hex(x))\n return {\n share: await this.makeShareRequestParams(\n exchangeDataInfo,\n accessControlKeys,\n delegateId,\n shareSecretIds,\n shareEncryptionKeys,\n shareOwningEntityIds,\n newDelegationPermissions\n ),\n }\n }\n }\n\n private async makeUpdateRequestParams(\n canonicalKey: string,\n existingDelegation: SecureDelegation,\n exchangeDataInfo: { exchangeData: ExchangeData; accessControlSecret: string; exchangeKey: CryptoKey },\n shareSecretIds: string[],\n shareEncryptionKeys: string[],\n shareOwningEntityIds: string[]\n ): Promise<EntitySharedMetadataUpdateRequest | undefined> {\n const existingSecretIds = new Set(await this.secureDelegationsEncryption.decryptSecretIds(existingDelegation, exchangeDataInfo.exchangeKey))\n const existingEncryptionKeys = new Set(\n await this.secureDelegationsEncryption.decryptEncryptionKeys(existingDelegation, exchangeDataInfo.exchangeKey)\n )\n const existingOwningEntityIds = new Set(\n await this.secureDelegationsEncryption.decryptOwningEntityIds(existingDelegation, exchangeDataInfo.exchangeKey)\n )\n const newSecretIds = shareSecretIds.filter((id) => !existingSecretIds.has(id))\n const newEncryptionKeys = shareEncryptionKeys.filter((key) => !existingEncryptionKeys.has(key))\n const newOwningEntityIds = shareOwningEntityIds.filter((id) => !existingOwningEntityIds.has(id))\n if (newSecretIds.length || newEncryptionKeys.length || newOwningEntityIds.length) {\n const encryptedNewSecretIds = await this.secureDelegationsEncryption.encryptSecretIds(newSecretIds, exchangeDataInfo.exchangeKey)\n const encryptedNewEncryptionKeys = await this.secureDelegationsEncryption.encryptEncryptionKeys(newEncryptionKeys, exchangeDataInfo.exchangeKey)\n const encryptedNewOwningEntityIds = await this.secureDelegationsEncryption.encryptOwningEntityIds(\n newOwningEntityIds,\n exchangeDataInfo.exchangeKey\n )\n return new EntitySharedMetadataUpdateRequest({\n metadataAccessControlHash: canonicalKey,\n secretIds: Object.fromEntries(encryptedNewSecretIds.map((id) => [id, EntryUpdateTypeEnum.CREATE])),\n encryptionKeys: Object.fromEntries(encryptedNewEncryptionKeys.map((key) => [key, EntryUpdateTypeEnum.CREATE])),\n owningEntityIds: Object.fromEntries(encryptedNewOwningEntityIds.map((id) => [id, EntryUpdateTypeEnum.CREATE])),\n })\n } else return undefined\n }\n\n private async makeShareRequestParams(\n exchangeDataInfo: { exchangeData: ExchangeData; accessControlSecret: string; exchangeKey: CryptoKey },\n accessControlKeys: string[],\n delegateId: string,\n shareSecretIds: string[],\n shareEncryptionKeys: string[],\n shareOwningEntityIds: string[],\n newDelegationPermissions: EntityShareRequest.RequestedPermissionInternal\n ): Promise<EntityShareRequest> {\n return new EntityShareRequest({\n ...(await this.makeSecureDelegationEncryptedData(exchangeDataInfo, delegateId, shareSecretIds, shareEncryptionKeys, shareOwningEntityIds)),\n requestedPermissions: newDelegationPermissions,\n accessControlKeys,\n })\n }\n\n private async makeSecureDelegationInfo(\n entity: EncryptedEntityWithType,\n delegateId: string,\n shareSecretIds: string[],\n shareEncryptionKeys: string[],\n shareOwningEntityIds: string[],\n permissions: AccessLevelEnum,\n parentDelegationKey: string | undefined\n ): Promise<{\n canonicalDelegationKey: string\n canonicalAccessControlKey: string\n delegation: SecureDelegation\n encryptedExchangeDataId: { [fp: string]: string } | undefined\n delegationKeyEquivalences: { [alias: string]: string }\n }> {\n // Be wary of explicit delegator and explicit delegate\n const exchangeDataInfo = await this.exchangeDataManager.getOrCreateEncryptionDataTo(\n delegateId,\n entity.type,\n entity.entity.secretForeignKeys ?? [],\n false\n )\n const accessControlHashes = await this.accessControlSecretUtils.secureDelegationKeysFor(\n exchangeDataInfo.accessControlSecret,\n entity.type,\n entity.entity.secretForeignKeys ?? []\n )\n const accessControlKeys = (\n await this.accessControlSecretUtils.accessControlKeysFor(\n exchangeDataInfo.accessControlSecret,\n entity.type,\n entity.entity.secretForeignKeys ?? []\n )\n ).map((x) => ua2hex(x))\n const accessControlKeysToHashes = accessControlKeys\n .map((key, index) => {\n return [key, accessControlHashes[index]]\n })\n .sort((a, b) => a[1].localeCompare(b[1]))\n\n const canonicalKey = accessControlKeysToHashes[0][1]\n const keyEquivalences = Object.fromEntries(accessControlKeysToHashes.slice(1).map((hash) => [hash[1], canonicalKey]))\n const encryptedDelegationInfo = await this.makeSecureDelegationEncryptedData(\n exchangeDataInfo,\n delegateId,\n shareSecretIds,\n shareEncryptionKeys,\n shareOwningEntityIds\n )\n const delegation = new SecureDelegation({\n delegator: encryptedDelegationInfo?.explicitDelegator,\n delegate: encryptedDelegationInfo?.explicitDelegate,\n secretIds: encryptedDelegationInfo?.secretIds,\n encryptionKeys: encryptedDelegationInfo?.encryptionKeys,\n owningEntityIds: encryptedDelegationInfo?.owningEntityIds,\n parentDelegations: parentDelegationKey ? [parentDelegationKey] : undefined,\n exchangeDataId: encryptedDelegationInfo?.exchangeDataId,\n encryptedExchangeDataId: encryptedDelegationInfo?.encryptedExchangeDataId,\n permissions: permissions,\n })\n return {\n canonicalDelegationKey: canonicalKey,\n canonicalAccessControlKey: accessControlKeysToHashes[0][0],\n delegation,\n encryptedExchangeDataId: encryptedDelegationInfo?.encryptedExchangeDataId,\n delegationKeyEquivalences: keyEquivalences,\n }\n }\n\n private async makeSecureDelegationEncryptedData(\n exchangeDataInfo: { exchangeData: ExchangeData; accessControlSecret: string; exchangeKey: CryptoKey },\n delegateId: string,\n shareSecretIds: string[],\n shareEncryptionKeys: string[],\n shareOwningEntityIds: string[]\n ): Promise<{\n explicitDelegator?: string\n explicitDelegate?: string\n secretIds?: string[]\n encryptionKeys?: string[]\n owningEntityIds?: string[]\n exchangeDataId?: string\n encryptedExchangeDataId?: { [fp: string]: string } // TODO if secure delegation info, check cache before calculating\n }> {\n const selfId = await this.dataOwnerApi.getCurrentDataOwnerId()\n const exchangeDataIdInfo =\n delegateId === selfId\n ? this.makeExchangeDataIdInfoForSelf(selfId, exchangeDataInfo.exchangeData)\n : await this.makeExchangeDataIdInfoForDelegate(selfId, delegateId, exchangeDataInfo.exchangeData)\n const encryptedSecretIds = await this.secureDelegationsEncryption.encryptSecretIds(shareSecretIds, exchangeDataInfo.exchangeKey)\n const encryptedEncryptionKeys = await this.secureDelegationsEncryption.encryptEncryptionKeys(shareEncryptionKeys, exchangeDataInfo.exchangeKey)\n const encryptedOwningEntityIds = await this.secureDelegationsEncryption.encryptOwningEntityIds(shareOwningEntityIds, exchangeDataInfo.exchangeKey)\n return {\n ...exchangeDataIdInfo,\n secretIds: encryptedSecretIds,\n encryptionKeys: encryptedEncryptionKeys,\n owningEntityIds: encryptedOwningEntityIds,\n }\n }\n\n private async makeExchangeDataIdInfoForDelegate(\n selfId: string,\n delegateId: string,\n exchangeData: ExchangeData\n ): Promise<{\n exchangeDataId?: string\n encryptedExchangeDataId?: { [fp: string]: string }\n explicitDelegator?: string\n explicitDelegate?: string\n }> {\n const delegateInfo = await this.getDataOwnerInfo(delegateId)\n if (!delegateInfo.requiresAnonymousDelegations && !this.selfNeedsAnonymousDelegations) {\n return {\n explicitDelegator: selfId,\n explicitDelegate: delegateId,\n exchangeDataId: exchangeData.id,\n }\n } else if (delegateInfo.requiresAnonymousDelegations && !this.selfNeedsAnonymousDelegations) {\n return {\n explicitDelegator: selfId,\n encryptedExchangeDataId: await this.secureDelegationsEncryption.encryptExchangeDataId(\n exchangeData.id!,\n Object.fromEntries(this.userKeys.getSelfVerifiedKeys().map((keyInfo) => [fingerprintV1toV2(keyInfo.fingerprint), keyInfo.pair.publicKey]))\n ),\n }\n } else if (!delegateInfo.requiresAnonymousDelegations && this.selfNeedsAnonymousDelegations) {\n /**\n * Important: this requires that the exchange data signature also validates the authenticity of the public keys included in there.\n */\n const fingerprintsOfVerifiedExchangeData = new Set(Object.keys(exchangeData.exchangeKey))\n const delegateVerifiedKeys: { [fp: string]: CryptoKey } = {}\n for (const keyHex of [...delegateInfo.availablePublicKeysHexWithSha1, ...delegateInfo.availablePublicKeysHexWithSha256]) {\n const currFp = fingerprintV2(keyHex)\n const shaVersion = delegateInfo.availablePublicKeysHexWithSha1.includes(keyHex) ? ShaVersion.Sha1 : ShaVersion.Sha256\n if (fingerprintsOfVerifiedExchangeData.has(currFp)) {\n delegateVerifiedKeys[currFp] = await this.primitives.RSA.importKey('spki', hex2ua(keyHex), ['encrypt'], shaVersion)\n }\n }\n if (!Object.keys(delegateVerifiedKeys).length)\n throw new Error('Illegal state: could not find any verified key for delegate in verified exchange data.')\n return {\n explicitDelegate: delegateId,\n encryptedExchangeDataId: await this.secureDelegationsEncryption.encryptExchangeDataId(exchangeData.id!, delegateVerifiedKeys),\n }\n } else return {}\n }\n\n private makeExchangeDataIdInfoForSelf(\n selfId: string,\n exchangeData: ExchangeData\n ): {\n exchangeDataId?: string\n encryptedExchangeDataId?: { [fp: string]: string }\n explicitDelegator?: string\n explicitDelegate?: string\n } {\n if (this.selfNeedsAnonymousDelegations) {\n return {}\n } else {\n return {\n exchangeDataId: exchangeData.id,\n explicitDelegator: selfId,\n explicitDelegate: selfId,\n }\n }\n }\n\n private async getDataOwnerInfo(dataOwnerId: string) {\n return this.dataOwnerInfoCache.get(dataOwnerId, async () => {\n const dataOwnerWithType = await this.dataOwnerApi.getCryptoActorStub(dataOwnerId)\n return {\n item: {\n requiresAnonymousDelegations: this.cryptoStrategies.dataOwnerRequiresAnonymousDelegation(dataOwnerWithType),\n availablePublicKeysHexWithSha1: Array.from(hexPublicKeysWithSha1Of(dataOwnerWithType.stub)),\n availablePublicKeysHexWithSha256: Array.from(hexPublicKeysWithSha256Of(dataOwnerWithType.stub)),\n },\n }\n })\n }\n\n private getExistingCanonicalKeyAndSecureDelegation(\n entity: EncryptedEntityStub | EncryptedEntity,\n hashes: string[]\n ): { canonicalKey: string; secureDelegation: SecureDelegation } | undefined {\n const securityMetadata = entity.securityMetadata ?? {}\n const canonicalByEquivalences = Array.from(new Set(hashes.flatMap((hash) => securityMetadata.keysEquivalences?.[hash] ?? [])))\n const directRetrievals = hashes.flatMap((hash) => {\n const retrievedMetadata = securityMetadata.secureDelegations?.[hash]\n return retrievedMetadata ? { canonicalKey: hash, secureDelegation: retrievedMetadata } : []\n })\n if (\n directRetrievals.length > 1 ||\n canonicalByEquivalences.length > 1 ||\n (!!canonicalByEquivalences[0] && !!directRetrievals[0]?.canonicalKey && canonicalByEquivalences[0] !== directRetrievals[0]?.canonicalKey)\n )\n throw new Error('Illegal state: multiple secure delegations matching equivalent hashes of entity.')\n const canonicalFromEquivalences = canonicalByEquivalences[0]\n const retrievedFromEquivalences = securityMetadata.secureDelegations?.[canonicalFromEquivalences]\n return (\n directRetrievals[0] ??\n (!!canonicalFromEquivalences && !!retrievedFromEquivalences\n ? { canonicalKey: canonicalFromEquivalences, secureDelegation: retrievedFromEquivalences }\n : undefined)\n )\n }\n}\n"]}
@@ -170,7 +170,8 @@ exports.fingerprintV2 = fingerprintV2;
170
170
  * @return the fingerprint of the key in the v2 format.
171
171
  */
172
172
  function fingerprintV1toV2(fp) {
173
- return fp.slice(0, -10);
173
+ // Conversion resilient to mistakes: if the fingerprint is already in V2 format it will be returned as is.
174
+ return fp.slice(0, 22);
174
175
  }
175
176
  exports.fingerprintV1toV2 = fingerprintV1toV2;
176
177
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wBAAwB;AACxB,sDAAsF;AAEtF,+BAA4C;AAC5C,oCAA+D;AAC/D,yDAAqD;AAKrD,qEAAiE;AACjE,wFAAoF;AAEpF,6EAAyE;AACzE,IAAO,uBAAuB,GAAG,uCAAkB,CAAC,uBAAuB,CAAA;AAE3E;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,SAAoB;;IAC5D,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAA,SAAS,CAAC,2BAA2B,mCAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAa,CAAC,CAAA;AAC7G,CAAC;AAFD,8DAEC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,SAAoB;;IAC1D,OAAO,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,MAAA,SAAS,CAAC,eAAe,mCAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAa,CAAC,CAAA;AACjI,CAAC;AAFD,0DAEC;AAED;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,SAAoB;;IACxD,MAAM,UAAU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;AACH,SAAgB,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAA;AACvB,CAAC;AAFD,sCAEC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;AAC5B,CAAC;AAFD,sCAEC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,EAAU;IAC1C,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;AACzB,CAAC;AAFD,8CAEC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,EAAU;IACxC,OAAO,EAAE,CAAC,MAAM,KAAK,EAAE,CAAA;AACzB,CAAC;AAFD,0CAEC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,EAAU;IACxC,OAAO,EAAE,CAAC,MAAM,KAAK,EAAE,CAAA;AACzB,CAAC;AAFD,0CAEC;AAED;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,EAAU;IAClD,OAAO,EAAE,GAAG,YAAY,CAAA;AAC1B,CAAC;AAFD,8DAEC;AAED;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,eAAuB;IAChE,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,YAAY,EAAE;QAC9C,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAA;KAClF;AACH,CAAC;AAJD,gEAIC","sourcesContent":["// Uses fp as node names\nimport { acyclic, graphFromEdges, StronglyConnectedGraph } from '../utils/graph-utils'\nimport { DataOwner, DataOwnerOrStub, IccDataOwnerXApi } from '../icc-data-owner-x-api'\nimport { RSAUtils, ShaVersion } from './RSA'\nimport { EntityWithDelegationTypeName, hex2ua } from '../utils'\nimport { Patient } from '../../icc-api/model/Patient'\nimport { ExtendedApisUtils } from './ExtendedApisUtils'\nimport { CryptoPrimitives } from './CryptoPrimitives'\nimport { EncryptedEntityWithType } from '../utils/EntityWithDelegationTypeName'\nimport { IccPatientApi } from '../../icc-api'\nimport { ShareMetadataBehaviour } from './ShareMetadataBehaviour'\nimport { EntityShareRequest } from '../../icc-api/model/requests/EntityShareRequest'\nimport { DataOwnerWithType } from '../../icc-api/model/DataOwnerWithType'\nimport { DataOwnerTypeEnum } from '../../icc-api/model/DataOwnerTypeEnum'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\n\n/**\n * Get the public keys of a data owner which should be used for RSA-OAEP with sha256.\n * @param dataOwner\n */\nexport function hexPublicKeysWithSha256Of(dataOwner: DataOwner) {\n return new Set([...(dataOwner.publicKeysForOaepWithSha256 ?? [])].filter((pubKey) => !!pubKey) as string[])\n}\n\n/**\n * Get the public keys of a data owner which should be used for RSA-OAEP with sha1.\n * @param dataOwner\n */\nexport function hexPublicKeysWithSha1Of(dataOwner: DataOwner) {\n return new Set([dataOwner.publicKey, ...Object.keys(dataOwner.aesExchangeKeys ?? {})].filter((pubKey) => !!pubKey) as string[])\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Get the transfer key graph for a data owner. Node names are the public key fingerprints of the data owner's keys, and an edge represents a key\n * which can be retrieved from another key using the transfer keys.\n * @param dataOwner a data owner.\n * @return a graph representing the possible key recovery paths using transfer keys for hte provided data owner.\n */\nexport function transferKeysFpGraphOf(dataOwner: DataOwner): StronglyConnectedGraph {\n const publicKeys = Array.from([...hexPublicKeysWithSha1Of(dataOwner), ...hexPublicKeysWithSha256Of(dataOwner)])\n const edges: [string, string][] = []\n Object.entries(dataOwner.transferKeys ?? {}).forEach(([from, tos]) => {\n Object.keys(tos).forEach((to) => {\n edges.push([fingerprintV1(from), fingerprintV1(to)])\n })\n })\n return acyclic(\n graphFromEdges(\n edges,\n publicKeys.map((x) => fingerprintV1(x))\n )\n )\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Get a map for converting public keys fingerprint to full public keys for the provided data owner.\n * @param dataOwner a data owner.\n * @param shaVersion gets only the keys that are generated with this SHA version (default: 'sha-1').\n * @return a map to convert fingerprints of the data owner into full public keys.\n */\nexport function fingerprintToPublicKeysMapOf(dataOwner: DataOwner, shaVersion: ShaVersion): { [fp: string]: string } {\n const publicKeys = shaVersion === 'sha-1' ? Array.from(hexPublicKeysWithSha1Of(dataOwner)) : Array.from(hexPublicKeysWithSha256Of(dataOwner))\n const res: { [fp: string]: string } = {}\n publicKeys.forEach((pk) => {\n res[fingerprintV1(pk)] = pk\n })\n return res\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Load many public keys in spki format.\n * @param rsa the rsa service\n * @param publicKeysSpkiHex public keys in spki format, hex encoded.\n * @param shaVersion the version of the Sha algorithm used in the keys generations. ()\n * @return public keys as crypto keys by their fingerprint.\n */\nexport async function loadPublicKeys(\n rsa: RSAUtils,\n publicKeysSpkiHex: string[],\n shaVersion: ShaVersion\n): Promise<{ [publicKeyFingerprint: string]: CryptoKey }> {\n return Object.fromEntries(\n await Promise.all(publicKeysSpkiHex.map(async (x) => [fingerprintV1(x), await rsa.importKey('spki', hex2ua(x), ['encrypt'], shaVersion)]))\n )\n}\n\n/**\n * @internal This method is intended only for internal use and may be changed without notice.\n * Creates a delegation for the current data owner if the data owner is an encrypted entity and there is no delegation to himself.\n * @return the updated self.\n */\nexport async function ensureDelegationForSelf(\n dataOwnerApi: IccDataOwnerXApi,\n xapi: ExtendedApisUtils,\n patientApi: IccPatientApi,\n cryptoPrimitives: CryptoPrimitives\n): Promise<DataOwnerWithType> {\n const self = await dataOwnerApi.getCurrentDataOwner()\n if (self.type === 'patient') {\n const patient = new Patient(self.dataOwner)\n const patientWithType: EncryptedEntityWithType = { entity: patient, type: EntityWithDelegationTypeName.Patient }\n const availableSecretIds = await xapi.secretIdsOf(patientWithType, undefined)\n if (availableSecretIds.length) {\n return self\n } else {\n if (xapi.hasEmptyEncryptionMetadata(patient)) {\n // This should not really happen, usually some user will have already initialised the patient and its encryption metadata.\n const updatedPatient = await xapi.entityWithInitialisedEncryptedMetadata(\n patient,\n EntityWithDelegationTypeName.Patient,\n undefined,\n undefined,\n true,\n true,\n {}\n )\n return { dataOwner: await patientApi.modifyPatient(updatedPatient.updatedEntity), type: DataOwnerTypeEnum.Patient }\n } else {\n const updatedPatient = await xapi.simpleShareOrUpdateEncryptedEntityMetadata(\n { entity: patient, type: EntityWithDelegationTypeName.Patient },\n false,\n {\n [patient.id!]: {\n shareEncryptionKeys: ShareMetadataBehaviour.IF_AVAILABLE,\n shareOwningEntityIds: ShareMetadataBehaviour.NEVER,\n shareSecretIds: [cryptoPrimitives.randomUuid()],\n requestedPermissions: RequestedPermissionEnum.FULL_WRITE,\n },\n },\n (x) => patientApi.bulkSharePatients(x)\n )\n return { dataOwner: updatedPatient.updatedEntityOrThrow, type: DataOwnerTypeEnum.Patient }\n }\n }\n } else {\n return self\n }\n}\n\n/**\n * Search a public key in the data owner and returns the corresponding SHA version used to generate it or undefined if not found.\n * @param dataOwner the data owner.\n * @param publicKey the public key.\n * @return 'sha-1', 'sha-256', undefined\n */\nexport function getShaVersionForKey(dataOwner: DataOwnerOrStub, publicKey: string): ShaVersion | undefined {\n return dataOwner.publicKey === publicKey || Object.keys(dataOwner.aesExchangeKeys ?? {}).includes(publicKey)\n ? ShaVersion.Sha1\n : !!dataOwner.publicKeysForOaepWithSha256?.includes(publicKey)\n ? ShaVersion.Sha256\n : undefined\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Calculates the fingerprint from the hexadecimal representation of a SPKI key. The fingerprint is calculated as the last 16 bytes (32 characters)\n * of the SPKI key.\n * @param key the hexadecimal representation of the SPKI key.\n * @return the fingerprint.\n */\nexport function fingerprintV1(key: string): string {\n return key.slice(-32)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Calculates the fingerprint from the hexadecimal representation of a SPKI key. The fingerprint is calculated as the last 16 bytes (32 characters) from which the\n * last 5 (10 characters) are removed because they are a constant of the SPKI format.\n * @param key the hexadecimal representation of the SPKI key.\n * @return the fingerprint.\n */\nexport function fingerprintV2(key: string): string {\n return key.slice(-32, -10)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Converts the fingerprint of a key from a V1 format to a V2 format.\n * @param fp the fingerprint of the key in the V1 format.\n * @return the fingerprint of the key in the v2 format.\n */\nexport function fingerprintV1toV2(fp: string): string {\n return fp.slice(0, -10)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint.\n * @return true if the fingerprint is in V1 format, false otherwise.\n */\nexport function fingerprintIsV1(fp: string): boolean {\n return fp.length === 32\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint.\n * @return true if the fingerprint is in V2 format, false otherwise.\n */\nexport function fingerprintIsV2(fp: string): boolean {\n return fp.length === 22\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint v2.\n * @return the fingerprint v1 using the standard tail.\n */\nexport function fingerprintV2ToStandardV1(fp: string): string {\n return fp + '0203010001'\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param publicKeyOrFpv1 a public key in spki format or a public key fp v1\n * @throws if the input does not terminate with 0203010001\n */\nexport function checkStandardPublicKeyTail(publicKeyOrFpv1: string) {\n if (publicKeyOrFpv1.slice(-10) != '0203010001') {\n throw new Error('Illegal state: generated public key should end with 0203010001')\n }\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wBAAwB;AACxB,sDAAsF;AAEtF,+BAA4C;AAC5C,oCAA+D;AAC/D,yDAAqD;AAKrD,qEAAiE;AACjE,wFAAoF;AAEpF,6EAAyE;AACzE,IAAO,uBAAuB,GAAG,uCAAkB,CAAC,uBAAuB,CAAA;AAE3E;;;GAGG;AACH,SAAgB,yBAAyB,CAAC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AC;AAFD,0CAEC;AAED;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,EAAU;IAClD,OAAO,EAAE,GAAG,YAAY,CAAA;AAC1B,CAAC;AAFD,8DAEC;AAED;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,eAAuB;IAChE,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,YAAY,EAAE;QAC9C,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAA;KAClF;AACH,CAAC;AAJD,gEAIC","sourcesContent":["// Uses fp as node names\nimport { acyclic, graphFromEdges, StronglyConnectedGraph } from '../utils/graph-utils'\nimport { DataOwner, DataOwnerOrStub, IccDataOwnerXApi } from '../icc-data-owner-x-api'\nimport { RSAUtils, ShaVersion } from './RSA'\nimport { EntityWithDelegationTypeName, hex2ua } from '../utils'\nimport { Patient } from '../../icc-api/model/Patient'\nimport { ExtendedApisUtils } from './ExtendedApisUtils'\nimport { CryptoPrimitives } from './CryptoPrimitives'\nimport { EncryptedEntityWithType } from '../utils/EntityWithDelegationTypeName'\nimport { IccPatientApi } from '../../icc-api'\nimport { ShareMetadataBehaviour } from './ShareMetadataBehaviour'\nimport { EntityShareRequest } from '../../icc-api/model/requests/EntityShareRequest'\nimport { DataOwnerWithType } from '../../icc-api/model/DataOwnerWithType'\nimport { DataOwnerTypeEnum } from '../../icc-api/model/DataOwnerTypeEnum'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\n\n/**\n * Get the public keys of a data owner which should be used for RSA-OAEP with sha256.\n * @param dataOwner\n */\nexport function hexPublicKeysWithSha256Of(dataOwner: DataOwner) {\n return new Set([...(dataOwner.publicKeysForOaepWithSha256 ?? [])].filter((pubKey) => !!pubKey) as string[])\n}\n\n/**\n * Get the public keys of a data owner which should be used for RSA-OAEP with sha1.\n * @param dataOwner\n */\nexport function hexPublicKeysWithSha1Of(dataOwner: DataOwner) {\n return new Set([dataOwner.publicKey, ...Object.keys(dataOwner.aesExchangeKeys ?? {})].filter((pubKey) => !!pubKey) as string[])\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Get the transfer key graph for a data owner. Node names are the public key fingerprints of the data owner's keys, and an edge represents a key\n * which can be retrieved from another key using the transfer keys.\n * @param dataOwner a data owner.\n * @return a graph representing the possible key recovery paths using transfer keys for hte provided data owner.\n */\nexport function transferKeysFpGraphOf(dataOwner: DataOwner): StronglyConnectedGraph {\n const publicKeys = Array.from([...hexPublicKeysWithSha1Of(dataOwner), ...hexPublicKeysWithSha256Of(dataOwner)])\n const edges: [string, string][] = []\n Object.entries(dataOwner.transferKeys ?? {}).forEach(([from, tos]) => {\n Object.keys(tos).forEach((to) => {\n edges.push([fingerprintV1(from), fingerprintV1(to)])\n })\n })\n return acyclic(\n graphFromEdges(\n edges,\n publicKeys.map((x) => fingerprintV1(x))\n )\n )\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Get a map for converting public keys fingerprint to full public keys for the provided data owner.\n * @param dataOwner a data owner.\n * @param shaVersion gets only the keys that are generated with this SHA version (default: 'sha-1').\n * @return a map to convert fingerprints of the data owner into full public keys.\n */\nexport function fingerprintToPublicKeysMapOf(dataOwner: DataOwner, shaVersion: ShaVersion): { [fp: string]: string } {\n const publicKeys = shaVersion === 'sha-1' ? Array.from(hexPublicKeysWithSha1Of(dataOwner)) : Array.from(hexPublicKeysWithSha256Of(dataOwner))\n const res: { [fp: string]: string } = {}\n publicKeys.forEach((pk) => {\n res[fingerprintV1(pk)] = pk\n })\n return res\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Load many public keys in spki format.\n * @param rsa the rsa service\n * @param publicKeysSpkiHex public keys in spki format, hex encoded.\n * @param shaVersion the version of the Sha algorithm used in the keys generations. ()\n * @return public keys as crypto keys by their fingerprint.\n */\nexport async function loadPublicKeys(\n rsa: RSAUtils,\n publicKeysSpkiHex: string[],\n shaVersion: ShaVersion\n): Promise<{ [publicKeyFingerprint: string]: CryptoKey }> {\n return Object.fromEntries(\n await Promise.all(publicKeysSpkiHex.map(async (x) => [fingerprintV1(x), await rsa.importKey('spki', hex2ua(x), ['encrypt'], shaVersion)]))\n )\n}\n\n/**\n * @internal This method is intended only for internal use and may be changed without notice.\n * Creates a delegation for the current data owner if the data owner is an encrypted entity and there is no delegation to himself.\n * @return the updated self.\n */\nexport async function ensureDelegationForSelf(\n dataOwnerApi: IccDataOwnerXApi,\n xapi: ExtendedApisUtils,\n patientApi: IccPatientApi,\n cryptoPrimitives: CryptoPrimitives\n): Promise<DataOwnerWithType> {\n const self = await dataOwnerApi.getCurrentDataOwner()\n if (self.type === 'patient') {\n const patient = new Patient(self.dataOwner)\n const patientWithType: EncryptedEntityWithType = { entity: patient, type: EntityWithDelegationTypeName.Patient }\n const availableSecretIds = await xapi.secretIdsOf(patientWithType, undefined)\n if (availableSecretIds.length) {\n return self\n } else {\n if (xapi.hasEmptyEncryptionMetadata(patient)) {\n // This should not really happen, usually some user will have already initialised the patient and its encryption metadata.\n const updatedPatient = await xapi.entityWithInitialisedEncryptedMetadata(\n patient,\n EntityWithDelegationTypeName.Patient,\n undefined,\n undefined,\n true,\n true,\n {}\n )\n return { dataOwner: await patientApi.modifyPatient(updatedPatient.updatedEntity), type: DataOwnerTypeEnum.Patient }\n } else {\n const updatedPatient = await xapi.simpleShareOrUpdateEncryptedEntityMetadata(\n { entity: patient, type: EntityWithDelegationTypeName.Patient },\n false,\n {\n [patient.id!]: {\n shareEncryptionKeys: ShareMetadataBehaviour.IF_AVAILABLE,\n shareOwningEntityIds: ShareMetadataBehaviour.NEVER,\n shareSecretIds: [cryptoPrimitives.randomUuid()],\n requestedPermissions: RequestedPermissionEnum.FULL_WRITE,\n },\n },\n (x) => patientApi.bulkSharePatients(x)\n )\n return { dataOwner: updatedPatient.updatedEntityOrThrow, type: DataOwnerTypeEnum.Patient }\n }\n }\n } else {\n return self\n }\n}\n\n/**\n * Search a public key in the data owner and returns the corresponding SHA version used to generate it or undefined if not found.\n * @param dataOwner the data owner.\n * @param publicKey the public key.\n * @return 'sha-1', 'sha-256', undefined\n */\nexport function getShaVersionForKey(dataOwner: DataOwnerOrStub, publicKey: string): ShaVersion | undefined {\n return dataOwner.publicKey === publicKey || Object.keys(dataOwner.aesExchangeKeys ?? {}).includes(publicKey)\n ? ShaVersion.Sha1\n : !!dataOwner.publicKeysForOaepWithSha256?.includes(publicKey)\n ? ShaVersion.Sha256\n : undefined\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Calculates the fingerprint from the hexadecimal representation of a SPKI key. The fingerprint is calculated as the last 16 bytes (32 characters)\n * of the SPKI key.\n * @param key the hexadecimal representation of the SPKI key.\n * @return the fingerprint.\n */\nexport function fingerprintV1(key: string): string {\n return key.slice(-32)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Calculates the fingerprint from the hexadecimal representation of a SPKI key. The fingerprint is calculated as the last 16 bytes (32 characters) from which the\n * last 5 (10 characters) are removed because they are a constant of the SPKI format.\n * @param key the hexadecimal representation of the SPKI key.\n * @return the fingerprint.\n */\nexport function fingerprintV2(key: string): string {\n return key.slice(-32, -10)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Converts the fingerprint of a key from a V1 format to a V2 format.\n * @param fp the fingerprint of the key in the V1 format.\n * @return the fingerprint of the key in the v2 format.\n */\nexport function fingerprintV1toV2(fp: string): string {\n // Conversion resilient to mistakes: if the fingerprint is already in V2 format it will be returned as is.\n return fp.slice(0, 22)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint.\n * @return true if the fingerprint is in V1 format, false otherwise.\n */\nexport function fingerprintIsV1(fp: string): boolean {\n return fp.length === 32\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint.\n * @return true if the fingerprint is in V2 format, false otherwise.\n */\nexport function fingerprintIsV2(fp: string): boolean {\n return fp.length === 22\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint v2.\n * @return the fingerprint v1 using the standard tail.\n */\nexport function fingerprintV2ToStandardV1(fp: string): string {\n return fp + '0203010001'\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param publicKeyOrFpv1 a public key in spki format or a public key fp v1\n * @throws if the input does not terminate with 0203010001\n */\nexport function checkStandardPublicKeyTail(publicKeyOrFpv1: string) {\n if (publicKeyOrFpv1.slice(-10) != '0203010001') {\n throw new Error('Illegal state: generated public key should end with 0203010001')\n }\n}\n"]}
@@ -2,9 +2,10 @@ import { IccAuthApi, IccHcpartyApi } from '../icc-api';
2
2
  import { HealthcareParty } from '../icc-api/model/HealthcareParty';
3
3
  import * as models from '../icc-api/model/models';
4
4
  import { AuthenticationProvider } from './auth/AuthenticationProvider';
5
- import { AbstractFilter } from "./filters/filters";
6
- import { SubscriptionOptions } from "./utils";
7
- import { Connection } from "../icc-api/model/Connection";
5
+ import { AbstractFilter } from './filters/filters';
6
+ import { SubscriptionOptions } from './utils';
7
+ import { Connection } from '../icc-api/model/Connection';
8
+ import { ListOfIds } from '../icc-api/model/models';
8
9
  export declare class IccHcpartyXApi extends IccHcpartyApi {
9
10
  private readonly authApi;
10
11
  hcPartyKeysCache: {
@@ -27,7 +28,7 @@ export declare class IccHcpartyXApi extends IccHcpartyApi {
27
28
  modifyHealthcareParty(body?: HealthcareParty): Promise<HealthcareParty | any>;
28
29
  getHealthcareParty(healthcarePartyId: string, bypassCache?: boolean): Promise<HealthcareParty | any>;
29
30
  getHealthcarePartyHierarchyIds(healthcarePartyId: string, bypassCache?: boolean): Promise<string[]>;
30
- getHealthcareParties(healthcarePartyIds: string): Promise<Array<HealthcareParty> | any>;
31
+ getHealthcareParties(healthcarePartyIds: ListOfIds): Promise<Array<HealthcareParty> | any>;
31
32
  getCurrentHealthcareParty(): Promise<HealthcareParty>;
32
33
  getHcPartyKeysForDelegate(healthcarePartyId: string, bypassCache?: boolean): Promise<{
33
34
  [key: string]: string;
@@ -16,6 +16,7 @@ const person_util_1 = require("./utils/person-util");
16
16
  const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
17
17
  const utils_1 = require("./utils");
18
18
  const Connection_1 = require("../icc-api/model/Connection");
19
+ const models_1 = require("../icc-api/model/models");
19
20
  // noinspection JSUnusedGlobalSymbols
20
21
  class IccHcpartyXApi extends icc_api_1.IccHcpartyApi {
21
22
  constructor(host, headers, authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), authApi, fetchImpl = typeof window !== 'undefined'
@@ -91,13 +92,16 @@ class IccHcpartyXApi extends icc_api_1.IccHcpartyApi {
91
92
  }));
92
93
  }
93
94
  getHealthcareParties(healthcarePartyIds) {
94
- const ids = healthcarePartyIds.split(',').filter((x) => !!x);
95
+ const ids = healthcarePartyIds.ids;
96
+ if (!ids || !ids.length) {
97
+ return Promise.resolve([]);
98
+ }
95
99
  const cached = ids.map((id) => [id, this.getHcPartyFromCache(id)]);
96
100
  const toFetch = cached.filter((x) => !x[1]).map((x) => x[0]);
97
101
  if (!toFetch.length) {
98
102
  return Promise.all(cached.map((x) => x[1]));
99
103
  }
100
- const prom = super.getHealthcareParties(toFetch.join(','));
104
+ const prom = super.getHealthcareParties(new models_1.ListOfIds({ ids: toFetch }));
101
105
  return Promise.all(cached.map((x) => x[1] ||
102
106
  this.putHcPartyInCache(x[0], prom.then((hcps) => hcps.find((h) => h.id === x[0])))));
103
107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"icc-hcparty-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-hcparty-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAoD;AAEpD,kDAAiD;AACjD,qDAA8E;AAC9E,0EAAgG;AAEhG,mCAAqE;AACrE,4DAAuE;AAEvE,qCAAqC;AACrC,MAAa,cAAe,SAAQ,uBAAa;IAK/C,YACE,IAAY,EACZ,OAAkC,EAClC,yBAAiD,IAAI,iDAAwB,EAAE,EAC9D,OAAmB,EACpC,YAA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AA;QAEvC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAChF,CAAC;IAEK,gCAAgC,CACpC,UAA8C,EAC9C,MAAmD,EACnD,UAA0D,EAC1D,UAA+B,EAAE;;YAEjC,OAAO,IAAA,+BAAuB,EAC5B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,iBAAiB,EACjB,UAAU,EACV,MAAM,EACN,UAAU,EACV,OAAO,CACR,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,2BAAc,CAAC,EAAE,CAAC,CAAC,CAAA;QACxC,CAAC;KAAA;CACF;AAhKD,wCAgKC","sourcesContent":["import {IccAuthApi, IccHcpartyApi} from '../icc-api'\nimport { HealthcareParty } from '../icc-api/model/HealthcareParty'\nimport * as models from '../icc-api/model/models'\nimport { findName, garnishPersonWithName, hasName } from './utils/person-util'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport {AbstractFilter} from \"./filters/filters\";\nimport {subscribeToEntityEvents, SubscriptionOptions} from \"./utils\";\nimport {Connection, ConnectionImpl} from \"../icc-api/model/Connection\";\n\n// noinspection JSUnusedGlobalSymbols\nexport class IccHcpartyXApi extends IccHcpartyApi {\n hcPartyKeysCache: { [key: string]: { [key: string]: string } } = {}\n hcPartyCache: { [key: string]: [number, Promise<HealthcareParty>] } = {}\n\n private CACHE_RETENTION_IN_MS = 300_000\n constructor(\n host: string,\n headers: { [key: string]: string },\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n private readonly authApi: IccAuthApi,\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n }\n\n private getHcPartyFromCache(key: string) {\n const hcpInCache = this.hcPartyCache[key]\n const now = Date.now()\n if (hcpInCache && hcpInCache[0] > now) {\n return hcpInCache[1]\n }\n if (!hcpInCache) {\n console.log(`Cache miss for key ${key} because not in cache`)\n } else {\n console.log(`Cache miss for key ${key} because ${hcpInCache[0]} > ${now}`)\n }\n return null\n }\n\n completeNames(hcParty?: models.HealthcareParty): models.HealthcareParty | undefined {\n if (!hcParty) {\n return hcParty\n }\n\n let finalHcParty = hcParty\n\n if ((!!finalHcParty.lastName || !!finalHcParty.name) && !hasName(finalHcParty, models.PersonName.UseEnum.Official)) {\n finalHcParty = garnishPersonWithName(\n finalHcParty,\n models.PersonName.UseEnum.Official,\n finalHcParty.lastName,\n finalHcParty.firstName,\n finalHcParty.name\n )\n }\n\n if ((!finalHcParty.lastName || !finalHcParty.name) && !!hasName(finalHcParty, models.PersonName.UseEnum.Official)) {\n let officialName = findName(finalHcParty, models.PersonName.UseEnum.Official)\n finalHcParty = {\n ...finalHcParty,\n lastName: officialName!.lastName,\n firstName: officialName!.firstNames ? officialName!.firstNames[0] : undefined,\n name: officialName!.text,\n }\n }\n\n return finalHcParty\n }\n\n putHcPartyInCache(key: string, value: Promise<HealthcareParty> | null = null): Promise<HealthcareParty> {\n const hcp =\n value ||\n super.getHealthcareParty(key).catch((e) => {\n console.log(`Evict key ${key} because of error`)\n delete this.hcPartyCache[key]\n throw e\n })\n this.hcPartyCache[key] = [Date.now() + this.CACHE_RETENTION_IN_MS, hcp]\n return hcp\n }\n\n createHealthcareParty(body?: HealthcareParty): Promise<HealthcareParty> {\n return super.createHealthcareParty(this.completeNames(body))\n }\n\n createHealthcarePartyInGroup(groupId: string, body?: HealthcareParty): Promise<HealthcareParty> {\n return super.createHealthcarePartyInGroup(groupId, this.completeNames(body))\n }\n\n modifyHealthcareParty(body?: HealthcareParty): Promise<HealthcareParty | any> {\n if (body && body.id) {\n console.log(`Evict key ${body.id} because of modification`)\n delete this.hcPartyCache[body.id]\n }\n\n return super.modifyHealthcareParty(this.completeNames(body)).then((hcp) => this.putHcPartyInCache(hcp.id!, Promise.resolve(hcp)))\n }\n\n getHealthcareParty(healthcarePartyId: string, bypassCache = false): Promise<HealthcareParty | any> {\n const fromCache = bypassCache ? undefined : this.getHcPartyFromCache(healthcarePartyId)\n return fromCache || this.putHcPartyInCache(healthcarePartyId)\n }\n\n getHealthcarePartyHierarchyIds(healthcarePartyId: string, bypassCache = false): Promise<string[]> {\n const fromCache = bypassCache ? undefined : this.getHcPartyFromCache(healthcarePartyId)\n return (fromCache || this.putHcPartyInCache(healthcarePartyId)).then(async (hcp: HealthcareParty) => {\n return hcp ? (hcp.parentId ? (await this.getHealthcarePartyHierarchyIds(hcp.parentId!, bypassCache)).concat([hcp.id!]) : [hcp.id!]) : []\n })\n }\n\n getHealthcareParties(healthcarePartyIds: string): Promise<Array<HealthcareParty> | any> {\n const ids = healthcarePartyIds.split(',').filter((x) => !!x)\n const cached: Array<[string, Promise<HealthcareParty> | null]> = ids.map((id) => [id, this.getHcPartyFromCache(id)])\n const toFetch = cached.filter((x) => !x[1]).map((x) => x[0])\n\n if (!toFetch.length) {\n return Promise.all(cached.map((x) => x[1]!))\n }\n\n const prom: Promise<HealthcareParty[]> = super.getHealthcareParties(toFetch.join(','))\n return Promise.all(\n cached.map(\n (x) =>\n x[1] ||\n this.putHcPartyInCache(\n x[0],\n prom.then((hcps) => hcps.find((h) => h.id === x[0])!)\n )\n )\n )\n }\n\n getCurrentHealthcareParty(): Promise<HealthcareParty> {\n return super.getCurrentHealthcareParty().then((hcp) => this.putHcPartyInCache(hcp.id!, Promise.resolve(hcp)))\n }\n\n getHcPartyKeysForDelegate(healthcarePartyId: string, bypassCache = false): Promise<{ [key: string]: string }> {\n const cached = bypassCache ? null : this.hcPartyKeysCache[healthcarePartyId]\n return cached\n ? Promise.resolve(cached)\n : super.getHcPartyKeysForDelegate(healthcarePartyId).then((r) => (this.hcPartyKeysCache[healthcarePartyId] = r))\n }\n\n isValidCbe(cbe: string) {\n cbe = cbe.replace(new RegExp('[^(0-9)]', 'g'), '')\n cbe = cbe.length == 9 ? '0' + cbe : cbe\n\n return 97 - (Number(cbe.substring(0, 8)) % 97) === Number(cbe.substring(8, 2))\n }\n\n async subscribeToHealthcarePartyEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<HealthcareParty> | undefined,\n eventFired: (dataSample: HealthcareParty) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n 'HealthcareParty',\n eventTypes,\n filter,\n eventFired,\n options,\n ).then((rs) => new ConnectionImpl(rs))\n }\n}\n"]}
1
+ {"version":3,"file":"icc-hcparty-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-hcparty-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsD;AAEtD,kDAAiD;AACjD,qDAA8E;AAC9E,0EAAgG;AAEhG,mCAAsE;AACtE,4DAAwE;AACxE,oDAAmD;AAEnD,qCAAqC;AACrC,MAAa,cAAe,SAAQ,uBAAa;IAK/C,YACE,IAAY,EACZ,OAAkC,EAClC,yBAAiD,IAAI,iDAAwB,EAAE,EAC9D,OAAmB,EACpC,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,KAAK;QAET,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;QAPtC,YAAO,GAAP,OAAO,CAAY;QARtC,qBAAgB,GAAiD,EAAE,CAAA;QACnE,iBAAY,GAA0D,EAAE,CAAA;QAEhE,0BAAqB,GAAG,MAAO,CAAA;IAavC,CAAC;IAEO,mBAAmB,CA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AC,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CACtH,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,2BAAc,CAAC,EAAE,CAAC,CAC/B,CAAA;QACH,CAAC;KAAA;CACF;AA7JD,wCA6JC","sourcesContent":["import { IccAuthApi, IccHcpartyApi } from '../icc-api'\nimport { HealthcareParty } from '../icc-api/model/HealthcareParty'\nimport * as models from '../icc-api/model/models'\nimport { findName, garnishPersonWithName, hasName } from './utils/person-util'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { AbstractFilter } from './filters/filters'\nimport { subscribeToEntityEvents, SubscriptionOptions } from './utils'\nimport { Connection, ConnectionImpl } from '../icc-api/model/Connection'\nimport { ListOfIds } from '../icc-api/model/models'\n\n// noinspection JSUnusedGlobalSymbols\nexport class IccHcpartyXApi extends IccHcpartyApi {\n hcPartyKeysCache: { [key: string]: { [key: string]: string } } = {}\n hcPartyCache: { [key: string]: [number, Promise<HealthcareParty>] } = {}\n\n private CACHE_RETENTION_IN_MS = 300_000\n constructor(\n host: string,\n headers: { [key: string]: string },\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n private readonly authApi: IccAuthApi,\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n }\n\n private getHcPartyFromCache(key: string) {\n const hcpInCache = this.hcPartyCache[key]\n const now = Date.now()\n if (hcpInCache && hcpInCache[0] > now) {\n return hcpInCache[1]\n }\n if (!hcpInCache) {\n console.log(`Cache miss for key ${key} because not in cache`)\n } else {\n console.log(`Cache miss for key ${key} because ${hcpInCache[0]} > ${now}`)\n }\n return null\n }\n\n completeNames(hcParty?: models.HealthcareParty): models.HealthcareParty | undefined {\n if (!hcParty) {\n return hcParty\n }\n\n let finalHcParty = hcParty\n\n if ((!!finalHcParty.lastName || !!finalHcParty.name) && !hasName(finalHcParty, models.PersonName.UseEnum.Official)) {\n finalHcParty = garnishPersonWithName(\n finalHcParty,\n models.PersonName.UseEnum.Official,\n finalHcParty.lastName,\n finalHcParty.firstName,\n finalHcParty.name\n )\n }\n\n if ((!finalHcParty.lastName || !finalHcParty.name) && !!hasName(finalHcParty, models.PersonName.UseEnum.Official)) {\n let officialName = findName(finalHcParty, models.PersonName.UseEnum.Official)\n finalHcParty = {\n ...finalHcParty,\n lastName: officialName!.lastName,\n firstName: officialName!.firstNames ? officialName!.firstNames[0] : undefined,\n name: officialName!.text,\n }\n }\n\n return finalHcParty\n }\n\n putHcPartyInCache(key: string, value: Promise<HealthcareParty> | null = null): Promise<HealthcareParty> {\n const hcp =\n value ||\n super.getHealthcareParty(key).catch((e) => {\n console.log(`Evict key ${key} because of error`)\n delete this.hcPartyCache[key]\n throw e\n })\n this.hcPartyCache[key] = [Date.now() + this.CACHE_RETENTION_IN_MS, hcp]\n return hcp\n }\n\n createHealthcareParty(body?: HealthcareParty): Promise<HealthcareParty> {\n return super.createHealthcareParty(this.completeNames(body))\n }\n\n createHealthcarePartyInGroup(groupId: string, body?: HealthcareParty): Promise<HealthcareParty> {\n return super.createHealthcarePartyInGroup(groupId, this.completeNames(body))\n }\n\n modifyHealthcareParty(body?: HealthcareParty): Promise<HealthcareParty | any> {\n if (body && body.id) {\n console.log(`Evict key ${body.id} because of modification`)\n delete this.hcPartyCache[body.id]\n }\n\n return super.modifyHealthcareParty(this.completeNames(body)).then((hcp) => this.putHcPartyInCache(hcp.id!, Promise.resolve(hcp)))\n }\n\n getHealthcareParty(healthcarePartyId: string, bypassCache = false): Promise<HealthcareParty | any> {\n const fromCache = bypassCache ? undefined : this.getHcPartyFromCache(healthcarePartyId)\n return fromCache || this.putHcPartyInCache(healthcarePartyId)\n }\n\n getHealthcarePartyHierarchyIds(healthcarePartyId: string, bypassCache = false): Promise<string[]> {\n const fromCache = bypassCache ? undefined : this.getHcPartyFromCache(healthcarePartyId)\n return (fromCache || this.putHcPartyInCache(healthcarePartyId)).then(async (hcp: HealthcareParty) => {\n return hcp ? (hcp.parentId ? (await this.getHealthcarePartyHierarchyIds(hcp.parentId!, bypassCache)).concat([hcp.id!]) : [hcp.id!]) : []\n })\n }\n\n getHealthcareParties(healthcarePartyIds: ListOfIds): Promise<Array<HealthcareParty> | any> {\n const ids = healthcarePartyIds.ids\n if (!ids || !ids.length) {\n return Promise.resolve([])\n }\n const cached: Array<[string, Promise<HealthcareParty> | null]> = ids.map((id) => [id, this.getHcPartyFromCache(id)])\n const toFetch = cached.filter((x) => !x[1]).map((x) => x[0])\n\n if (!toFetch.length) {\n return Promise.all(cached.map((x) => x[1]!))\n }\n\n const prom: Promise<HealthcareParty[]> = super.getHealthcareParties(new ListOfIds({ ids: toFetch }))\n return Promise.all(\n cached.map(\n (x) =>\n x[1] ||\n this.putHcPartyInCache(\n x[0],\n prom.then((hcps) => hcps.find((h) => h.id === x[0])!)\n )\n )\n )\n }\n\n getCurrentHealthcareParty(): Promise<HealthcareParty> {\n return super.getCurrentHealthcareParty().then((hcp) => this.putHcPartyInCache(hcp.id!, Promise.resolve(hcp)))\n }\n\n getHcPartyKeysForDelegate(healthcarePartyId: string, bypassCache = false): Promise<{ [key: string]: string }> {\n const cached = bypassCache ? null : this.hcPartyKeysCache[healthcarePartyId]\n return cached\n ? Promise.resolve(cached)\n : super.getHcPartyKeysForDelegate(healthcarePartyId).then((r) => (this.hcPartyKeysCache[healthcarePartyId] = r))\n }\n\n isValidCbe(cbe: string) {\n cbe = cbe.replace(new RegExp('[^(0-9)]', 'g'), '')\n cbe = cbe.length == 9 ? '0' + cbe : cbe\n\n return 97 - (Number(cbe.substring(0, 8)) % 97) === Number(cbe.substring(8, 2))\n }\n\n async subscribeToHealthcarePartyEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<HealthcareParty> | undefined,\n eventFired: (dataSample: HealthcareParty) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n return subscribeToEntityEvents(this.host, this.authApi, 'HealthcareParty', eventTypes, filter, eventFired, options).then(\n (rs) => new ConnectionImpl(rs)\n )\n }\n}\n"]}
@@ -171,9 +171,6 @@ var IcureApi;
171
171
  const grouplessUserApi = new icc_api_1.IccUserApi(host, params.headers, grouplessAuthenticationProvider, fetchImpl);
172
172
  const matches = yield getMatchesOrEmpty(grouplessUserApi);
173
173
  const chosenGroupId = matches.length > 1 && !!options.groupSelector ? yield options.groupSelector(matches) : (_a = matches[0]) === null || _a === void 0 ? void 0 : _a.groupId;
174
- const groupSpecificAuthenticationProviderInfo = matches.length > 1 && chosenGroupId
175
- ? yield grouplessAuthenticationProvider.switchGroup(chosenGroupId, matches)
176
- : { switchedProvider: grouplessAuthenticationProvider, isGroupLocked: false };
177
174
  /*TODO
178
175
  * On new very new users switching the authentication provider to a specific group may fail and block the user for too many requests. This is
179
176
  * probably linked to replication of the user in the fallback database.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../icc-x-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCA8BmB;AACnB,qDAA8C;AAC9C,yDAAkD;AAClD,2DAAoD;AACpD,2DAAoD;AACpD,6DAAsD;AACtD,2DAAoD;AACpD,qDAA8C;AAC9C,6DAAsD;AACtD,yEAAkE;AAClE,uEAA+D;AAC/D,2DAAoD;AACpD,2DAAoD;AACpD,2DAAoD;AACpD,+DAAwD;AACxD,iEAAyD;AACzD,qDAA8C;AAC9C,6EAAqE;AACrE,iEAAyD;AAGzD,iEAA6D;AAC7D,6DAAyD;AACzD,0EAMsC;AACtC,gEAA4D;AAC5D,kFAA8E;AAC9E,qEAAiE;AACjE,6FAAyF;AACzF,sDAAkD;AAClD,8EAA0E;AAG1E,sEAAkE;AAClE,kEAA8D;AAC9D,sEAAkE;AAClE,+EAA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I,EAAE,EAAE,sBAAsB,CAAC,CAAA;QACrF,MAAM,YAAY,GAAG,IAAI,yBAAe,CAAC,IAAI,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;QACxG,MAAM,kBAAkB,GAAG,IAAI,kCAAc,CAAC,IAAI,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;QAEtH,OAAO;YACL,OAAO;YACP,SAAS;YACT,OAAO;YACP,OAAO;YACP,aAAa;YACb,YAAY;YACZ,kBAAkB;YAClB,SAAS;YACT,QAAQ;YACR,kBAAkB;SACnB,CAAA;;CACF,CAAA;AApCY,QAAA,SAAS,aAoCrB;AAED,SAAe,iBAAiB,CAAC,OAAmB;;QAClD,IAAI;YACF,OAAO,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAA;SACxC;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,YAAY,KAAK,IAAI,YAAY,IAAI,GAAG,IAAK,GAAW,CAAC,UAAU,KAAK,GAAG;gBAAE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;;gBACzG,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SAChC;IACH,CAAC;CAAA","sourcesContent":["import {\n IccAgendaApi,\n IccAnonymousAccessApi,\n IccApplicationsettingsApi,\n IccArticleApi,\n IccAuthApi,\n IccBeefactApi,\n IccBeresultexportApi,\n IccBeresultimportApi,\n IccBesamv2Api,\n IccCalendarItemTypeApi,\n IccClassificationTemplateApi,\n IccEntityrefApi,\n IccEntitytemplateApi,\n IccFrontendmigrationApi,\n IccGroupApi,\n IccIcureApi,\n IccInsuranceApi,\n IccKeywordApi,\n IccMedexApi,\n IccMedicallocationApi,\n IccPatientApi,\n IccPermissionApi,\n IccPlaceApi,\n IccPubsubApi,\n IccReplicationApi,\n IccTarificationApi,\n IccTmpApi,\n IccUserApi,\n OAuthThirdParty,\n} from '../icc-api'\nimport { IccUserXApi } from './icc-user-x-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccContactXApi } from './icc-contact-x-api'\nimport { IccInvoiceXApi } from './icc-invoice-x-api'\nimport { IccDocumentXApi } from './icc-document-x-api'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { IccFormXApi } from './icc-form-x-api'\nimport { IccHelementXApi } from './icc-helement-x-api'\nimport { IccClassificationXApi } from './icc-classification-x-api'\nimport { IccCalendarItemXApi } from './icc-calendar-item-x-api'\nimport { IccPatientXApi } from './icc-patient-x-api'\nimport { IccMessageXApi } from './icc-message-x-api'\nimport { IccReceiptXApi } from './icc-receipt-x-api'\nimport { IccAccesslogXApi } from './icc-accesslog-x-api'\nimport { IccTimeTableXApi } from './icc-time-table-x-api'\nimport { IccCodeXApi } from './icc-code-x-api'\nimport { IccMaintenanceTaskXApi } from './icc-maintenance-task-x-api'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { StorageFacade } from './storage/StorageFacade'\nimport { KeyStorageFacade } from './storage/KeyStorageFacade'\nimport { LocalStorageImpl } from './storage/LocalStorageImpl'\nimport { KeyStorageImpl } from './storage/KeyStorageImpl'\nimport {\n AuthenticationProvider,\n BasicAuthenticationProvider,\n EnsembleAuthenticationProvider,\n JwtAuthenticationProvider,\n NoAuthenticationProvider,\n} from './auth/AuthenticationProvider'\nimport { CryptoPrimitives } from './crypto/CryptoPrimitives'\nimport { UserEncryptionKeysManager } from './crypto/UserEncryptionKeysManager'\nimport { IcureStorageFacade } from './storage/IcureStorageFacade'\nimport { DefaultStorageEntryKeysFactory } from './storage/DefaultStorageEntryKeysFactory'\nimport { KeyRecovery } from './crypto/KeyRecovery'\nimport { BaseExchangeKeysManager } from './crypto/BaseExchangeKeysManager'\nimport { StorageEntryKeysFactory } from './storage/StorageEntryKeysFactory'\nimport { CryptoStrategies } from './crypto/CryptoStrategies'\nimport { ExchangeKeysManager } from './crypto/ExchangeKeysManager'\nimport { ShamirKeysManager } from './crypto/ShamirKeysManager'\nimport { TransferKeysManager } from './crypto/TransferKeysManager'\nimport { IccIcureMaintenanceXApi } from './icc-icure-maintenance-x-api'\nimport { ConfidentialEntities } from './crypto/ConfidentialEntities'\nimport { ensureDelegationForSelf } from './crypto/utils'\nimport { SecureDelegationsSecurityMetadataDecryptor } from './crypto/SecureDelegationsSecurityMetadataDecryptor'\nimport { initialiseExchangeDataManagerForCurrentDataOwner } from './crypto/ExchangeDataManager'\nimport { BaseExchangeDataManager } from './crypto/BaseExchangeDataManager'\nimport { IccExchangeDataApi } from '../icc-api/api/internal/IccExchangeDataApi'\nimport { UserSignatureKeysManager } from './crypto/UserSignatureKeysManager'\nimport { AccessControlSecretUtils } from './crypto/AccessControlSecretUtils'\nimport { SecureDelegationsEncryption } from './crypto/SecureDelegationsEncryption'\nimport { LegacyDelegationSecurityMetadataDecryptor } from './crypto/LegacyDelegationSecurityMetadataDecryptor'\nimport { ExtendedApisUtilsImpl } from './crypto/ExtendedApisUtilsImpl'\nimport { SecureDelegationsManager } from './crypto/SecureDelegationsManager'\nimport { AccessControlKeysHeadersProvider } from './crypto/AccessControlKeysHeadersProvider'\nimport { IccExchangeDataMapApi } from '../icc-api/api/internal/IccExchangeDataMapApi'\nimport { ExchangeDataMapManager } from './crypto/ExchangeDataMapManager'\nimport { IccDeviceXApi } from './icc-device-x-api'\nimport { IccBekmehrXApi } from './icc-bekmehr-x-api'\nimport { IccDoctemplateXApi } from './icc-doctemplate-x-api'\nimport { UserGroup } from '../icc-api/model/UserGroup'\nimport { IccTopicXApi } from './icc-topic-x-api'\nimport { IccRoleApi } from '../icc-api/api/IccRoleApi'\nimport { DataOwnerTypeEnum } from '../icc-api/model/DataOwnerTypeEnum'\nimport { DelegationsDeAnonymization } from './crypto/DelegationsDeAnonymization'\nimport { JwtBridgedAuthService } from './auth/JwtBridgedAuthService'\nimport { AuthSecretProvider, SmartAuthProvider } from './auth/SmartAuthProvider'\nimport { KeyPairRecoverer } from './crypto/KeyPairRecoverer'\nimport { IccRecoveryDataApi } from '../icc-api/api/internal/IccRecoveryDataApi'\nimport { RecoveryDataEncryption } from './crypto/RecoveryDataEncryption'\nimport { IccRecoveryXApi } from './icc-recovery-x-api'\n\nexport * from './icc-accesslog-x-api'\nexport * from './icc-bekmehr-x-api'\nexport * from './icc-calendar-item-x-api'\nexport * from './icc-classification-x-api'\nexport * from './icc-code-x-api'\nexport * from './icc-contact-x-api'\nexport * from './icc-crypto-x-api'\nexport * from './icc-doctemplate-x-api'\nexport * from './icc-document-x-api'\nexport * from './icc-form-x-api'\nexport * from './icc-hcparty-x-api'\nexport * from './icc-helement-x-api'\nexport * from './icc-invoice-x-api'\nexport * from './icc-message-x-api'\nexport * from './icc-patient-x-api'\nexport * from './icc-user-x-api'\nexport * from './icc-time-table-x-api'\nexport * from './icc-receipt-x-api'\nexport * from './icc-data-owner-x-api'\nexport * from './icc-icure-maintenance-x-api'\nexport * from './icc-maintenance-task-x-api'\nexport * from './utils'\n\nexport * from './crypto/RSA'\nexport * from './crypto/CryptoPrimitives'\nexport * from './crypto/ShareMetadataBehaviour'\nexport * from './auth/AuthenticationProvider'\n\nexport { KeyStorageFacade } from './storage/KeyStorageFacade'\nexport { LocalStorageImpl } from './storage/LocalStorageImpl'\nexport { StorageFacade } from './storage/StorageFacade'\nexport { KeyStorageImpl } from './storage/KeyStorageImpl'\nexport { CryptoStrategies } from './crypto/CryptoStrategies'\nexport { getShaVersionForKey } from './crypto/utils'\n\nexport interface BasicApis {\n readonly authApi: IccAuthApi\n readonly codeApi: IccCodeXApi\n readonly userApi: IccUserXApi\n readonly permissionApi: IccPermissionApi\n readonly insuranceApi: IccInsuranceApi\n readonly entityReferenceApi: IccEntityrefApi\n readonly agendaApi: IccAgendaApi\n readonly groupApi: IccGroupApi\n readonly healthcarePartyApi: IccHcpartyXApi\n readonly deviceApi: IccDeviceXApi\n}\nexport interface Apis extends BasicApis {\n readonly calendarItemTypeApi: IccCalendarItemTypeApi\n readonly medicalLocationApi: IccMedicallocationApi\n readonly cryptoApi: IccCryptoXApi\n readonly accessLogApi: IccAccesslogXApi\n readonly contactApi: IccContactXApi\n readonly formApi: IccFormXApi\n readonly invoiceApi: IccInvoiceXApi\n readonly documentApi: IccDocumentXApi\n readonly healthcareElementApi: IccHelementXApi\n readonly classificationApi: IccClassificationXApi\n readonly calendarItemApi: IccCalendarItemXApi\n readonly receiptApi: IccReceiptXApi\n readonly timetableApi: IccTimeTableXApi\n readonly patientApi: IccPatientXApi\n readonly messageApi: IccMessageXApi\n readonly maintenanceTaskApi: IccMaintenanceTaskXApi\n readonly dataOwnerApi: IccDataOwnerXApi\n readonly icureMaintenanceTaskApi: IccIcureMaintenanceXApi\n readonly anonymousAccessApi: IccAnonymousAccessApi\n readonly applicationSettingsApi: IccApplicationsettingsApi\n readonly articleApi: IccArticleApi\n readonly bekmehrApi: IccBekmehrXApi\n readonly beefactApi: IccBeefactApi\n readonly beresultexportApi: IccBeresultexportApi\n readonly beresultimportApi: IccBeresultimportApi\n readonly besamv2Api: IccBesamv2Api\n readonly classificationTemplateApi: IccClassificationTemplateApi\n readonly doctemplateApi: IccDoctemplateXApi\n readonly entitytemplateApi: IccEntitytemplateApi\n readonly frontendmigrationApi: IccFrontendmigrationApi\n readonly icureApi: IccIcureApi\n readonly keywordApi: IccKeywordApi\n readonly medexApi: IccMedexApi\n readonly placeApi: IccPlaceApi\n readonly pubsubApi: IccPubsubApi\n readonly replicationApi: IccReplicationApi\n readonly tarificationApi: IccTarificationApi\n readonly tmpApi: IccTmpApi\n readonly topicApi: IccTopicXApi\n readonly roleApi: IccRoleApi\n readonly recoveryApi: IccRecoveryXApi\n}\n\n/**\n * Allows to customise the behaviour of the iCure API by providing various optional parameters.\n */\nexport interface IcureApiOptions {\n /**\n * Specifies how iCure can store string values (e.g. json). In production this should be persistent storage.\n * @default the browser's localStorage.\n */\n readonly storage?: StorageFacade<string>\n /**\n * Specifies how iCure can store cryptographic keys. Preferably this should be some ad-hoc storage key storage.\n * @default stores the json of the jwk representation of the key in {@link storage}.\n */\n readonly keyStorage?: KeyStorageFacade\n /**\n * Specifies where iCure should store his data within the {@link storage} and {@link keyStorage}.\n * @default {@link DefaultStorageEntryKeysFactory}\n */\n readonly entryKeysFactory?: StorageEntryKeysFactory\n /**\n * Specifies if iCure should automatically create maintenance tasks for requesting access back when a new key is generated at initialisation time.\n * Note that the maintenance task will be created only towards HCP data owners: if you want to create a maintenance task also to other types of data\n * owners you should disable this and call {@link IccIcureMaintenanceXApi.createMaintenanceTasksForNewKeypair} yourself.\n * @default true\n */\n readonly createMaintenanceTasksOnNewKey?: boolean\n /**\n * Additional headers to use on each request made by the iCure api.\n * @default no additional headers\n */\n readonly headers?: { [headerName: string]: string }\n /**\n * Specifies which fields should be encrypted for each kind of encryptable entity. You should make sure that every application in your environment\n * specifies the same values for this configuration.\n * @default see documentation for {@link EncryptedFieldsConfig}\n */\n readonly encryptedFieldsConfig?: EncryptedFieldsConfig\n /**\n * Each user may exist in multiple groups, but an instance of {@link IcureApi} is specialised for a single group. This function allows you to decide\n * the group to use for a given user. This functions will be called only if a user exists in at least 2 groups, takes in input the information on\n * the groups the user can access (in no specific order) and must return the id of one of these groups.\n * @default takes the first group provided. The group chosen by this method may vary between different instantiations of the {@link IcureApi} even\n * if for the same user and if the groups available for the user do not change.\n */\n readonly groupSelector?: (availableGroupsInfo: UserGroup[]) => Promise<string>\n /**\n * Temporary value to support EHR Lite and MedTech api implementations.\n *\n * Currently, all hcps are able to access encrypted data shared with any of their parents, and on initialisation the api will verify that there is a\n * key pair available for the current user and for every parent of the user. If this option is set to true, the api will not load keys for the\n * parent users.\n *\n * This \"implicit data-sharing scheme\" (each parent HCP is essentially sharing data with all its children HCPs), however, may not be ideal for all\n * use cases, and it will be changed in future to be configurable in order to make it more general.\n * @default false, equivalent to previous behaviour.\n */\n readonly disableParentKeysInitialisation?: boolean\n}\n\nnamespace IcureApiOptions {\n export namespace Defaults {\n export const entryKeysFactory = new DefaultStorageEntryKeysFactory()\n export const createMaintenanceTasksOnNewKey = true\n export const headers = {}\n }\n\n export class WithDefaults implements IcureApiOptions {\n readonly entryKeysFactory: StorageEntryKeysFactory\n readonly createMaintenanceTasksOnNewKey: boolean\n readonly storage: StorageFacade<string>\n readonly keyStorage: KeyStorageFacade\n readonly headers: { [headerName: string]: string }\n readonly encryptedFieldsConfig: EncryptedFieldsConfig\n readonly groupSelector: (availableGroupsInfo: UserGroup[]) => Promise<string>\n readonly disableParentKeysInitialisation: boolean\n\n constructor(custom: IcureApiOptions) {\n this.entryKeysFactory = custom.entryKeysFactory ?? Defaults.entryKeysFactory\n this.createMaintenanceTasksOnNewKey = custom.createMaintenanceTasksOnNewKey ?? Defaults.createMaintenanceTasksOnNewKey\n this.storage = custom.storage ?? new LocalStorageImpl()\n this.keyStorage = custom.keyStorage ?? new KeyStorageImpl(this.storage)\n this.headers = custom.headers ?? Defaults.headers\n this.encryptedFieldsConfig = custom.encryptedFieldsConfig ?? {}\n this.groupSelector = custom.groupSelector ?? ((groups) => Promise.resolve(groups[0].groupId!))\n this.disableParentKeysInitialisation = custom.disableParentKeysInitialisation ?? false\n }\n }\n}\n\n/**\n * Specifies which fields should be encrypted for each kind of encryptable entity.\n *\n * Note that any value you specify here overrides the default values. For example if you specify `['medicalLocationId']` for `healthElement` the\n * fields `['descr', 'note']` which are usually encrypted by default will no longer be encrypted. If you want to add fields to the default values\n * you can use {@link EncryptedFieldsConfig.Defaults}, for example `[...EncryptedFieldsConfig.Defaults.healthElement, 'medicalLocationId'].\n *\n * # Encrypted fields syntax\n *\n * ## Grammar\n *\n * The grammar for each encrypted field is the following:\n * ```\n * fieldName :=\n * regex([a-zA-Z_][a-zA-Z0-9_]+)\n * encryptedField :=\n * fieldName\n * | fieldName + (\".\" | \".*.\" | \"[].\") + encryptedField\n * ```\n *\n * This grammar allows you to specify the fields to encrypt for the object and recursively for nested objects.\n * - A string containing only a single `fieldName` will encrypt the field with the given name.\n * - A string starting with `fieldName.` allows to specify the encrypted fields of a nested object. The encrypted values of the\n * fields in the nested object will be saved in the nested object.\n * - A string starting with `fieldName.*.` treats `fieldName` as a map/dictionary data structure and allows to specify the encrypted fields of the\n * values of the map. Note that the values of the map must be objects as well. The encrypted content of each map value is stored in that value.\n * - A string starting with `fieldName[].` treats `fieldName` as an array and allows to specify the encrypted fields of the values of the array.\n * Note that the values of the array must be objects as well. The encrypted content of each array element is stored in that element.\n *\n * ## Example\n *\n * Consider the following object and encryption keys:\n * ```javascript\n * const obj = {\n * a: { x: 0, y: 1 },\n * b: \"hello\",\n * c: [ { public: \"a\", secret: \"b\" }, { public: \"c\", secret: \"d\" } ],\n * d: \"ok\",\n * e: {\n * info: \"something\",\n * private: \"secret\",\n * dataMap: {\n * \"en\": {\n * a: 1,\n * b: 2\n * },\n * \"fr\": {\n * a: 3,\n * b: 4\n * }\n * }\n * }\n * }\n * const encryptedFields = [\n * \"a\",\n * \"c[].secret\",\n * \"d\",\n * \"e.private\",\n * \"e.datamap.*.a\"\n * ]\n * ```\n * If you use them with the crypt method you will get the following result:\n * ```json\n * {\n * b: \"hello\",\n * c: [\n * { public: \"a\", encryptedSelf: 'encrypted+encoded { secret: \"b\" }' },\n * { public: \"c\", encryptedSelf: 'encrypted+encoded { secret: \"d\" }' }\n * ],\n * e: {\n * info: \"something\",\n * dataMap: {\n * \"en\": { b: 2, encryptedSelf: 'encrypted+encoded { a: 1 }' },\n * \"fr\": { b: 4, encryptedSelf: 'encrypted+encoded { a: 3 }' }\n * },\n * encryptedSelf: 'encrypted+encoded { private: \"secret\" }'\n * },\n * encryptedSelf: 'encrypted+encoded { a: { x: 0, y: 1 }, d: \"ok\" }'\n * }\n * ```\n *\n * ## Shortened representation\n *\n * You can also group encrypted fields having the same prefix by concatenating to the prefix the JSON representation of an array of all the postfixes.\n * For example the following encrypted fields:\n * ```javascript\n * const encryptedFields = [\"a.b.c.d.e.f1\", \"a.b.c.d.e.f2\", \"a.b.c.d.e.f3\", \"a.b.c.d.e.f4\"]\n * ```\n * can be shortened to\n * ```javascript\n * const encryptedFields = ['a.b.c.d.e.[\"f1\",\"f2\",\"f3\",\"f4\"]'] // Note the use of single quotes to avoid escaping the double quotes\n * ```\n * If you use the shortened representation you may need to escape nested json representations. In that case the use of `JSON.stringify` is\n * recommended.\n */\nexport interface EncryptedFieldsConfig {\n /**\n * Fields to encrypt for entities of type {@link AccessLog}\n * @default ['detail', 'objectId']\n */\n readonly accessLog?: string[]\n /**\n * Fields to encrypt for entities of type {@link CalendarItem}\n * @default ['details', 'title', 'patientId']\n */\n readonly calendarItem?: string[]\n /**\n * Fields to encrypt for entities of type {@link Contact}, excluding `services`. You can specify which fields of `services` should be encrypted\n * using {@link service}.\n * @default ['descr'] // encryption of `services` is managed through {@link service}\n */\n readonly contact?: string[]\n /**\n * Fields to encrypt for entities of type {@link Service}. Note that encryption of the `content` field and recursively contained `Services` through\n * `content.compoundValue` is automatically managed by the sdk, and you are not allowed to modify it.\n *\n * Note: any non-empty values for this field will break bi-directional data compatibility between v7 and previous: Contacts created with\n * v7 will not be read properly by previous versions. If you want\n * @default ['notes[].markdown'] // encryption of `content` is managed in a special way\n */\n readonly service?: string[]\n /**\n * Fields to encrypt for entities of type {@link HealthElement}\n * @default ['descr', 'note', 'notes[].markdown']\n */\n readonly healthElement?: string[]\n /**\n * Fields to encrypt for entities of type {@link MaintenanceTask}\n * @default ['properties']\n */\n readonly maintenanceTask?: string[]\n /**\n * Fields to encrypt for entities of type {@link Patient}\n * @default ['note', 'notes[].markdown']\n */\n readonly patient?: string[]\n\n /**\n * Fields to encrypt for entities of type {@link Message}\n * @default []\n */\n readonly message?: string[]\n\n /**\n * Fields to encrypt for entities of type {@link Topic}\n * @default ['description']\n */\n readonly topic?: string[]\n}\n\nexport namespace EncryptedFieldsConfig {\n export const Defaults = {\n accessLog: ['detail', 'objectId'],\n calendarItem: ['details', 'title', 'patientId'],\n contact: ['descr'],\n service: ['notes[].markdown'],\n healthElement: ['descr', 'note', 'notes[].markdown'],\n maintenanceTask: ['properties'],\n patient: ['note', 'notes[].markdown'],\n message: [],\n topic: ['description', 'linkedServices', 'linkedHealthElements'],\n }\n}\n\n/**\n * Details for the authentication of a user\n */\nexport type AuthenticationDetails =\n | {\n username: string\n password: string\n thirdPartyTokens?: { [thirdParty: string]: string }\n }\n | {\n icureTokens: { token: string; refreshToken: string }\n credentials?: { username: string; password: string }\n }\n | {\n thirdPartyTokens: { [thirdParty: string]: string }\n }\n | SmartAuthenticationDetails\n\n/**\n * Allows to perform authentication through an {@link AuthSecretProvider}.\n *\n * The iCure SDK can authenticate to the backend using different kinds of secrets, such as passwords, long-lived authentication tokens, and\n * short-lived authentication tokens generated through the message gateway. iCure associates to each kind of secret a certain security level, and for\n * some sensitive operations, depending on the configurations of the user and his group, some operations may require a secret of a certain security\n * level. For example, with the default configurations, in order to change his own email the user can't have logged in with a long-lived token, but he\n * needs to provide his current password or a short-lived token.\n *\n * By using this authentication option, the iCure SDK will automatically request and cache the secret from the {@link AuthSecretProvider} only when\n * needed, which should help to minimise the interaction with the user.\n *\n * Another advantage of using this authentication option over others is that in case all the cached tokens and secrets were to expire while performing\n * a request, instead of having the request fail the SDK will ask for a new secret from the {@link SmartAuthProvider} and the request will\n * automatically be retried with the new secret.\n *\n * You must provide the following information:\n * - username: any kind of value that can identify the user (userId, groupId/userId, username, email, ...). More generic identifiers, valid\n * on multiple groups, allow for simpler group switching by using {@link IcureApi.switchGroup}.\n * - secretProvider: the secret provider to use for authentication. Will handle interaction with the gui.\n *\n * You can also provide the following optional information, which may allow to reduce the requests for secrets initially:\n * - initialSecret: an initial secret (password, token, ...) that will be used to get new authentication tokens as needed. If it is expired it will be ignored.\n * - initialAuthToken: an initial authentication token used on each request. If it is expired it will be ignored.\n * - initialRefreshToken: an initial refresh token used to get new authentication tokens as needed. If it is expired it will be ignored.\n */\nexport type SmartAuthenticationDetails = {\n username: string\n secretProvider: AuthSecretProvider\n initialSecret?: { plainSecret: string } | { oauthToken: string; oauthType: OAuthThirdParty }\n initialAuthToken?: string\n initialRefreshToken?: string\n}\n\n/**\n * Main entry point for the iCure API. Provides entity-specific sub-apis and some general methods which are not related to a specific entity.\n */\nexport interface IcureApi extends Apis {\n /**\n * Get the information on groups that the current user can access and the current group that this api instance is working on.\n * Note that the values you will get for `availableGroups` may differ from the values you would get if you call {@link IccUserApi.getMatchingUsers}\n * on {@link Apis.userApi}, since the latter is specialised on the specific instance of the user in `currentGroup`.\n * - `currentGroup`: the group that this api instance is working on, or undefined if the backend environment is not multi-group.\n * - `availableGroups`: the list of groups that the current user can access with the provided secret. Empty if the backend environment is not\n * multi-group.\n */\n getGroupsInfo(): Promise<{ currentGroup: UserGroup | undefined; availableGroups: UserGroup[] }>\n\n /**\n * Switches the api to allow the user to work on a different group.\n * @param newGroupId the id of the group to switch to.\n * @return a new api for the specified group.\n */\n switchGroup(newGroupId: string): Promise<IcureApi>\n}\n\nexport namespace IcureApi {\n /**\n * Initialises a new instance of the iCure API.\n */\n export async function initialise(\n host: string,\n authenticationOptions: AuthenticationDetails | AuthenticationProvider,\n cryptoStrategies: CryptoStrategies,\n crypto: Crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : ({} as Crypto),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n options: IcureApiOptions = {}\n ): Promise<IcureApi> {\n const params = new IcureApiOptions.WithDefaults(options)\n let grouplessAuthenticationProvider = await getAuthenticationProvider(host, authenticationOptions, params.headers, fetchImpl)\n // TODO if this uses a smart auth provider the groupless auth provider does not share the secret cache with the group specific one.\n const grouplessUserApi = new IccUserApi(host, params.headers, grouplessAuthenticationProvider, fetchImpl)\n const matches = await getMatchesOrEmpty(grouplessUserApi)\n const chosenGroupId = matches.length > 1 && !!options.groupSelector ? await options.groupSelector(matches) : matches[0]?.groupId\n const groupSpecificAuthenticationProviderInfo =\n matches.length > 1 && chosenGroupId\n ? await grouplessAuthenticationProvider.switchGroup(chosenGroupId, matches)\n : { switchedProvider: grouplessAuthenticationProvider, isGroupLocked: false }\n /*TODO\n * On new very new users switching the authentication provider to a specific group may fail and block the user for too many requests. This is\n * probably linked to replication of the user in the fallback database.\n */\n const groupSpecificAuthenticationProvider =\n matches.length > 1 && chosenGroupId\n ? await grouplessAuthenticationProvider.switchGroup(chosenGroupId, matches)\n : grouplessAuthenticationProvider\n const cryptoInitInfo = await initialiseCryptoWithProvider(host, fetchImpl, groupSpecificAuthenticationProvider, params, cryptoStrategies, crypto)\n return new IcureApiImpl(\n cryptoInitInfo,\n host,\n groupSpecificAuthenticationProvider,\n fetch,\n grouplessUserApi,\n matches,\n matches.find((match) => match.groupId === chosenGroupId),\n params,\n cryptoStrategies\n )\n }\n}\n\nasync function getAuthenticationProvider(\n host: string,\n authenticationOptions: AuthenticationDetails | AuthenticationProvider,\n headers: { [headerName: string]: string },\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n) {\n let authenticationProvider: AuthenticationProvider\n if ('getIcureTokens' in authenticationOptions && 'switchGroup' in authenticationOptions && 'getAuthService' in authenticationOptions) {\n authenticationProvider = authenticationOptions\n } else if ('icureTokens' in authenticationOptions && !!authenticationOptions.icureTokens) {\n authenticationProvider = new JwtAuthenticationProvider(\n new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl),\n authenticationOptions?.credentials?.username,\n authenticationOptions?.credentials?.password,\n undefined,\n authenticationOptions.icureTokens\n )\n } else if (\n 'username' in authenticationOptions &&\n 'password' in authenticationOptions &&\n !!authenticationOptions.username &&\n !!authenticationOptions.password\n ) {\n authenticationProvider = new EnsembleAuthenticationProvider(\n new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl),\n authenticationOptions.username,\n authenticationOptions.password,\n 3600,\n undefined,\n undefined,\n authenticationOptions.thirdPartyTokens\n )\n } else if ('thirdPartyTokens' in authenticationOptions && !!authenticationOptions.thirdPartyTokens) {\n authenticationProvider = new JwtAuthenticationProvider(\n new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl),\n undefined,\n undefined,\n new JwtBridgedAuthService(\n new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl),\n undefined,\n undefined,\n authenticationOptions.thirdPartyTokens,\n undefined\n )\n )\n } else if ('username' in authenticationOptions && 'secretProvider' in authenticationOptions) {\n authenticationProvider = SmartAuthProvider.initialise(\n new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl),\n authenticationOptions.username,\n authenticationOptions.secretProvider,\n {\n initialSecret: authenticationOptions.initialSecret,\n initialAuthToken: authenticationOptions.initialAuthToken,\n initialRefreshToken: authenticationOptions.initialRefreshToken,\n }\n )\n } else {\n throw new Error('Invalid authentication options provided')\n }\n return authenticationProvider\n}\n\n// Apis which are used during crypto api initialisation, to avoid re-instantiating them later\ntype CryptoInitialisationInfo = {\n cryptoApi: IccCryptoXApi\n healthcarePartyApi: IccHcpartyXApi\n deviceApi: IccDeviceXApi\n // no patient api since it is base\n dataOwnerApi: IccDataOwnerXApi\n userApi: IccUserXApi\n icureMaintenanceTaskApi: IccIcureMaintenanceXApi\n maintenanceTaskApi: IccMaintenanceTaskXApi\n headers: { [headerName: string]: string }\n dataOwnerRequiresAnonymousDelegation: boolean\n recoveryApi: IccRecoveryXApi\n}\n\nconst REQUEST_AUTOFIX_ANONYMITY_HEADER = 'Icure-Request-Autofix-Anonymity'\n\nasync function initialiseCryptoWithProvider(\n host: string,\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response>,\n groupSpecificAuthenticationProvider: AuthenticationProvider,\n params: IcureApiOptions.WithDefaults,\n cryptoStrategies: CryptoStrategies,\n crypto: Crypto\n): Promise<CryptoInitialisationInfo> {\n const initialDataOwnerStub = await new IccDataOwnerXApi(\n host,\n params.headers,\n groupSpecificAuthenticationProvider,\n fetchImpl\n ).getCurrentDataOwnerStub()\n const dataOwnerRequiresAnonymousDelegation = cryptoStrategies.dataOwnerRequiresAnonymousDelegation(initialDataOwnerStub)\n let updatedHeaders = params.headers\n if (!Object.keys(updatedHeaders).includes(REQUEST_AUTOFIX_ANONYMITY_HEADER)) {\n if (initialDataOwnerStub.type == DataOwnerTypeEnum.Patient || initialDataOwnerStub.type == DataOwnerTypeEnum.Device) {\n if (!dataOwnerRequiresAnonymousDelegation) {\n updatedHeaders = { ...updatedHeaders, [REQUEST_AUTOFIX_ANONYMITY_HEADER]: 'false' }\n }\n } else {\n if (dataOwnerRequiresAnonymousDelegation) {\n updatedHeaders = { ...updatedHeaders, [REQUEST_AUTOFIX_ANONYMITY_HEADER]: 'true' }\n }\n }\n }\n\n const authApi = new IccAuthApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n const userApi = new IccUserXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, authApi, fetchImpl)\n const healthcarePartyApi = new IccHcpartyXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, authApi, fetchImpl)\n const deviceApi = new IccDeviceXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, userApi, authApi, fetchImpl)\n const basePatientApi = new IccPatientApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n const dataOwnerApi = new IccDataOwnerXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n const exchangeDataApi = new IccExchangeDataApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n const baseRecoveryDataApi = new IccRecoveryDataApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n // Crypto initialisation\n const icureStorage = new IcureStorageFacade(params.keyStorage, params.storage, params.entryKeysFactory)\n const cryptoPrimitives = new CryptoPrimitives(crypto)\n const baseExchangeKeysManager = new BaseExchangeKeysManager(cryptoPrimitives, dataOwnerApi, healthcarePartyApi, basePatientApi, deviceApi)\n const baseExchangeDataManager = new BaseExchangeDataManager(exchangeDataApi, dataOwnerApi, cryptoPrimitives, dataOwnerRequiresAnonymousDelegation)\n const keyRecovery = new KeyRecovery(cryptoPrimitives, dataOwnerApi, baseExchangeKeysManager, baseExchangeDataManager)\n const recoveryDataEncryption = new RecoveryDataEncryption(cryptoPrimitives, baseRecoveryDataApi)\n const keyPairRecoverer = new KeyPairRecoverer(recoveryDataEncryption)\n const userEncryptionKeysManager = new UserEncryptionKeysManager(\n cryptoPrimitives,\n dataOwnerApi,\n icureStorage,\n keyRecovery,\n cryptoStrategies,\n !params.disableParentKeysInitialisation,\n keyPairRecoverer\n )\n const userSignatureKeysManager = new UserSignatureKeysManager(icureStorage, dataOwnerApi, cryptoPrimitives)\n const newKey = await userEncryptionKeysManager.initialiseKeys()\n await new TransferKeysManager(\n cryptoPrimitives,\n baseExchangeDataManager,\n dataOwnerApi,\n userEncryptionKeysManager,\n userSignatureKeysManager,\n icureStorage\n ).updateTransferKeys(await dataOwnerApi.getCurrentDataOwnerStub())\n // TODO customise cache size?\n const exchangeKeysManager = new ExchangeKeysManager(\n 100,\n 500,\n 600000,\n 60000,\n cryptoStrategies,\n cryptoPrimitives,\n userEncryptionKeysManager,\n baseExchangeKeysManager,\n dataOwnerApi,\n !params.disableParentKeysInitialisation,\n icureStorage\n )\n const accessControlSecretUtils = new AccessControlSecretUtils(cryptoPrimitives)\n const exchangeDataManager = await initialiseExchangeDataManagerForCurrentDataOwner(\n baseExchangeDataManager,\n userEncryptionKeysManager,\n userSignatureKeysManager,\n accessControlSecretUtils,\n cryptoStrategies,\n dataOwnerApi,\n cryptoPrimitives,\n !params.disableParentKeysInitialisation\n )\n const exchangeDataMapManager = new ExchangeDataMapManager(\n new IccExchangeDataMapApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n )\n const secureDelegationsEncryption = new SecureDelegationsEncryption(userEncryptionKeysManager, cryptoPrimitives)\n const secureDelegationsSecurityMetadataEncryption = new SecureDelegationsSecurityMetadataDecryptor(\n exchangeDataManager,\n exchangeDataMapManager,\n secureDelegationsEncryption,\n dataOwnerApi\n )\n const xApiUtils = new ExtendedApisUtilsImpl(\n cryptoPrimitives,\n dataOwnerApi,\n new LegacyDelegationSecurityMetadataDecryptor(exchangeKeysManager, cryptoPrimitives),\n secureDelegationsSecurityMetadataEncryption,\n new SecureDelegationsManager(\n exchangeDataManager,\n exchangeDataMapManager,\n secureDelegationsEncryption,\n accessControlSecretUtils,\n userEncryptionKeysManager,\n cryptoPrimitives,\n dataOwnerApi,\n cryptoStrategies,\n dataOwnerRequiresAnonymousDelegation\n ),\n userApi,\n !params.disableParentKeysInitialisation\n )\n const shamirManager = new ShamirKeysManager(cryptoPrimitives, dataOwnerApi, userEncryptionKeysManager, exchangeDataManager)\n const confidentialEntitites = new ConfidentialEntities(xApiUtils, cryptoPrimitives, dataOwnerApi)\n await ensureDelegationForSelf(dataOwnerApi, xApiUtils, basePatientApi, cryptoPrimitives)\n const accessControlKeysHeadersProvider = new AccessControlKeysHeadersProvider(exchangeDataManager)\n const delegationsDeAnonymisation = new DelegationsDeAnonymization(\n dataOwnerApi,\n secureDelegationsSecurityMetadataEncryption,\n xApiUtils,\n cryptoPrimitives,\n accessControlSecretUtils,\n host,\n updatedHeaders,\n groupSpecificAuthenticationProvider,\n fetchImpl,\n accessControlKeysHeadersProvider\n )\n const cryptoApi = new IccCryptoXApi(\n exchangeKeysManager,\n cryptoPrimitives,\n userEncryptionKeysManager,\n dataOwnerApi,\n xApiUtils,\n shamirManager,\n params.storage,\n params.keyStorage,\n confidentialEntitites,\n exchangeDataManager,\n accessControlKeysHeadersProvider,\n delegationsDeAnonymisation\n )\n const maintenanceTaskApi = new IccMaintenanceTaskXApi(\n host,\n updatedHeaders,\n cryptoApi,\n healthcarePartyApi,\n dataOwnerApi,\n userApi,\n authApi,\n !dataOwnerRequiresAnonymousDelegation,\n params.encryptedFieldsConfig.maintenanceTask ?? EncryptedFieldsConfig.Defaults.maintenanceTask,\n groupSpecificAuthenticationProvider,\n fetchImpl\n )\n const icureMaintenanceTaskApi = new IccIcureMaintenanceXApi(cryptoApi, maintenanceTaskApi, dataOwnerApi, exchangeDataApi)\n\n if (newKey && params.createMaintenanceTasksOnNewKey) {\n await icureMaintenanceTaskApi.createMaintenanceTasksForNewKeypair(await userApi.getCurrentUser(), newKey.newKeyPair)\n }\n return {\n cryptoApi,\n userApi,\n healthcarePartyApi,\n deviceApi,\n maintenanceTaskApi,\n dataOwnerApi,\n icureMaintenanceTaskApi,\n headers: updatedHeaders,\n dataOwnerRequiresAnonymousDelegation,\n recoveryApi: new IccRecoveryXApi(\n baseRecoveryDataApi,\n recoveryDataEncryption,\n userEncryptionKeysManager,\n dataOwnerApi,\n cryptoPrimitives,\n exchangeDataManager\n ),\n }\n}\n\nclass IcureApiImpl implements IcureApi {\n private latestGroupsRequest: Promise<UserGroup[]>\n\n constructor(\n private readonly cryptoInitInfos: CryptoInitialisationInfo,\n private readonly host: string,\n private readonly groupSpecificAuthenticationProvider: AuthenticationProvider,\n private readonly fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>,\n private readonly grouplessUserApi: IccUserApi,\n latestMatches: UserGroup[],\n private readonly currentGroupInfo: UserGroup | undefined,\n private readonly params: IcureApiOptions.WithDefaults,\n private readonly cryptoStrategies: CryptoStrategies\n ) {\n this.latestGroupsRequest = Promise.resolve(latestMatches)\n }\n\n private _authApi: IccAuthApi | undefined\n\n get recoveryApi(): IccRecoveryXApi {\n return this.cryptoInitInfos.recoveryApi\n }\n\n get authApi(): IccAuthApi {\n return (\n this._authApi ?? (this._authApi = new IccAuthApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _codeApi: IccCodeXApi | undefined\n\n get codeApi(): IccCodeXApi {\n return (\n this._codeApi ??\n (this._codeApi = new IccCodeXApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _calendarItemTypeApi: IccCalendarItemTypeApi | undefined\n\n get calendarItemTypeApi(): IccCalendarItemTypeApi {\n return (\n this._calendarItemTypeApi ??\n (this._calendarItemTypeApi = new IccCalendarItemTypeApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _medicalLocationApi: IccMedicallocationApi | undefined\n\n get medicalLocationApi(): IccMedicallocationApi {\n return (\n this._medicalLocationApi ??\n (this._medicalLocationApi = new IccMedicallocationApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _roleApi: IccRoleApi | undefined\n\n get roleApi(): IccRoleApi {\n return this._roleApi ?? (this._roleApi = new IccRoleApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n }\n\n private _entityReferenceApi: IccEntityrefApi | undefined\n\n get entityReferenceApi(): IccEntityrefApi {\n return (\n this._entityReferenceApi ??\n (this._entityReferenceApi = new IccEntityrefApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _permissionApi: IccPermissionApi | undefined\n\n get permissionApi(): IccPermissionApi {\n return (\n this._permissionApi ??\n (this._permissionApi = new IccPermissionApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _accessLogApi: IccAccesslogXApi | undefined\n\n get accessLogApi(): IccAccesslogXApi {\n return (\n this._accessLogApi ??\n (this._accessLogApi = new IccAccesslogXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.params.encryptedFieldsConfig.accessLog ?? EncryptedFieldsConfig.Defaults.accessLog,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _agendaApi: IccAgendaApi | undefined\n\n get agendaApi(): IccAgendaApi {\n return (\n this._agendaApi ??\n (this._agendaApi = new IccAgendaApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _contactApi: IccContactXApi | undefined\n\n get contactApi(): IccContactXApi {\n return (\n this._contactApi ??\n (this._contactApi = new IccContactXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n this.userApi,\n this.authApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch,\n this.params.encryptedFieldsConfig.contact ?? EncryptedFieldsConfig.Defaults.contact,\n this.params.encryptedFieldsConfig.service ?? EncryptedFieldsConfig.Defaults.service\n ))\n )\n }\n\n private _formApi: IccFormXApi | undefined\n\n get formApi(): IccFormXApi {\n return (\n this._formApi ??\n (this._formApi = new IccFormXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _groupApi: IccGroupApi | undefined\n\n get groupApi(): IccGroupApi {\n return (\n this._groupApi ??\n (this._groupApi = new IccGroupApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _invoiceApi: IccInvoiceXApi | undefined\n\n get invoiceApi(): IccInvoiceXApi {\n return (\n this._invoiceApi ??\n (this._invoiceApi = new IccInvoiceXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.entityReferenceApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _insuranceApi: IccInsuranceApi | undefined\n\n get insuranceApi(): IccInsuranceApi {\n return (\n this._insuranceApi ??\n (this._insuranceApi = new IccInsuranceApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _documentApi: IccDocumentXApi | undefined\n\n get documentApi(): IccDocumentXApi {\n return (\n this._documentApi ??\n (this._documentApi = new IccDocumentXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.authApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _healthcareElementApi: IccHelementXApi | undefined\n\n get healthcareElementApi(): IccHelementXApi {\n return (\n this._healthcareElementApi ??\n (this._healthcareElementApi = new IccHelementXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n this.userApi,\n this.authApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.params.encryptedFieldsConfig.healthElement ?? EncryptedFieldsConfig.Defaults.healthElement,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _classificationApi: IccClassificationXApi | undefined\n\n get classificationApi(): IccClassificationXApi {\n return (\n this._classificationApi ??\n (this._classificationApi = new IccClassificationXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _calendarItemApi: IccCalendarItemXApi | undefined\n\n get calendarItemApi(): IccCalendarItemXApi {\n return (\n this._calendarItemApi ??\n (this._calendarItemApi = new IccCalendarItemXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.params.encryptedFieldsConfig.calendarItem ?? EncryptedFieldsConfig.Defaults.calendarItem,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _receiptApi: IccReceiptXApi | undefined\n\n get receiptApi(): IccReceiptXApi {\n return (\n this._receiptApi ??\n (this._receiptApi = new IccReceiptXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _timetableApi: IccTimeTableXApi | undefined\n\n get timetableApi(): IccTimeTableXApi {\n return (\n this._timetableApi ??\n (this._timetableApi = new IccTimeTableXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _patientApi: IccPatientXApi | undefined\n\n get patientApi(): IccPatientXApi {\n return (\n this._patientApi ??\n (this._patientApi = new IccPatientXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.contactApi,\n this.formApi,\n this.healthcareElementApi,\n this.invoiceApi,\n this.documentApi,\n this.healthcarePartyApi,\n this.classificationApi,\n this.dataOwnerApi,\n this.calendarItemApi,\n this.userApi,\n this.authApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.params.encryptedFieldsConfig.patient ?? EncryptedFieldsConfig.Defaults.patient,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _messageApi: IccMessageXApi | undefined\n\n get messageApi(): IccMessageXApi {\n return (\n this._messageApi ??\n (this._messageApi = new IccMessageXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n this.authApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.params.encryptedFieldsConfig.message ?? EncryptedFieldsConfig.Defaults.message,\n this.fetch\n ))\n )\n }\n\n private _topicApi: IccTopicXApi | undefined\n\n get topicApi(): IccTopicXApi {\n return (\n this._topicApi ??\n (this._topicApi = new IccTopicXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n this.authApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.params.encryptedFieldsConfig.topic ?? EncryptedFieldsConfig.Defaults.topic,\n this.fetch\n ))\n )\n }\n\n private _anonymousAccessApi: IccAnonymousAccessApi | undefined\n\n get anonymousAccessApi(): IccAnonymousAccessApi {\n return (\n this._anonymousAccessApi ??\n (this._anonymousAccessApi = new IccAnonymousAccessApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _applicationSettingsApi: IccApplicationsettingsApi | undefined\n\n get applicationSettingsApi(): IccApplicationsettingsApi {\n return (\n this._applicationSettingsApi ??\n (this._applicationSettingsApi = new IccApplicationsettingsApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _articleApi: IccArticleApi | undefined\n\n get articleApi(): IccArticleApi {\n return (\n this._articleApi ??\n (this._articleApi = new IccArticleApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _bekmehrApi: IccBekmehrXApi | undefined\n\n get bekmehrApi(): IccBekmehrXApi {\n return (\n this._bekmehrApi ??\n (this._bekmehrApi = new IccBekmehrXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.authApi,\n this.contactApi,\n this.healthcareElementApi,\n this.documentApi,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _beefactApi: IccBeefactApi | undefined\n\n get beefactApi(): IccBeefactApi {\n return (\n this._beefactApi ??\n (this._beefactApi = new IccBeefactApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _beresultexportApi: IccBeresultexportApi | undefined\n\n get beresultexportApi(): IccBeresultexportApi {\n return (\n this._beresultexportApi ??\n (this._beresultexportApi = new IccBeresultexportApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _beresultimportApi: IccBeresultimportApi | undefined\n\n get beresultimportApi(): IccBeresultimportApi {\n return (\n this._beresultimportApi ??\n (this._beresultimportApi = new IccBeresultimportApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _besamv2Api: IccBesamv2Api | undefined\n\n get besamv2Api(): IccBesamv2Api {\n return (\n this._besamv2Api ??\n (this._besamv2Api = new IccBesamv2Api(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _classificationTemplateApi: IccClassificationTemplateApi | undefined\n\n get classificationTemplateApi(): IccClassificationTemplateApi {\n return (\n this._classificationTemplateApi ??\n (this._classificationTemplateApi = new IccClassificationTemplateApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _doctemplateApi: IccDoctemplateXApi | undefined\n\n get doctemplateApi(): IccDoctemplateXApi {\n return (\n this._doctemplateApi ??\n (this._doctemplateApi = new IccDoctemplateXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _entitytemplateApi: IccEntitytemplateApi | undefined\n\n get entitytemplateApi(): IccEntitytemplateApi {\n return (\n this._entitytemplateApi ??\n (this._entitytemplateApi = new IccEntitytemplateApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _frontendmigrationApi: IccFrontendmigrationApi | undefined\n\n get frontendmigrationApi(): IccFrontendmigrationApi {\n return (\n this._frontendmigrationApi ??\n (this._frontendmigrationApi = new IccFrontendmigrationApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _icureApi: IccIcureApi | undefined\n\n get icureApi(): IccIcureApi {\n return (\n this._icureApi ??\n (this._icureApi = new IccIcureApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _keywordApi: IccKeywordApi | undefined\n\n get keywordApi(): IccKeywordApi {\n return (\n this._keywordApi ??\n (this._keywordApi = new IccKeywordApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _medexApi: IccMedexApi | undefined\n\n get medexApi(): IccMedexApi {\n return (\n this._medexApi ??\n (this._medexApi = new IccMedexApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _placeApi: IccPlaceApi | undefined\n\n get placeApi(): IccPlaceApi {\n return (\n this._placeApi ??\n (this._placeApi = new IccPlaceApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _pubsubApi: IccPubsubApi | undefined\n\n get pubsubApi(): IccPubsubApi {\n return (\n this._pubsubApi ??\n (this._pubsubApi = new IccPubsubApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _replicationApi: IccReplicationApi | undefined\n\n get replicationApi(): IccReplicationApi {\n return (\n this._replicationApi ??\n (this._replicationApi = new IccReplicationApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _tarificationApi: IccTarificationApi | undefined\n\n get tarificationApi(): IccTarificationApi {\n return (\n this._tarificationApi ??\n (this._tarificationApi = new IccTarificationApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _tmpApi: IccTmpApi | undefined\n\n get tmpApi(): IccTmpApi {\n return (\n this._tmpApi ?? (this._tmpApi = new IccTmpApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n get cryptoApi(): IccCryptoXApi {\n return this.cryptoInitInfos.cryptoApi\n }\n\n get dataOwnerApi(): IccDataOwnerXApi {\n return this.cryptoInitInfos.dataOwnerApi\n }\n\n get deviceApi(): IccDeviceXApi {\n return this.cryptoInitInfos.deviceApi\n }\n\n get healthcarePartyApi(): IccHcpartyXApi {\n return this.cryptoInitInfos.healthcarePartyApi\n }\n\n get icureMaintenanceTaskApi(): IccIcureMaintenanceXApi {\n return this.cryptoInitInfos.icureMaintenanceTaskApi\n }\n\n get maintenanceTaskApi(): IccMaintenanceTaskXApi {\n return this.cryptoInitInfos.maintenanceTaskApi\n }\n\n get userApi(): IccUserXApi {\n return this.cryptoInitInfos.userApi\n }\n\n async getGroupsInfo(): Promise<{ currentGroup: UserGroup | undefined; availableGroups: UserGroup[] }> {\n this.latestGroupsRequest = this.grouplessUserApi.getMatchingUsers()\n return { currentGroup: this.currentGroupInfo, availableGroups: await this.latestGroupsRequest }\n }\n\n async switchGroup(newGroupId: string): Promise<IcureApi> {\n const availableGroups = await this.latestGroupsRequest\n const switchedProvider = await this.groupSpecificAuthenticationProvider.switchGroup(newGroupId, availableGroups)\n const cryptoInitInfos = await initialiseCryptoWithProvider(\n this.host,\n this.fetch,\n switchedProvider,\n this.params,\n this.cryptoStrategies,\n this.cryptoApi.primitives.crypto\n )\n return new IcureApiImpl(\n cryptoInitInfos,\n this.host,\n switchedProvider,\n this.fetch,\n this.grouplessUserApi,\n availableGroups,\n availableGroups.find((x) => x.groupId === newGroupId)!,\n this.params,\n this.cryptoStrategies\n )\n }\n}\n\n/**\n /**\n * @experimental This function still needs development and will be changed\n * Build apis which do not need crypto and can be used by non-data-owner users\n */\nexport const BasicApis = async function (\n host: string,\n authenticationOptions: AuthenticationDetails | AuthenticationProvider,\n crypto: Crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : ({} as Crypto),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n options: { headers?: { [headerName: string]: string } } = {}\n): Promise<BasicApis> {\n const authenticationProvider = await getAuthenticationProvider(host, authenticationOptions, options.headers ?? {}, fetchImpl)\n const authApi = new IccAuthApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n\n const codeApi = new IccCodeXApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n const entityReferenceApi = new IccEntityrefApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n const userApi = new IccUserXApi(host, options.headers ?? {}, authenticationProvider, authApi, fetchImpl)\n const deviceApi = new IccDeviceXApi(host, options.headers ?? {}, authenticationProvider, userApi, authApi, fetchImpl)\n const permissionApi = new IccPermissionApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n const agendaApi = new IccAgendaApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n const groupApi = new IccGroupApi(host, options.headers ?? {}, authenticationProvider)\n const insuranceApi = new IccInsuranceApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n const healthcarePartyApi = new IccHcpartyXApi(host, options.headers ?? {}, authenticationProvider, authApi, fetchImpl)\n\n return {\n authApi,\n deviceApi,\n codeApi,\n userApi,\n permissionApi,\n insuranceApi,\n entityReferenceApi,\n agendaApi,\n groupApi,\n healthcarePartyApi,\n }\n}\n\nasync function getMatchesOrEmpty(userApi: IccUserApi): Promise<UserGroup[]> {\n try {\n return await userApi.getMatchingUsers()\n } catch (err) {\n if (err instanceof Error && 'statusCode' in err && (err as any).statusCode === 404) return Promise.resolve([])\n else return Promise.reject(err)\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../icc-x-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCA8BmB;AACnB,qDAA8C;AAC9C,yDAAkD;AAClD,2DAAoD;AACpD,2DAAoD;AACpD,6DAAsD;AACtD,2DAAoD;AACpD,qDAA8C;AAC9C,6DAAsD;AACtD,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AS,CAAC,CAAA;QAClG,MAAM,QAAQ,GAAG,IAAI,qBAAW,CAAC,IAAI,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,EAAE,sBAAsB,CAAC,CAAA;QACrF,MAAM,YAAY,GAAG,IAAI,yBAAe,CAAC,IAAI,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;QACxG,MAAM,kBAAkB,GAAG,IAAI,kCAAc,CAAC,IAAI,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;QAEtH,OAAO;YACL,OAAO;YACP,SAAS;YACT,OAAO;YACP,OAAO;YACP,aAAa;YACb,YAAY;YACZ,kBAAkB;YAClB,SAAS;YACT,QAAQ;YACR,kBAAkB;SACnB,CAAA;;CACF,CAAA;AApCY,QAAA,SAAS,aAoCrB;AAED,SAAe,iBAAiB,CAAC,OAAmB;;QAClD,IAAI;YACF,OAAO,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAA;SACxC;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,YAAY,KAAK,IAAI,YAAY,IAAI,GAAG,IAAK,GAAW,CAAC,UAAU,KAAK,GAAG;gBAAE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;;gBACzG,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SAChC;IACH,CAAC;CAAA","sourcesContent":["import {\n IccAgendaApi,\n IccAnonymousAccessApi,\n IccApplicationsettingsApi,\n IccArticleApi,\n IccAuthApi,\n IccBeefactApi,\n IccBeresultexportApi,\n IccBeresultimportApi,\n IccBesamv2Api,\n IccCalendarItemTypeApi,\n IccClassificationTemplateApi,\n IccEntityrefApi,\n IccEntitytemplateApi,\n IccFrontendmigrationApi,\n IccGroupApi,\n IccIcureApi,\n IccInsuranceApi,\n IccKeywordApi,\n IccMedexApi,\n IccMedicallocationApi,\n IccPatientApi,\n IccPermissionApi,\n IccPlaceApi,\n IccPubsubApi,\n IccReplicationApi,\n IccTarificationApi,\n IccTmpApi,\n IccUserApi,\n OAuthThirdParty,\n} from '../icc-api'\nimport { IccUserXApi } from './icc-user-x-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccContactXApi } from './icc-contact-x-api'\nimport { IccInvoiceXApi } from './icc-invoice-x-api'\nimport { IccDocumentXApi } from './icc-document-x-api'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { IccFormXApi } from './icc-form-x-api'\nimport { IccHelementXApi } from './icc-helement-x-api'\nimport { IccClassificationXApi } from './icc-classification-x-api'\nimport { IccCalendarItemXApi } from './icc-calendar-item-x-api'\nimport { IccPatientXApi } from './icc-patient-x-api'\nimport { IccMessageXApi } from './icc-message-x-api'\nimport { IccReceiptXApi } from './icc-receipt-x-api'\nimport { IccAccesslogXApi } from './icc-accesslog-x-api'\nimport { IccTimeTableXApi } from './icc-time-table-x-api'\nimport { IccCodeXApi } from './icc-code-x-api'\nimport { IccMaintenanceTaskXApi } from './icc-maintenance-task-x-api'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { StorageFacade } from './storage/StorageFacade'\nimport { KeyStorageFacade } from './storage/KeyStorageFacade'\nimport { LocalStorageImpl } from './storage/LocalStorageImpl'\nimport { KeyStorageImpl } from './storage/KeyStorageImpl'\nimport {\n AuthenticationProvider,\n BasicAuthenticationProvider,\n EnsembleAuthenticationProvider,\n JwtAuthenticationProvider,\n NoAuthenticationProvider,\n} from './auth/AuthenticationProvider'\nimport { CryptoPrimitives } from './crypto/CryptoPrimitives'\nimport { UserEncryptionKeysManager } from './crypto/UserEncryptionKeysManager'\nimport { IcureStorageFacade } from './storage/IcureStorageFacade'\nimport { DefaultStorageEntryKeysFactory } from './storage/DefaultStorageEntryKeysFactory'\nimport { KeyRecovery } from './crypto/KeyRecovery'\nimport { BaseExchangeKeysManager } from './crypto/BaseExchangeKeysManager'\nimport { StorageEntryKeysFactory } from './storage/StorageEntryKeysFactory'\nimport { CryptoStrategies } from './crypto/CryptoStrategies'\nimport { ExchangeKeysManager } from './crypto/ExchangeKeysManager'\nimport { ShamirKeysManager } from './crypto/ShamirKeysManager'\nimport { TransferKeysManager } from './crypto/TransferKeysManager'\nimport { IccIcureMaintenanceXApi } from './icc-icure-maintenance-x-api'\nimport { ConfidentialEntities } from './crypto/ConfidentialEntities'\nimport { ensureDelegationForSelf } from './crypto/utils'\nimport { SecureDelegationsSecurityMetadataDecryptor } from './crypto/SecureDelegationsSecurityMetadataDecryptor'\nimport { initialiseExchangeDataManagerForCurrentDataOwner } from './crypto/ExchangeDataManager'\nimport { BaseExchangeDataManager } from './crypto/BaseExchangeDataManager'\nimport { IccExchangeDataApi } from '../icc-api/api/internal/IccExchangeDataApi'\nimport { UserSignatureKeysManager } from './crypto/UserSignatureKeysManager'\nimport { AccessControlSecretUtils } from './crypto/AccessControlSecretUtils'\nimport { SecureDelegationsEncryption } from './crypto/SecureDelegationsEncryption'\nimport { LegacyDelegationSecurityMetadataDecryptor } from './crypto/LegacyDelegationSecurityMetadataDecryptor'\nimport { ExtendedApisUtilsImpl } from './crypto/ExtendedApisUtilsImpl'\nimport { SecureDelegationsManager } from './crypto/SecureDelegationsManager'\nimport { AccessControlKeysHeadersProvider } from './crypto/AccessControlKeysHeadersProvider'\nimport { IccExchangeDataMapApi } from '../icc-api/api/internal/IccExchangeDataMapApi'\nimport { ExchangeDataMapManager } from './crypto/ExchangeDataMapManager'\nimport { IccDeviceXApi } from './icc-device-x-api'\nimport { IccBekmehrXApi } from './icc-bekmehr-x-api'\nimport { IccDoctemplateXApi } from './icc-doctemplate-x-api'\nimport { UserGroup } from '../icc-api/model/UserGroup'\nimport { IccTopicXApi } from './icc-topic-x-api'\nimport { IccRoleApi } from '../icc-api/api/IccRoleApi'\nimport { DataOwnerTypeEnum } from '../icc-api/model/DataOwnerTypeEnum'\nimport { DelegationsDeAnonymization } from './crypto/DelegationsDeAnonymization'\nimport { JwtBridgedAuthService } from './auth/JwtBridgedAuthService'\nimport { AuthSecretProvider, SmartAuthProvider } from './auth/SmartAuthProvider'\nimport { KeyPairRecoverer } from './crypto/KeyPairRecoverer'\nimport { IccRecoveryDataApi } from '../icc-api/api/internal/IccRecoveryDataApi'\nimport { RecoveryDataEncryption } from './crypto/RecoveryDataEncryption'\nimport { IccRecoveryXApi } from './icc-recovery-x-api'\n\nexport * from './icc-accesslog-x-api'\nexport * from './icc-bekmehr-x-api'\nexport * from './icc-calendar-item-x-api'\nexport * from './icc-classification-x-api'\nexport * from './icc-code-x-api'\nexport * from './icc-contact-x-api'\nexport * from './icc-crypto-x-api'\nexport * from './icc-doctemplate-x-api'\nexport * from './icc-document-x-api'\nexport * from './icc-form-x-api'\nexport * from './icc-hcparty-x-api'\nexport * from './icc-helement-x-api'\nexport * from './icc-invoice-x-api'\nexport * from './icc-message-x-api'\nexport * from './icc-patient-x-api'\nexport * from './icc-user-x-api'\nexport * from './icc-time-table-x-api'\nexport * from './icc-receipt-x-api'\nexport * from './icc-data-owner-x-api'\nexport * from './icc-icure-maintenance-x-api'\nexport * from './icc-maintenance-task-x-api'\nexport * from './utils'\n\nexport * from './crypto/RSA'\nexport * from './crypto/CryptoPrimitives'\nexport * from './crypto/ShareMetadataBehaviour'\nexport * from './auth/AuthenticationProvider'\n\nexport { KeyStorageFacade } from './storage/KeyStorageFacade'\nexport { LocalStorageImpl } from './storage/LocalStorageImpl'\nexport { StorageFacade } from './storage/StorageFacade'\nexport { KeyStorageImpl } from './storage/KeyStorageImpl'\nexport { CryptoStrategies } from './crypto/CryptoStrategies'\nexport { getShaVersionForKey } from './crypto/utils'\n\nexport interface BasicApis {\n readonly authApi: IccAuthApi\n readonly codeApi: IccCodeXApi\n readonly userApi: IccUserXApi\n readonly permissionApi: IccPermissionApi\n readonly insuranceApi: IccInsuranceApi\n readonly entityReferenceApi: IccEntityrefApi\n readonly agendaApi: IccAgendaApi\n readonly groupApi: IccGroupApi\n readonly healthcarePartyApi: IccHcpartyXApi\n readonly deviceApi: IccDeviceXApi\n}\nexport interface Apis extends BasicApis {\n readonly calendarItemTypeApi: IccCalendarItemTypeApi\n readonly medicalLocationApi: IccMedicallocationApi\n readonly cryptoApi: IccCryptoXApi\n readonly accessLogApi: IccAccesslogXApi\n readonly contactApi: IccContactXApi\n readonly formApi: IccFormXApi\n readonly invoiceApi: IccInvoiceXApi\n readonly documentApi: IccDocumentXApi\n readonly healthcareElementApi: IccHelementXApi\n readonly classificationApi: IccClassificationXApi\n readonly calendarItemApi: IccCalendarItemXApi\n readonly receiptApi: IccReceiptXApi\n readonly timetableApi: IccTimeTableXApi\n readonly patientApi: IccPatientXApi\n readonly messageApi: IccMessageXApi\n readonly maintenanceTaskApi: IccMaintenanceTaskXApi\n readonly dataOwnerApi: IccDataOwnerXApi\n readonly icureMaintenanceTaskApi: IccIcureMaintenanceXApi\n readonly anonymousAccessApi: IccAnonymousAccessApi\n readonly applicationSettingsApi: IccApplicationsettingsApi\n readonly articleApi: IccArticleApi\n readonly bekmehrApi: IccBekmehrXApi\n readonly beefactApi: IccBeefactApi\n readonly beresultexportApi: IccBeresultexportApi\n readonly beresultimportApi: IccBeresultimportApi\n readonly besamv2Api: IccBesamv2Api\n readonly classificationTemplateApi: IccClassificationTemplateApi\n readonly doctemplateApi: IccDoctemplateXApi\n readonly entitytemplateApi: IccEntitytemplateApi\n readonly frontendmigrationApi: IccFrontendmigrationApi\n readonly icureApi: IccIcureApi\n readonly keywordApi: IccKeywordApi\n readonly medexApi: IccMedexApi\n readonly placeApi: IccPlaceApi\n readonly pubsubApi: IccPubsubApi\n readonly replicationApi: IccReplicationApi\n readonly tarificationApi: IccTarificationApi\n readonly tmpApi: IccTmpApi\n readonly topicApi: IccTopicXApi\n readonly roleApi: IccRoleApi\n readonly recoveryApi: IccRecoveryXApi\n}\n\n/**\n * Allows to customise the behaviour of the iCure API by providing various optional parameters.\n */\nexport interface IcureApiOptions {\n /**\n * Specifies how iCure can store string values (e.g. json). In production this should be persistent storage.\n * @default the browser's localStorage.\n */\n readonly storage?: StorageFacade<string>\n /**\n * Specifies how iCure can store cryptographic keys. Preferably this should be some ad-hoc storage key storage.\n * @default stores the json of the jwk representation of the key in {@link storage}.\n */\n readonly keyStorage?: KeyStorageFacade\n /**\n * Specifies where iCure should store his data within the {@link storage} and {@link keyStorage}.\n * @default {@link DefaultStorageEntryKeysFactory}\n */\n readonly entryKeysFactory?: StorageEntryKeysFactory\n /**\n * Specifies if iCure should automatically create maintenance tasks for requesting access back when a new key is generated at initialisation time.\n * Note that the maintenance task will be created only towards HCP data owners: if you want to create a maintenance task also to other types of data\n * owners you should disable this and call {@link IccIcureMaintenanceXApi.createMaintenanceTasksForNewKeypair} yourself.\n * @default true\n */\n readonly createMaintenanceTasksOnNewKey?: boolean\n /**\n * Additional headers to use on each request made by the iCure api.\n * @default no additional headers\n */\n readonly headers?: { [headerName: string]: string }\n /**\n * Specifies which fields should be encrypted for each kind of encryptable entity. You should make sure that every application in your environment\n * specifies the same values for this configuration.\n * @default see documentation for {@link EncryptedFieldsConfig}\n */\n readonly encryptedFieldsConfig?: EncryptedFieldsConfig\n /**\n * Each user may exist in multiple groups, but an instance of {@link IcureApi} is specialised for a single group. This function allows you to decide\n * the group to use for a given user. This functions will be called only if a user exists in at least 2 groups, takes in input the information on\n * the groups the user can access (in no specific order) and must return the id of one of these groups.\n * @default takes the first group provided. The group chosen by this method may vary between different instantiations of the {@link IcureApi} even\n * if for the same user and if the groups available for the user do not change.\n */\n readonly groupSelector?: (availableGroupsInfo: UserGroup[]) => Promise<string>\n /**\n * Temporary value to support EHR Lite and MedTech api implementations.\n *\n * Currently, all hcps are able to access encrypted data shared with any of their parents, and on initialisation the api will verify that there is a\n * key pair available for the current user and for every parent of the user. If this option is set to true, the api will not load keys for the\n * parent users.\n *\n * This \"implicit data-sharing scheme\" (each parent HCP is essentially sharing data with all its children HCPs), however, may not be ideal for all\n * use cases, and it will be changed in future to be configurable in order to make it more general.\n * @default false, equivalent to previous behaviour.\n */\n readonly disableParentKeysInitialisation?: boolean\n}\n\nnamespace IcureApiOptions {\n export namespace Defaults {\n export const entryKeysFactory = new DefaultStorageEntryKeysFactory()\n export const createMaintenanceTasksOnNewKey = true\n export const headers = {}\n }\n\n export class WithDefaults implements IcureApiOptions {\n readonly entryKeysFactory: StorageEntryKeysFactory\n readonly createMaintenanceTasksOnNewKey: boolean\n readonly storage: StorageFacade<string>\n readonly keyStorage: KeyStorageFacade\n readonly headers: { [headerName: string]: string }\n readonly encryptedFieldsConfig: EncryptedFieldsConfig\n readonly groupSelector: (availableGroupsInfo: UserGroup[]) => Promise<string>\n readonly disableParentKeysInitialisation: boolean\n\n constructor(custom: IcureApiOptions) {\n this.entryKeysFactory = custom.entryKeysFactory ?? Defaults.entryKeysFactory\n this.createMaintenanceTasksOnNewKey = custom.createMaintenanceTasksOnNewKey ?? Defaults.createMaintenanceTasksOnNewKey\n this.storage = custom.storage ?? new LocalStorageImpl()\n this.keyStorage = custom.keyStorage ?? new KeyStorageImpl(this.storage)\n this.headers = custom.headers ?? Defaults.headers\n this.encryptedFieldsConfig = custom.encryptedFieldsConfig ?? {}\n this.groupSelector = custom.groupSelector ?? ((groups) => Promise.resolve(groups[0].groupId!))\n this.disableParentKeysInitialisation = custom.disableParentKeysInitialisation ?? false\n }\n }\n}\n\n/**\n * Specifies which fields should be encrypted for each kind of encryptable entity.\n *\n * Note that any value you specify here overrides the default values. For example if you specify `['medicalLocationId']` for `healthElement` the\n * fields `['descr', 'note']` which are usually encrypted by default will no longer be encrypted. If you want to add fields to the default values\n * you can use {@link EncryptedFieldsConfig.Defaults}, for example `[...EncryptedFieldsConfig.Defaults.healthElement, 'medicalLocationId'].\n *\n * # Encrypted fields syntax\n *\n * ## Grammar\n *\n * The grammar for each encrypted field is the following:\n * ```\n * fieldName :=\n * regex([a-zA-Z_][a-zA-Z0-9_]+)\n * encryptedField :=\n * fieldName\n * | fieldName + (\".\" | \".*.\" | \"[].\") + encryptedField\n * ```\n *\n * This grammar allows you to specify the fields to encrypt for the object and recursively for nested objects.\n * - A string containing only a single `fieldName` will encrypt the field with the given name.\n * - A string starting with `fieldName.` allows to specify the encrypted fields of a nested object. The encrypted values of the\n * fields in the nested object will be saved in the nested object.\n * - A string starting with `fieldName.*.` treats `fieldName` as a map/dictionary data structure and allows to specify the encrypted fields of the\n * values of the map. Note that the values of the map must be objects as well. The encrypted content of each map value is stored in that value.\n * - A string starting with `fieldName[].` treats `fieldName` as an array and allows to specify the encrypted fields of the values of the array.\n * Note that the values of the array must be objects as well. The encrypted content of each array element is stored in that element.\n *\n * ## Example\n *\n * Consider the following object and encryption keys:\n * ```javascript\n * const obj = {\n * a: { x: 0, y: 1 },\n * b: \"hello\",\n * c: [ { public: \"a\", secret: \"b\" }, { public: \"c\", secret: \"d\" } ],\n * d: \"ok\",\n * e: {\n * info: \"something\",\n * private: \"secret\",\n * dataMap: {\n * \"en\": {\n * a: 1,\n * b: 2\n * },\n * \"fr\": {\n * a: 3,\n * b: 4\n * }\n * }\n * }\n * }\n * const encryptedFields = [\n * \"a\",\n * \"c[].secret\",\n * \"d\",\n * \"e.private\",\n * \"e.datamap.*.a\"\n * ]\n * ```\n * If you use them with the crypt method you will get the following result:\n * ```json\n * {\n * b: \"hello\",\n * c: [\n * { public: \"a\", encryptedSelf: 'encrypted+encoded { secret: \"b\" }' },\n * { public: \"c\", encryptedSelf: 'encrypted+encoded { secret: \"d\" }' }\n * ],\n * e: {\n * info: \"something\",\n * dataMap: {\n * \"en\": { b: 2, encryptedSelf: 'encrypted+encoded { a: 1 }' },\n * \"fr\": { b: 4, encryptedSelf: 'encrypted+encoded { a: 3 }' }\n * },\n * encryptedSelf: 'encrypted+encoded { private: \"secret\" }'\n * },\n * encryptedSelf: 'encrypted+encoded { a: { x: 0, y: 1 }, d: \"ok\" }'\n * }\n * ```\n *\n * ## Shortened representation\n *\n * You can also group encrypted fields having the same prefix by concatenating to the prefix the JSON representation of an array of all the postfixes.\n * For example the following encrypted fields:\n * ```javascript\n * const encryptedFields = [\"a.b.c.d.e.f1\", \"a.b.c.d.e.f2\", \"a.b.c.d.e.f3\", \"a.b.c.d.e.f4\"]\n * ```\n * can be shortened to\n * ```javascript\n * const encryptedFields = ['a.b.c.d.e.[\"f1\",\"f2\",\"f3\",\"f4\"]'] // Note the use of single quotes to avoid escaping the double quotes\n * ```\n * If you use the shortened representation you may need to escape nested json representations. In that case the use of `JSON.stringify` is\n * recommended.\n */\nexport interface EncryptedFieldsConfig {\n /**\n * Fields to encrypt for entities of type {@link AccessLog}\n * @default ['detail', 'objectId']\n */\n readonly accessLog?: string[]\n /**\n * Fields to encrypt for entities of type {@link CalendarItem}\n * @default ['details', 'title', 'patientId']\n */\n readonly calendarItem?: string[]\n /**\n * Fields to encrypt for entities of type {@link Contact}, excluding `services`. You can specify which fields of `services` should be encrypted\n * using {@link service}.\n * @default ['descr'] // encryption of `services` is managed through {@link service}\n */\n readonly contact?: string[]\n /**\n * Fields to encrypt for entities of type {@link Service}. Note that encryption of the `content` field and recursively contained `Services` through\n * `content.compoundValue` is automatically managed by the sdk, and you are not allowed to modify it.\n *\n * Note: any non-empty values for this field will break bi-directional data compatibility between v7 and previous: Contacts created with\n * v7 will not be read properly by previous versions. If you want\n * @default ['notes[].markdown'] // encryption of `content` is managed in a special way\n */\n readonly service?: string[]\n /**\n * Fields to encrypt for entities of type {@link HealthElement}\n * @default ['descr', 'note', 'notes[].markdown']\n */\n readonly healthElement?: string[]\n /**\n * Fields to encrypt for entities of type {@link MaintenanceTask}\n * @default ['properties']\n */\n readonly maintenanceTask?: string[]\n /**\n * Fields to encrypt for entities of type {@link Patient}\n * @default ['note', 'notes[].markdown']\n */\n readonly patient?: string[]\n\n /**\n * Fields to encrypt for entities of type {@link Message}\n * @default []\n */\n readonly message?: string[]\n\n /**\n * Fields to encrypt for entities of type {@link Topic}\n * @default ['description']\n */\n readonly topic?: string[]\n}\n\nexport namespace EncryptedFieldsConfig {\n export const Defaults = {\n accessLog: ['detail', 'objectId'],\n calendarItem: ['details', 'title', 'patientId'],\n contact: ['descr'],\n service: ['notes[].markdown'],\n healthElement: ['descr', 'note', 'notes[].markdown'],\n maintenanceTask: ['properties'],\n patient: ['note', 'notes[].markdown'],\n message: [],\n topic: ['description', 'linkedServices', 'linkedHealthElements'],\n }\n}\n\n/**\n * Details for the authentication of a user\n */\nexport type AuthenticationDetails =\n | {\n username: string\n password: string\n thirdPartyTokens?: { [thirdParty: string]: string }\n }\n | {\n icureTokens: { token: string; refreshToken: string }\n credentials?: { username: string; password: string }\n }\n | {\n thirdPartyTokens: { [thirdParty: string]: string }\n }\n | SmartAuthenticationDetails\n\n/**\n * Allows to perform authentication through an {@link AuthSecretProvider}.\n *\n * The iCure SDK can authenticate to the backend using different kinds of secrets, such as passwords, long-lived authentication tokens, and\n * short-lived authentication tokens generated through the message gateway. iCure associates to each kind of secret a certain security level, and for\n * some sensitive operations, depending on the configurations of the user and his group, some operations may require a secret of a certain security\n * level. For example, with the default configurations, in order to change his own email the user can't have logged in with a long-lived token, but he\n * needs to provide his current password or a short-lived token.\n *\n * By using this authentication option, the iCure SDK will automatically request and cache the secret from the {@link AuthSecretProvider} only when\n * needed, which should help to minimise the interaction with the user.\n *\n * Another advantage of using this authentication option over others is that in case all the cached tokens and secrets were to expire while performing\n * a request, instead of having the request fail the SDK will ask for a new secret from the {@link SmartAuthProvider} and the request will\n * automatically be retried with the new secret.\n *\n * You must provide the following information:\n * - username: any kind of value that can identify the user (userId, groupId/userId, username, email, ...). More generic identifiers, valid\n * on multiple groups, allow for simpler group switching by using {@link IcureApi.switchGroup}.\n * - secretProvider: the secret provider to use for authentication. Will handle interaction with the gui.\n *\n * You can also provide the following optional information, which may allow to reduce the requests for secrets initially:\n * - initialSecret: an initial secret (password, token, ...) that will be used to get new authentication tokens as needed. If it is expired it will be ignored.\n * - initialAuthToken: an initial authentication token used on each request. If it is expired it will be ignored.\n * - initialRefreshToken: an initial refresh token used to get new authentication tokens as needed. If it is expired it will be ignored.\n */\nexport type SmartAuthenticationDetails = {\n username: string\n secretProvider: AuthSecretProvider\n initialSecret?: { plainSecret: string } | { oauthToken: string; oauthType: OAuthThirdParty }\n initialAuthToken?: string\n initialRefreshToken?: string\n}\n\n/**\n * Main entry point for the iCure API. Provides entity-specific sub-apis and some general methods which are not related to a specific entity.\n */\nexport interface IcureApi extends Apis {\n /**\n * Get the information on groups that the current user can access and the current group that this api instance is working on.\n * Note that the values you will get for `availableGroups` may differ from the values you would get if you call {@link IccUserApi.getMatchingUsers}\n * on {@link Apis.userApi}, since the latter is specialised on the specific instance of the user in `currentGroup`.\n * - `currentGroup`: the group that this api instance is working on, or undefined if the backend environment is not multi-group.\n * - `availableGroups`: the list of groups that the current user can access with the provided secret. Empty if the backend environment is not\n * multi-group.\n */\n getGroupsInfo(): Promise<{ currentGroup: UserGroup | undefined; availableGroups: UserGroup[] }>\n\n /**\n * Switches the api to allow the user to work on a different group.\n * @param newGroupId the id of the group to switch to.\n * @return a new api for the specified group.\n */\n switchGroup(newGroupId: string): Promise<IcureApi>\n}\n\nexport namespace IcureApi {\n /**\n * Initialises a new instance of the iCure API.\n */\n export async function initialise(\n host: string,\n authenticationOptions: AuthenticationDetails | AuthenticationProvider,\n cryptoStrategies: CryptoStrategies,\n crypto: Crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : ({} as Crypto),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n options: IcureApiOptions = {}\n ): Promise<IcureApi> {\n const params = new IcureApiOptions.WithDefaults(options)\n let grouplessAuthenticationProvider = await getAuthenticationProvider(host, authenticationOptions, params.headers, fetchImpl)\n // TODO if this uses a smart auth provider the groupless auth provider does not share the secret cache with the group specific one.\n const grouplessUserApi = new IccUserApi(host, params.headers, grouplessAuthenticationProvider, fetchImpl)\n const matches = await getMatchesOrEmpty(grouplessUserApi)\n const chosenGroupId = matches.length > 1 && !!options.groupSelector ? await options.groupSelector(matches) : matches[0]?.groupId\n /*TODO\n * On new very new users switching the authentication provider to a specific group may fail and block the user for too many requests. This is\n * probably linked to replication of the user in the fallback database.\n */\n const groupSpecificAuthenticationProvider =\n matches.length > 1 && chosenGroupId\n ? await grouplessAuthenticationProvider.switchGroup(chosenGroupId, matches)\n : grouplessAuthenticationProvider\n const cryptoInitInfo = await initialiseCryptoWithProvider(host, fetchImpl, groupSpecificAuthenticationProvider, params, cryptoStrategies, crypto)\n return new IcureApiImpl(\n cryptoInitInfo,\n host,\n groupSpecificAuthenticationProvider,\n fetch,\n grouplessUserApi,\n matches,\n matches.find((match) => match.groupId === chosenGroupId),\n params,\n cryptoStrategies\n )\n }\n}\n\nasync function getAuthenticationProvider(\n host: string,\n authenticationOptions: AuthenticationDetails | AuthenticationProvider,\n headers: { [headerName: string]: string },\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n) {\n let authenticationProvider: AuthenticationProvider\n if ('getIcureTokens' in authenticationOptions && 'switchGroup' in authenticationOptions && 'getAuthService' in authenticationOptions) {\n authenticationProvider = authenticationOptions\n } else if ('icureTokens' in authenticationOptions && !!authenticationOptions.icureTokens) {\n authenticationProvider = new JwtAuthenticationProvider(\n new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl),\n authenticationOptions?.credentials?.username,\n authenticationOptions?.credentials?.password,\n undefined,\n authenticationOptions.icureTokens\n )\n } else if (\n 'username' in authenticationOptions &&\n 'password' in authenticationOptions &&\n !!authenticationOptions.username &&\n !!authenticationOptions.password\n ) {\n authenticationProvider = new EnsembleAuthenticationProvider(\n new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl),\n authenticationOptions.username,\n authenticationOptions.password,\n 3600,\n undefined,\n undefined,\n authenticationOptions.thirdPartyTokens\n )\n } else if ('thirdPartyTokens' in authenticationOptions && !!authenticationOptions.thirdPartyTokens) {\n authenticationProvider = new JwtAuthenticationProvider(\n new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl),\n undefined,\n undefined,\n new JwtBridgedAuthService(\n new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl),\n undefined,\n undefined,\n authenticationOptions.thirdPartyTokens,\n undefined\n )\n )\n } else if ('username' in authenticationOptions && 'secretProvider' in authenticationOptions) {\n authenticationProvider = SmartAuthProvider.initialise(\n new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl),\n authenticationOptions.username,\n authenticationOptions.secretProvider,\n {\n initialSecret: authenticationOptions.initialSecret,\n initialAuthToken: authenticationOptions.initialAuthToken,\n initialRefreshToken: authenticationOptions.initialRefreshToken,\n }\n )\n } else {\n throw new Error('Invalid authentication options provided')\n }\n return authenticationProvider\n}\n\n// Apis which are used during crypto api initialisation, to avoid re-instantiating them later\ntype CryptoInitialisationInfo = {\n cryptoApi: IccCryptoXApi\n healthcarePartyApi: IccHcpartyXApi\n deviceApi: IccDeviceXApi\n // no patient api since it is base\n dataOwnerApi: IccDataOwnerXApi\n userApi: IccUserXApi\n icureMaintenanceTaskApi: IccIcureMaintenanceXApi\n maintenanceTaskApi: IccMaintenanceTaskXApi\n headers: { [headerName: string]: string }\n dataOwnerRequiresAnonymousDelegation: boolean\n recoveryApi: IccRecoveryXApi\n}\n\nconst REQUEST_AUTOFIX_ANONYMITY_HEADER = 'Icure-Request-Autofix-Anonymity'\n\nasync function initialiseCryptoWithProvider(\n host: string,\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response>,\n groupSpecificAuthenticationProvider: AuthenticationProvider,\n params: IcureApiOptions.WithDefaults,\n cryptoStrategies: CryptoStrategies,\n crypto: Crypto\n): Promise<CryptoInitialisationInfo> {\n const initialDataOwnerStub = await new IccDataOwnerXApi(\n host,\n params.headers,\n groupSpecificAuthenticationProvider,\n fetchImpl\n ).getCurrentDataOwnerStub()\n const dataOwnerRequiresAnonymousDelegation = cryptoStrategies.dataOwnerRequiresAnonymousDelegation(initialDataOwnerStub)\n let updatedHeaders = params.headers\n if (!Object.keys(updatedHeaders).includes(REQUEST_AUTOFIX_ANONYMITY_HEADER)) {\n if (initialDataOwnerStub.type == DataOwnerTypeEnum.Patient || initialDataOwnerStub.type == DataOwnerTypeEnum.Device) {\n if (!dataOwnerRequiresAnonymousDelegation) {\n updatedHeaders = { ...updatedHeaders, [REQUEST_AUTOFIX_ANONYMITY_HEADER]: 'false' }\n }\n } else {\n if (dataOwnerRequiresAnonymousDelegation) {\n updatedHeaders = { ...updatedHeaders, [REQUEST_AUTOFIX_ANONYMITY_HEADER]: 'true' }\n }\n }\n }\n\n const authApi = new IccAuthApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n const userApi = new IccUserXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, authApi, fetchImpl)\n const healthcarePartyApi = new IccHcpartyXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, authApi, fetchImpl)\n const deviceApi = new IccDeviceXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, userApi, authApi, fetchImpl)\n const basePatientApi = new IccPatientApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n const dataOwnerApi = new IccDataOwnerXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n const exchangeDataApi = new IccExchangeDataApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n const baseRecoveryDataApi = new IccRecoveryDataApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n // Crypto initialisation\n const icureStorage = new IcureStorageFacade(params.keyStorage, params.storage, params.entryKeysFactory)\n const cryptoPrimitives = new CryptoPrimitives(crypto)\n const baseExchangeKeysManager = new BaseExchangeKeysManager(cryptoPrimitives, dataOwnerApi, healthcarePartyApi, basePatientApi, deviceApi)\n const baseExchangeDataManager = new BaseExchangeDataManager(exchangeDataApi, dataOwnerApi, cryptoPrimitives, dataOwnerRequiresAnonymousDelegation)\n const keyRecovery = new KeyRecovery(cryptoPrimitives, dataOwnerApi, baseExchangeKeysManager, baseExchangeDataManager)\n const recoveryDataEncryption = new RecoveryDataEncryption(cryptoPrimitives, baseRecoveryDataApi)\n const keyPairRecoverer = new KeyPairRecoverer(recoveryDataEncryption)\n const userEncryptionKeysManager = new UserEncryptionKeysManager(\n cryptoPrimitives,\n dataOwnerApi,\n icureStorage,\n keyRecovery,\n cryptoStrategies,\n !params.disableParentKeysInitialisation,\n keyPairRecoverer\n )\n const userSignatureKeysManager = new UserSignatureKeysManager(icureStorage, dataOwnerApi, cryptoPrimitives)\n const newKey = await userEncryptionKeysManager.initialiseKeys()\n await new TransferKeysManager(\n cryptoPrimitives,\n baseExchangeDataManager,\n dataOwnerApi,\n userEncryptionKeysManager,\n userSignatureKeysManager,\n icureStorage\n ).updateTransferKeys(await dataOwnerApi.getCurrentDataOwnerStub())\n // TODO customise cache size?\n const exchangeKeysManager = new ExchangeKeysManager(\n 100,\n 500,\n 600000,\n 60000,\n cryptoStrategies,\n cryptoPrimitives,\n userEncryptionKeysManager,\n baseExchangeKeysManager,\n dataOwnerApi,\n !params.disableParentKeysInitialisation,\n icureStorage\n )\n const accessControlSecretUtils = new AccessControlSecretUtils(cryptoPrimitives)\n const exchangeDataManager = await initialiseExchangeDataManagerForCurrentDataOwner(\n baseExchangeDataManager,\n userEncryptionKeysManager,\n userSignatureKeysManager,\n accessControlSecretUtils,\n cryptoStrategies,\n dataOwnerApi,\n cryptoPrimitives,\n !params.disableParentKeysInitialisation\n )\n const exchangeDataMapManager = new ExchangeDataMapManager(\n new IccExchangeDataMapApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl)\n )\n const secureDelegationsEncryption = new SecureDelegationsEncryption(userEncryptionKeysManager, cryptoPrimitives)\n const secureDelegationsSecurityMetadataEncryption = new SecureDelegationsSecurityMetadataDecryptor(\n exchangeDataManager,\n exchangeDataMapManager,\n secureDelegationsEncryption,\n dataOwnerApi\n )\n const xApiUtils = new ExtendedApisUtilsImpl(\n cryptoPrimitives,\n dataOwnerApi,\n new LegacyDelegationSecurityMetadataDecryptor(exchangeKeysManager, cryptoPrimitives),\n secureDelegationsSecurityMetadataEncryption,\n new SecureDelegationsManager(\n exchangeDataManager,\n exchangeDataMapManager,\n secureDelegationsEncryption,\n accessControlSecretUtils,\n userEncryptionKeysManager,\n cryptoPrimitives,\n dataOwnerApi,\n cryptoStrategies,\n dataOwnerRequiresAnonymousDelegation\n ),\n userApi,\n !params.disableParentKeysInitialisation\n )\n const shamirManager = new ShamirKeysManager(cryptoPrimitives, dataOwnerApi, userEncryptionKeysManager, exchangeDataManager)\n const confidentialEntitites = new ConfidentialEntities(xApiUtils, cryptoPrimitives, dataOwnerApi)\n await ensureDelegationForSelf(dataOwnerApi, xApiUtils, basePatientApi, cryptoPrimitives)\n const accessControlKeysHeadersProvider = new AccessControlKeysHeadersProvider(exchangeDataManager)\n const delegationsDeAnonymisation = new DelegationsDeAnonymization(\n dataOwnerApi,\n secureDelegationsSecurityMetadataEncryption,\n xApiUtils,\n cryptoPrimitives,\n accessControlSecretUtils,\n host,\n updatedHeaders,\n groupSpecificAuthenticationProvider,\n fetchImpl,\n accessControlKeysHeadersProvider\n )\n const cryptoApi = new IccCryptoXApi(\n exchangeKeysManager,\n cryptoPrimitives,\n userEncryptionKeysManager,\n dataOwnerApi,\n xApiUtils,\n shamirManager,\n params.storage,\n params.keyStorage,\n confidentialEntitites,\n exchangeDataManager,\n accessControlKeysHeadersProvider,\n delegationsDeAnonymisation\n )\n const maintenanceTaskApi = new IccMaintenanceTaskXApi(\n host,\n updatedHeaders,\n cryptoApi,\n healthcarePartyApi,\n dataOwnerApi,\n userApi,\n authApi,\n !dataOwnerRequiresAnonymousDelegation,\n params.encryptedFieldsConfig.maintenanceTask ?? EncryptedFieldsConfig.Defaults.maintenanceTask,\n groupSpecificAuthenticationProvider,\n fetchImpl\n )\n const icureMaintenanceTaskApi = new IccIcureMaintenanceXApi(cryptoApi, maintenanceTaskApi, dataOwnerApi, exchangeDataApi)\n\n if (newKey && params.createMaintenanceTasksOnNewKey) {\n await icureMaintenanceTaskApi.createMaintenanceTasksForNewKeypair(await userApi.getCurrentUser(), newKey.newKeyPair)\n }\n return {\n cryptoApi,\n userApi,\n healthcarePartyApi,\n deviceApi,\n maintenanceTaskApi,\n dataOwnerApi,\n icureMaintenanceTaskApi,\n headers: updatedHeaders,\n dataOwnerRequiresAnonymousDelegation,\n recoveryApi: new IccRecoveryXApi(\n baseRecoveryDataApi,\n recoveryDataEncryption,\n userEncryptionKeysManager,\n dataOwnerApi,\n cryptoPrimitives,\n exchangeDataManager\n ),\n }\n}\n\nclass IcureApiImpl implements IcureApi {\n private latestGroupsRequest: Promise<UserGroup[]>\n\n constructor(\n private readonly cryptoInitInfos: CryptoInitialisationInfo,\n private readonly host: string,\n private readonly groupSpecificAuthenticationProvider: AuthenticationProvider,\n private readonly fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>,\n private readonly grouplessUserApi: IccUserApi,\n latestMatches: UserGroup[],\n private readonly currentGroupInfo: UserGroup | undefined,\n private readonly params: IcureApiOptions.WithDefaults,\n private readonly cryptoStrategies: CryptoStrategies\n ) {\n this.latestGroupsRequest = Promise.resolve(latestMatches)\n }\n\n private _authApi: IccAuthApi | undefined\n\n get recoveryApi(): IccRecoveryXApi {\n return this.cryptoInitInfos.recoveryApi\n }\n\n get authApi(): IccAuthApi {\n return (\n this._authApi ?? (this._authApi = new IccAuthApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _codeApi: IccCodeXApi | undefined\n\n get codeApi(): IccCodeXApi {\n return (\n this._codeApi ??\n (this._codeApi = new IccCodeXApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _calendarItemTypeApi: IccCalendarItemTypeApi | undefined\n\n get calendarItemTypeApi(): IccCalendarItemTypeApi {\n return (\n this._calendarItemTypeApi ??\n (this._calendarItemTypeApi = new IccCalendarItemTypeApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _medicalLocationApi: IccMedicallocationApi | undefined\n\n get medicalLocationApi(): IccMedicallocationApi {\n return (\n this._medicalLocationApi ??\n (this._medicalLocationApi = new IccMedicallocationApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _roleApi: IccRoleApi | undefined\n\n get roleApi(): IccRoleApi {\n return this._roleApi ?? (this._roleApi = new IccRoleApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n }\n\n private _entityReferenceApi: IccEntityrefApi | undefined\n\n get entityReferenceApi(): IccEntityrefApi {\n return (\n this._entityReferenceApi ??\n (this._entityReferenceApi = new IccEntityrefApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _permissionApi: IccPermissionApi | undefined\n\n get permissionApi(): IccPermissionApi {\n return (\n this._permissionApi ??\n (this._permissionApi = new IccPermissionApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _accessLogApi: IccAccesslogXApi | undefined\n\n get accessLogApi(): IccAccesslogXApi {\n return (\n this._accessLogApi ??\n (this._accessLogApi = new IccAccesslogXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.params.encryptedFieldsConfig.accessLog ?? EncryptedFieldsConfig.Defaults.accessLog,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _agendaApi: IccAgendaApi | undefined\n\n get agendaApi(): IccAgendaApi {\n return (\n this._agendaApi ??\n (this._agendaApi = new IccAgendaApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _contactApi: IccContactXApi | undefined\n\n get contactApi(): IccContactXApi {\n return (\n this._contactApi ??\n (this._contactApi = new IccContactXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n this.userApi,\n this.authApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch,\n this.params.encryptedFieldsConfig.contact ?? EncryptedFieldsConfig.Defaults.contact,\n this.params.encryptedFieldsConfig.service ?? EncryptedFieldsConfig.Defaults.service\n ))\n )\n }\n\n private _formApi: IccFormXApi | undefined\n\n get formApi(): IccFormXApi {\n return (\n this._formApi ??\n (this._formApi = new IccFormXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _groupApi: IccGroupApi | undefined\n\n get groupApi(): IccGroupApi {\n return (\n this._groupApi ??\n (this._groupApi = new IccGroupApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _invoiceApi: IccInvoiceXApi | undefined\n\n get invoiceApi(): IccInvoiceXApi {\n return (\n this._invoiceApi ??\n (this._invoiceApi = new IccInvoiceXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.entityReferenceApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _insuranceApi: IccInsuranceApi | undefined\n\n get insuranceApi(): IccInsuranceApi {\n return (\n this._insuranceApi ??\n (this._insuranceApi = new IccInsuranceApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _documentApi: IccDocumentXApi | undefined\n\n get documentApi(): IccDocumentXApi {\n return (\n this._documentApi ??\n (this._documentApi = new IccDocumentXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.authApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _healthcareElementApi: IccHelementXApi | undefined\n\n get healthcareElementApi(): IccHelementXApi {\n return (\n this._healthcareElementApi ??\n (this._healthcareElementApi = new IccHelementXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n this.userApi,\n this.authApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.params.encryptedFieldsConfig.healthElement ?? EncryptedFieldsConfig.Defaults.healthElement,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _classificationApi: IccClassificationXApi | undefined\n\n get classificationApi(): IccClassificationXApi {\n return (\n this._classificationApi ??\n (this._classificationApi = new IccClassificationXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _calendarItemApi: IccCalendarItemXApi | undefined\n\n get calendarItemApi(): IccCalendarItemXApi {\n return (\n this._calendarItemApi ??\n (this._calendarItemApi = new IccCalendarItemXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.params.encryptedFieldsConfig.calendarItem ?? EncryptedFieldsConfig.Defaults.calendarItem,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _receiptApi: IccReceiptXApi | undefined\n\n get receiptApi(): IccReceiptXApi {\n return (\n this._receiptApi ??\n (this._receiptApi = new IccReceiptXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _timetableApi: IccTimeTableXApi | undefined\n\n get timetableApi(): IccTimeTableXApi {\n return (\n this._timetableApi ??\n (this._timetableApi = new IccTimeTableXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _patientApi: IccPatientXApi | undefined\n\n get patientApi(): IccPatientXApi {\n return (\n this._patientApi ??\n (this._patientApi = new IccPatientXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.contactApi,\n this.formApi,\n this.healthcareElementApi,\n this.invoiceApi,\n this.documentApi,\n this.healthcarePartyApi,\n this.classificationApi,\n this.dataOwnerApi,\n this.calendarItemApi,\n this.userApi,\n this.authApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.params.encryptedFieldsConfig.patient ?? EncryptedFieldsConfig.Defaults.patient,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _messageApi: IccMessageXApi | undefined\n\n get messageApi(): IccMessageXApi {\n return (\n this._messageApi ??\n (this._messageApi = new IccMessageXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n this.authApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.params.encryptedFieldsConfig.message ?? EncryptedFieldsConfig.Defaults.message,\n this.fetch\n ))\n )\n }\n\n private _topicApi: IccTopicXApi | undefined\n\n get topicApi(): IccTopicXApi {\n return (\n this._topicApi ??\n (this._topicApi = new IccTopicXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.dataOwnerApi,\n this.authApi,\n !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation,\n this.groupSpecificAuthenticationProvider,\n this.params.encryptedFieldsConfig.topic ?? EncryptedFieldsConfig.Defaults.topic,\n this.fetch\n ))\n )\n }\n\n private _anonymousAccessApi: IccAnonymousAccessApi | undefined\n\n get anonymousAccessApi(): IccAnonymousAccessApi {\n return (\n this._anonymousAccessApi ??\n (this._anonymousAccessApi = new IccAnonymousAccessApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _applicationSettingsApi: IccApplicationsettingsApi | undefined\n\n get applicationSettingsApi(): IccApplicationsettingsApi {\n return (\n this._applicationSettingsApi ??\n (this._applicationSettingsApi = new IccApplicationsettingsApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _articleApi: IccArticleApi | undefined\n\n get articleApi(): IccArticleApi {\n return (\n this._articleApi ??\n (this._articleApi = new IccArticleApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _bekmehrApi: IccBekmehrXApi | undefined\n\n get bekmehrApi(): IccBekmehrXApi {\n return (\n this._bekmehrApi ??\n (this._bekmehrApi = new IccBekmehrXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.authApi,\n this.contactApi,\n this.healthcareElementApi,\n this.documentApi,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _beefactApi: IccBeefactApi | undefined\n\n get beefactApi(): IccBeefactApi {\n return (\n this._beefactApi ??\n (this._beefactApi = new IccBeefactApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _beresultexportApi: IccBeresultexportApi | undefined\n\n get beresultexportApi(): IccBeresultexportApi {\n return (\n this._beresultexportApi ??\n (this._beresultexportApi = new IccBeresultexportApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _beresultimportApi: IccBeresultimportApi | undefined\n\n get beresultimportApi(): IccBeresultimportApi {\n return (\n this._beresultimportApi ??\n (this._beresultimportApi = new IccBeresultimportApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _besamv2Api: IccBesamv2Api | undefined\n\n get besamv2Api(): IccBesamv2Api {\n return (\n this._besamv2Api ??\n (this._besamv2Api = new IccBesamv2Api(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _classificationTemplateApi: IccClassificationTemplateApi | undefined\n\n get classificationTemplateApi(): IccClassificationTemplateApi {\n return (\n this._classificationTemplateApi ??\n (this._classificationTemplateApi = new IccClassificationTemplateApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _doctemplateApi: IccDoctemplateXApi | undefined\n\n get doctemplateApi(): IccDoctemplateXApi {\n return (\n this._doctemplateApi ??\n (this._doctemplateApi = new IccDoctemplateXApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.cryptoApi,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _entitytemplateApi: IccEntitytemplateApi | undefined\n\n get entitytemplateApi(): IccEntitytemplateApi {\n return (\n this._entitytemplateApi ??\n (this._entitytemplateApi = new IccEntitytemplateApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _frontendmigrationApi: IccFrontendmigrationApi | undefined\n\n get frontendmigrationApi(): IccFrontendmigrationApi {\n return (\n this._frontendmigrationApi ??\n (this._frontendmigrationApi = new IccFrontendmigrationApi(\n this.host,\n this.cryptoInitInfos.headers,\n this.groupSpecificAuthenticationProvider,\n this.fetch\n ))\n )\n }\n\n private _icureApi: IccIcureApi | undefined\n\n get icureApi(): IccIcureApi {\n return (\n this._icureApi ??\n (this._icureApi = new IccIcureApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _keywordApi: IccKeywordApi | undefined\n\n get keywordApi(): IccKeywordApi {\n return (\n this._keywordApi ??\n (this._keywordApi = new IccKeywordApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _medexApi: IccMedexApi | undefined\n\n get medexApi(): IccMedexApi {\n return (\n this._medexApi ??\n (this._medexApi = new IccMedexApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _placeApi: IccPlaceApi | undefined\n\n get placeApi(): IccPlaceApi {\n return (\n this._placeApi ??\n (this._placeApi = new IccPlaceApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _pubsubApi: IccPubsubApi | undefined\n\n get pubsubApi(): IccPubsubApi {\n return (\n this._pubsubApi ??\n (this._pubsubApi = new IccPubsubApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _replicationApi: IccReplicationApi | undefined\n\n get replicationApi(): IccReplicationApi {\n return (\n this._replicationApi ??\n (this._replicationApi = new IccReplicationApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _tarificationApi: IccTarificationApi | undefined\n\n get tarificationApi(): IccTarificationApi {\n return (\n this._tarificationApi ??\n (this._tarificationApi = new IccTarificationApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n private _tmpApi: IccTmpApi | undefined\n\n get tmpApi(): IccTmpApi {\n return (\n this._tmpApi ?? (this._tmpApi = new IccTmpApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch))\n )\n }\n\n get cryptoApi(): IccCryptoXApi {\n return this.cryptoInitInfos.cryptoApi\n }\n\n get dataOwnerApi(): IccDataOwnerXApi {\n return this.cryptoInitInfos.dataOwnerApi\n }\n\n get deviceApi(): IccDeviceXApi {\n return this.cryptoInitInfos.deviceApi\n }\n\n get healthcarePartyApi(): IccHcpartyXApi {\n return this.cryptoInitInfos.healthcarePartyApi\n }\n\n get icureMaintenanceTaskApi(): IccIcureMaintenanceXApi {\n return this.cryptoInitInfos.icureMaintenanceTaskApi\n }\n\n get maintenanceTaskApi(): IccMaintenanceTaskXApi {\n return this.cryptoInitInfos.maintenanceTaskApi\n }\n\n get userApi(): IccUserXApi {\n return this.cryptoInitInfos.userApi\n }\n\n async getGroupsInfo(): Promise<{ currentGroup: UserGroup | undefined; availableGroups: UserGroup[] }> {\n this.latestGroupsRequest = this.grouplessUserApi.getMatchingUsers()\n return { currentGroup: this.currentGroupInfo, availableGroups: await this.latestGroupsRequest }\n }\n\n async switchGroup(newGroupId: string): Promise<IcureApi> {\n const availableGroups = await this.latestGroupsRequest\n const switchedProvider = await this.groupSpecificAuthenticationProvider.switchGroup(newGroupId, availableGroups)\n const cryptoInitInfos = await initialiseCryptoWithProvider(\n this.host,\n this.fetch,\n switchedProvider,\n this.params,\n this.cryptoStrategies,\n this.cryptoApi.primitives.crypto\n )\n return new IcureApiImpl(\n cryptoInitInfos,\n this.host,\n switchedProvider,\n this.fetch,\n this.grouplessUserApi,\n availableGroups,\n availableGroups.find((x) => x.groupId === newGroupId)!,\n this.params,\n this.cryptoStrategies\n )\n }\n}\n\n/**\n /**\n * @experimental This function still needs development and will be changed\n * Build apis which do not need crypto and can be used by non-data-owner users\n */\nexport const BasicApis = async function (\n host: string,\n authenticationOptions: AuthenticationDetails | AuthenticationProvider,\n crypto: Crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : ({} as Crypto),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n options: { headers?: { [headerName: string]: string } } = {}\n): Promise<BasicApis> {\n const authenticationProvider = await getAuthenticationProvider(host, authenticationOptions, options.headers ?? {}, fetchImpl)\n const authApi = new IccAuthApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n\n const codeApi = new IccCodeXApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n const entityReferenceApi = new IccEntityrefApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n const userApi = new IccUserXApi(host, options.headers ?? {}, authenticationProvider, authApi, fetchImpl)\n const deviceApi = new IccDeviceXApi(host, options.headers ?? {}, authenticationProvider, userApi, authApi, fetchImpl)\n const permissionApi = new IccPermissionApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n const agendaApi = new IccAgendaApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n const groupApi = new IccGroupApi(host, options.headers ?? {}, authenticationProvider)\n const insuranceApi = new IccInsuranceApi(host, options.headers ?? {}, authenticationProvider, fetchImpl)\n const healthcarePartyApi = new IccHcpartyXApi(host, options.headers ?? {}, authenticationProvider, authApi, fetchImpl)\n\n return {\n authApi,\n deviceApi,\n codeApi,\n userApi,\n permissionApi,\n insuranceApi,\n entityReferenceApi,\n agendaApi,\n groupApi,\n healthcarePartyApi,\n }\n}\n\nasync function getMatchesOrEmpty(userApi: IccUserApi): Promise<UserGroup[]> {\n try {\n return await userApi.getMatchingUsers()\n } catch (err) {\n if (err instanceof Error && 'statusCode' in err && (err as any).statusCode === 404) return Promise.resolve([])\n else return Promise.reject(err)\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icure/api",
3
- "version": "8.0.11",
3
+ "version": "8.0.13",
4
4
  "description": "Typescript version of iCure standalone API client",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",