@icure/api 4.2.33 → 4.2.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/icc-api/api/IccAuthApi.d.ts +6 -0
- package/icc-api/api/IccAuthApi.js +15 -0
- package/icc-api/api/IccAuthApi.js.map +1 -1
- package/icc-api/api/XHR.js +1 -1
- package/icc-api/api/XHR.js.map +1 -1
- package/icc-api/iccApi.js +5 -1
- package/icc-api/iccApi.js.map +1 -1
- package/icc-api/index.js +5 -1
- package/icc-api/index.js.map +1 -1
- package/icc-api/model/Body.js +1 -1
- package/icc-api/model/Body.js.map +1 -1
- package/icc-api/model/Body1.js +1 -1
- package/icc-api/model/Body1.js.map +1 -1
- package/icc-api/model/Body2.js +1 -1
- package/icc-api/model/Body2.js.map +1 -1
- package/icc-api/model/Body3.js +1 -1
- package/icc-api/model/Body3.js.map +1 -1
- package/icc-api/model/ByteArray.js +1 -1
- package/icc-api/model/ByteArray.js.map +1 -1
- package/icc-api/model/Content.js +1 -1
- package/icc-api/model/Content.js.map +1 -1
- package/icc-api/model/Device.js +1 -1
- package/icc-api/model/Device.js.map +1 -1
- package/icc-api/model/Document.js +1 -1
- package/icc-api/model/Document.js.map +1 -1
- package/icc-api/model/DocumentTemplate.js +1 -1
- package/icc-api/model/DocumentTemplate.js.map +1 -1
- package/icc-api/model/HealthcareParty.js +1 -1
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-api/model/MimeAttachment.js +1 -1
- package/icc-api/model/MimeAttachment.js.map +1 -1
- package/icc-api/model/Patient.js +1 -1
- package/icc-api/model/Patient.js.map +1 -1
- package/icc-api/model/models.js +5 -1
- package/icc-api/model/models.js.map +1 -1
- package/icc-x-api/crypto/AES.js +1 -1
- package/icc-x-api/crypto/AES.js.map +1 -1
- package/icc-x-api/crypto/utils.js +37 -36
- package/icc-x-api/crypto/utils.js.map +1 -1
- package/icc-x-api/filters/filters.js +7 -3
- package/icc-x-api/filters/filters.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.d.ts +3 -3
- package/icc-x-api/icc-accesslog-x-api.js +15 -15
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-bekmehr-x-api.js +2 -2
- package/icc-x-api/icc-bekmehr-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +3 -3
- package/icc-x-api/icc-calendar-item-x-api.js +17 -17
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +3 -3
- package/icc-x-api/icc-classification-x-api.js +4 -4
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +3 -3
- package/icc-x-api/icc-contact-x-api.js +27 -27
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +4 -2
- package/icc-x-api/icc-crypto-x-api.js +50 -48
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-data-owner-x-api.d.ts +14 -0
- package/icc-x-api/icc-data-owner-x-api.js +44 -0
- package/icc-x-api/icc-data-owner-x-api.js.map +1 -0
- package/icc-x-api/icc-doctemplate-x-api.js +2 -2
- package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +3 -3
- package/icc-x-api/icc-document-x-api.js +8 -8
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +3 -3
- package/icc-x-api/icc-form-x-api.js +8 -8
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-hcparty-x-api.js +4 -4
- package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +3 -3
- package/icc-x-api/icc-helement-x-api.js +15 -15
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +3 -3
- package/icc-x-api/icc-invoice-x-api.js +5 -5
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.d.ts +6 -3
- package/icc-x-api/icc-maintenance-task-x-api.js +26 -12
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +3 -3
- package/icc-x-api/icc-message-x-api.js +4 -4
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +3 -3
- package/icc-x-api/icc-patient-x-api.js +44 -44
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +3 -3
- package/icc-x-api/icc-receipt-x-api.js +5 -5
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.d.ts +3 -3
- package/icc-x-api/icc-time-table-x-api.js +5 -5
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/icc-user-x-api.d.ts +0 -2
- package/icc-x-api/icc-user-x-api.js +0 -8
- package/icc-x-api/icc-user-x-api.js.map +1 -1
- package/icc-x-api/index.d.ts +3 -1
- package/icc-x-api/index.js +29 -20
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/utils/binary-utils.js +5 -5
- package/icc-x-api/utils/binary-utils.js.map +1 -1
- package/icc-x-api/utils/formatting-util.js +3 -3
- package/icc-x-api/utils/formatting-util.js.map +1 -1
- package/icc-x-api/utils/index.js +5 -1
- package/icc-x-api/utils/index.js.map +1 -1
- package/icc-x-api/utils/uuid-encoder.js +2 -0
- package/icc-x-api/utils/uuid-encoder.js.map +1 -1
- package/index.js +5 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Patient.js","sourceRoot":"","sources":["../../../icc-api/model/Patient.ts"],"names":[],"mappings":";;;AAyBA;;GAEG;AACH,+CAAuC;AACvC,MAAa,OAAO;IAClB,YAAY,IAAg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,EAAE,UAAgC;QAC1C,UAAU,EAAE,YAAkC;KAC/C,CAAA;AACH,CAAC,EA9DgB,OAAO,GAAP,eAAO,KAAP,eAAO,QA8DvB","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 { Address } from './Address'\nimport { CodeStub } from './CodeStub'\nimport { Delegation } from './Delegation'\nimport { EmploymentInfo } from './EmploymentInfo'\nimport { FinancialInstitutionInformation } from './FinancialInstitutionInformation'\nimport { Identifier } from './Identifier'\nimport { Insurability } from './Insurability'\nimport { MedicalHouseContract } from './MedicalHouseContract'\nimport { Partnership } from './Partnership'\nimport { PatientHealthCareParty } from './PatientHealthCareParty'\nimport { PersonName } from './PersonName'\nimport { PropertyStub } from './PropertyStub'\nimport { SchoolingInfo } from './SchoolingInfo'\n\n/**\n * This entity is a root level object. It represents a patient It is serialized in JSON and saved in the underlying icure-patient CouchDB database.\n */\nimport { b64_2ab } from './ModelHelper'\nexport class Patient {\n constructor(json: JSON | any) {\n Object.assign(this as Patient, json, json.picture ? { picture: b64_2ab(json.picture) } : {})\n }\n\n /**\n * the Id of the patient. We encourage using either a v4 UUID or a HL7 Id.\n */\n id?: string\n /**\n * the revision of the patient in the database, used for conflict management / optimistic locking.\n */\n rev?: string\n identifier?: Array<Identifier>\n /**\n * The timestamp (unix epoch in ms) of creation of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n created?: number\n /**\n * The date (unix epoch in ms) of the latest modification of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n modified?: number\n /**\n * The id of the User that has created this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n author?: string\n /**\n * The id of the HealthcareParty that is responsible for this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n responsible?: string\n /**\n * A tag is an item from a codification system that qualifies an entity as being member of a certain class, whatever the value it might have taken. If the tag qualifies the content of a field, it means that whatever the content of the field, the tag will always apply. For example, the label of a field is qualified using a tag. LOINC is a codification system typically used for tags.\n */\n tags?: Array<CodeStub>\n /**\n * A code is an item from a codification system that qualifies the content of this entity. SNOMED-CT, ICPC-2 or ICD-10 codifications systems can be used for codes\n */\n codes?: Array<CodeStub>\n /**\n * Soft delete (unix epoch in ms) timestamp of the object.\n */\n endOfLife?: number\n /**\n * hard delete (unix epoch in ms) timestamp of the object. Filled automatically when deletePatient is called.\n */\n deletionDate?: number\n /**\n * the firstname (name) of the patient.\n */\n firstName?: string\n /**\n * the lastname (surname) of the patient. This is the official lastname that should be used for official administrative purposes.\n */\n lastName?: string\n /**\n * the list of all names of the patient, also containing the official full name information. Ordered by preference of use. First element is therefore the official name used for the patient in the application\n */\n names?: Array<PersonName>\n /**\n * the name of the company this patient is member of.\n */\n companyName?: string\n /**\n * the list of languages spoken by the patient ordered by fluency (alpha-2 code http://www.loc.gov/standards/iso639-2/ascii_8bits.html).\n */\n languages?: Array<string>\n /**\n * the list of addresses (with address type).\n */\n addresses?: Array<Address>\n /**\n * Mr., Ms., Pr., Dr. ...\n */\n civility?: string\n /**\n * the gender of the patient: male, female, indeterminate, changed, changedToMale, changedToFemale, unknown\n */\n gender?: Patient.GenderEnum\n /**\n * the birth sex of the patient: male, female, indeterminate, unknown\n */\n birthSex?: Patient.BirthSexEnum\n /**\n * The id of the patient this patient has been merged with.\n */\n mergeToPatientId?: string\n /**\n * The ids of the patients that have been merged inside this patient.\n */\n mergedIds?: Array<string>\n /**\n * An alias of the person, nickname, ...\n */\n alias?: string\n /**\n * Is the patient active (boolean).\n */\n active?: boolean\n /**\n * When not active, the reason for deactivation.\n */\n deactivationReason?: Patient.DeactivationReasonEnum\n /**\n * Social security inscription number.\n */\n ssin?: string\n /**\n * Lastname at birth (can be different of the current name), depending on the country, must be used to design the patient .\n */\n maidenName?: string\n /**\n * Lastname of the spouse for a married woman, depending on the country, can be used to design the patient.\n */\n spouseName?: string\n /**\n * Lastname of the partner, should not be used to design the patient.\n */\n partnerName?: string\n /**\n * any of `single`, `in_couple`, `married`, `separated`, `divorced`, `divorcing`, `widowed`, `widower`, `complicated`, `unknown`, `contract`, `other`.\n */\n personalStatus?: Patient.PersonalStatusEnum\n /**\n * The birthdate encoded as a fuzzy date on 8 positions (YYYYMMDD) MM and/or DD can be set to 00 if unknown (19740000 is a valid date).\n */\n dateOfBirth?: number\n /**\n * The date of death encoded as a fuzzy date on 8 positions (YYYYMMDD) MM and/or DD can be set to 00 if unknown (19740000 is a valid date).\n */\n dateOfDeath?: number\n /**\n * Timestamp of the latest validation of the eID of the person..\n */\n timestampOfLatestEidReading?: number\n /**\n * The place of birth.\n */\n placeOfBirth?: string\n /**\n * The place of death.\n */\n placeOfDeath?: string\n /**\n * Is the patient deceased.\n */\n deceased?: boolean\n /**\n * The level of education (college degree, undergraduate, phd).\n */\n education?: string\n /**\n * The current professional activity.\n */\n profession?: string\n /**\n * A text note (can be confidential, encrypted by default).\n */\n note?: string\n /**\n * An administrative note, not confidential.\n */\n administrativeNote?: string\n /**\n * The nationality of the patient.\n */\n nationality?: string\n /**\n * The race of the patient.\n */\n race?: string\n /**\n * The ethnicity of the patient.\n */\n ethnicity?: string\n /**\n * The id of the user that usually handles this patient.\n */\n preferredUserId?: string\n /**\n * A picture usually saved in JPEG format.\n */\n picture?: ArrayBuffer\n /**\n * An external (from another source) id with no guarantee or requirement for unicity .\n */\n externalId?: string\n /**\n * List of insurance coverages (of class Insurability, see below).\n */\n insurabilities?: Array<Insurability>\n /**\n * List of partners, or persons of contact (of class Partnership, see below).\n */\n partnerships?: Array<Partnership>\n /**\n * Links (usually for therapeutic reasons) between this patient and healthcare parties (of class PatientHealthcareParty).\n */\n patientHealthCareParties?: Array<PatientHealthCareParty>\n /**\n * Financial information (Bank, bank account) used to reimburse the patient.\n */\n financialInstitutionInformation?: Array<FinancialInstitutionInformation>\n /**\n * Contracts between the patient and the healthcare entity.\n */\n medicalHouseContracts?: Array<MedicalHouseContract>\n /**\n * Codified list of professions exercised by this patient.\n */\n patientProfessions?: Array<CodeStub>\n /**\n * Extra parameters\n */\n parameters?: { [key: string]: Array<string> }\n /**\n * Extra properties\n */\n properties?: Array<PropertyStub>\n /**\n * For each couple of HcParties (delegator and delegate), this map contains the exchange AES key. The delegator is always this hcp, the key of the map is the id of the delegate.The AES exchange key is encrypted using RSA twice : once using this hcp public key (index 0 in the Array) and once using the other hcp public key (index 1 in the Array). For a pair of HcParties. Each HcParty always has one AES exchange key for himself.\n */\n hcPartyKeys?: { [key: string]: Array<string> }\n /**\n * Extra AES exchange keys, usually the ones we lost access to at some point. The structure is { publicKey: { delegateId: { myPubKey1: aesExKey_for_this, delegatePubKey1: aesExKey_for_delegate } } }\n */\n aesExchangeKeys?: { [key: string]: { [key: string]: { [key: string]: string } } }\n /**\n * Our private keys encrypted with our public keys. The structure is { publicKey1: { publicKey2: privateKey2_encrypted_with_publicKey1, publicKey3: privateKey3_encrypted_with_publicKey1 } }\n */\n transferKeys?: { [key: string]: { [key: string]: string } }\n /**\n * The privateKeyShamirPartitions are used to share this hcp's private RSA key with a series of other hcParties using Shamir's algorithm. The key of the map is the hcp Id with whom this partition has been shared. The value is \\\"threshold⎮partition in hex\\\" encrypted using the the partition's holder's public RSA key\n */\n privateKeyShamirPartitions?: { [key: string]: string }\n /**\n * The public key of this hcp\n */\n publicKey?: string\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find all contacts for a specific patient. These keys are in clear. You can have several to partition the medical document space.\n */\n secretForeignKeys?: Array<string>\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find the patient for a specific contact. These keys are the encrypted id (using the hcParty key for the delegate) that can be found in clear inside the patient. ids encrypted using the hcParty keys.\n */\n cryptedForeignKeys?: { [key: string]: Array<Delegation> }\n /**\n * When a document is created, the responsible generates a cryptographically random master key (never to be used for something else than referencing from other entities). He/she encrypts it using his own AES exchange key and stores it as a delegation. The responsible is thus always in the delegations as well\n */\n delegations?: { [key: string]: Array<Delegation> }\n /**\n * When a document needs to be encrypted, the responsible generates a cryptographically random master key (different from the delegation key, never to appear in clear anywhere in the db. He/she encrypts it using his own AES exchange key and stores it as a delegation\n */\n encryptionKeys?: { [key: string]: Array<Delegation> }\n /**\n * The base64 encoded data of this object, formatted as JSON and encrypted in AES using the random master key from encryptionKeys.\n */\n encryptedSelf?: string\n /**\n * The id of the medical location where this entity was created.\n */\n medicalLocationId?: string\n nonDuplicateIds?: Array<string>\n encryptedAdministrativesDocuments?: Array<string>\n comment?: string\n warning?: string\n fatherBirthCountry?: CodeStub\n birthCountry?: CodeStub\n nativeCountry?: CodeStub\n socialStatus?: CodeStub\n mainSourceOfIncome?: CodeStub\n schoolingInfos?: Array<SchoolingInfo>\n employementInfos?: Array<EmploymentInfo>\n}\nexport namespace Patient {\n export type GenderEnum = 'male' | 'female' | 'indeterminate' | 'changed' | 'changedToMale' | 'changedToFemale' | 'unknown'\n export const GenderEnum = {\n Male: 'male' as GenderEnum,\n Female: 'female' as GenderEnum,\n Indeterminate: 'indeterminate' as GenderEnum,\n Changed: 'changed' as GenderEnum,\n ChangedToMale: 'changedToMale' as GenderEnum,\n ChangedToFemale: 'changedToFemale' as GenderEnum,\n Unknown: 'unknown' as GenderEnum,\n }\n export type BirthSexEnum = 'male' | 'female' | 'indeterminate' | 'changed' | 'changedToMale' | 'changedToFemale' | 'unknown'\n export const BirthSexEnum = {\n Male: 'male' as BirthSexEnum,\n Female: 'female' as BirthSexEnum,\n Indeterminate: 'indeterminate' as BirthSexEnum,\n Changed: 'changed' as BirthSexEnum,\n ChangedToMale: 'changedToMale' as BirthSexEnum,\n ChangedToFemale: 'changedToFemale' as BirthSexEnum,\n Unknown: 'unknown' as BirthSexEnum,\n }\n export type DeactivationReasonEnum = 'deceased' | 'moved' | 'other_doctor' | 'retired' | 'no_contact' | 'unknown' | 'none'\n export const DeactivationReasonEnum = {\n Deceased: 'deceased' as DeactivationReasonEnum,\n Moved: 'moved' as DeactivationReasonEnum,\n OtherDoctor: 'other_doctor' as DeactivationReasonEnum,\n Retired: 'retired' as DeactivationReasonEnum,\n NoContact: 'no_contact' as DeactivationReasonEnum,\n Unknown: 'unknown' as DeactivationReasonEnum,\n None: 'none' as DeactivationReasonEnum,\n }\n export type PersonalStatusEnum =\n | 'single'\n | 'in_couple'\n | 'married'\n | 'separated'\n | 'divorced'\n | 'divorcing'\n | 'widowed'\n | 'widower'\n | 'complicated'\n | 'unknown'\n | 'contract'\n | 'other'\n | 'annulled'\n | 'polygamous'\n export const PersonalStatusEnum = {\n Single: 'single' as PersonalStatusEnum,\n InCouple: 'in_couple' as PersonalStatusEnum,\n Married: 'married' as PersonalStatusEnum,\n Separated: 'separated' as PersonalStatusEnum,\n Divorced: 'divorced' as PersonalStatusEnum,\n Divorcing: 'divorcing' as PersonalStatusEnum,\n Widowed: 'widowed' as PersonalStatusEnum,\n Widower: 'widower' as PersonalStatusEnum,\n Complicated: 'complicated' as PersonalStatusEnum,\n Unknown: 'unknown' as PersonalStatusEnum,\n Contract: 'contract' as PersonalStatusEnum,\n Other: 'other' as PersonalStatusEnum,\n Annulled: 'annulled' as PersonalStatusEnum,\n Polygamous: 'polygamous' as PersonalStatusEnum,\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Patient.js","sourceRoot":"","sources":["../../../icc-api/model/Patient.ts"],"names":[],"mappings":";;;AAyBA;;GAEG;AACH,+CAAuC;AACvC,MAAa,OAAO;IAClB,YAAY,IAAgB;QAC1B,MAAM,CAAC,MAAM,CAAC,IAAe,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAC9F,CAAC;CA8QF;AAjRD,0BAiRC;AACD,WAAiB,OAAO;IAET,kBAAU,GAAG;QACxB,IAAI,EAAE,MAAoB;QAC1B,MAAM,EAAE,QAAsB;QAC9B,aAAa,EAAE,eAA6B;QAC5C,OAAO,EAAE,SAAuB;QAChC,aAAa,EAAE,eAA6B;QAC5C,eAAe,EAAE,iBAA+B;QAChD,OAAO,EAAE,SAAuB;KACjC,CAAA;IAEY,oBAAY,GAAG;QAC1B,IAAI,EAAE,MAAsB;QAC5B,MAAM,EAAE,QAAwB;QAChC,aAAa,EAAE,eAA+B;QAC9C,OAAO,EAAE,SAAyB;QAClC,aAAa,EAAE,eAA+B;QAC9C,eAAe,EAAE,iBAAiC;QAClD,OAAO,EAAE,SAAyB;KACnC,CAAA;IAEY,8BAAsB,GAAG;QACpC,QAAQ,EAAE,UAAoC;QAC9C,KAAK,EAAE,OAAiC;QACxC,WAAW,EAAE,cAAwC;QACrD,OAAO,EAAE,SAAmC;QAC5C,SAAS,EAAE,YAAsC;QACjD,OAAO,EAAE,SAAmC;QAC5C,IAAI,EAAE,MAAgC;KACvC,CAAA;IAgBY,0BAAkB,GAAG;QAChC,MAAM,EAAE,QAA8B;QACtC,QAAQ,EAAE,WAAiC;QAC3C,OAAO,EAAE,SAA+B;QACxC,SAAS,EAAE,WAAiC;QAC5C,QAAQ,EAAE,UAAgC;QAC1C,SAAS,EAAE,WAAiC;QAC5C,OAAO,EAAE,SAA+B;QACxC,OAAO,EAAE,SAA+B;QACxC,WAAW,EAAE,aAAmC;QAChD,OAAO,EAAE,SAA+B;QACxC,QAAQ,EAAE,UAAgC;QAC1C,KAAK,EAAE,OAA6B;QACpC,QAAQ,EAAE,UAAgC;QAC1C,UAAU,EAAE,YAAkC;KAC/C,CAAA;AACH,CAAC,EA9DgB,OAAO,GAAP,eAAO,KAAP,eAAO,QA8DvB","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 { Address } from './Address'\nimport { CodeStub } from './CodeStub'\nimport { Delegation } from './Delegation'\nimport { EmploymentInfo } from './EmploymentInfo'\nimport { FinancialInstitutionInformation } from './FinancialInstitutionInformation'\nimport { Identifier } from './Identifier'\nimport { Insurability } from './Insurability'\nimport { MedicalHouseContract } from './MedicalHouseContract'\nimport { Partnership } from './Partnership'\nimport { PatientHealthCareParty } from './PatientHealthCareParty'\nimport { PersonName } from './PersonName'\nimport { PropertyStub } from './PropertyStub'\nimport { SchoolingInfo } from './SchoolingInfo'\n\n/**\n * This entity is a root level object. It represents a patient It is serialized in JSON and saved in the underlying icure-patient CouchDB database.\n */\nimport { b64_2ab } from './ModelHelper'\nexport class Patient {\n constructor(json: JSON | any) {\n Object.assign(this as Patient, json, json.picture ? { picture: b64_2ab(json.picture) } : {})\n }\n\n /**\n * the Id of the patient. We encourage using either a v4 UUID or a HL7 Id.\n */\n id?: string\n /**\n * the revision of the patient in the database, used for conflict management / optimistic locking.\n */\n rev?: string\n identifier?: Array<Identifier>\n /**\n * The timestamp (unix epoch in ms) of creation of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n created?: number\n /**\n * The date (unix epoch in ms) of the latest modification of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n modified?: number\n /**\n * The id of the User that has created this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n author?: string\n /**\n * The id of the HealthcareParty that is responsible for this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n responsible?: string\n /**\n * A tag is an item from a codification system that qualifies an entity as being member of a certain class, whatever the value it might have taken. If the tag qualifies the content of a field, it means that whatever the content of the field, the tag will always apply. For example, the label of a field is qualified using a tag. LOINC is a codification system typically used for tags.\n */\n tags?: Array<CodeStub>\n /**\n * A code is an item from a codification system that qualifies the content of this entity. SNOMED-CT, ICPC-2 or ICD-10 codifications systems can be used for codes\n */\n codes?: Array<CodeStub>\n /**\n * Soft delete (unix epoch in ms) timestamp of the object.\n */\n endOfLife?: number\n /**\n * hard delete (unix epoch in ms) timestamp of the object. Filled automatically when deletePatient is called.\n */\n deletionDate?: number\n /**\n * the firstname (name) of the patient.\n */\n firstName?: string\n /**\n * the lastname (surname) of the patient. This is the official lastname that should be used for official administrative purposes.\n */\n lastName?: string\n /**\n * the list of all names of the patient, also containing the official full name information. Ordered by preference of use. First element is therefore the official name used for the patient in the application\n */\n names?: Array<PersonName>\n /**\n * the name of the company this patient is member of.\n */\n companyName?: string\n /**\n * the list of languages spoken by the patient ordered by fluency (alpha-2 code http://www.loc.gov/standards/iso639-2/ascii_8bits.html).\n */\n languages?: Array<string>\n /**\n * the list of addresses (with address type).\n */\n addresses?: Array<Address>\n /**\n * Mr., Ms., Pr., Dr. ...\n */\n civility?: string\n /**\n * the gender of the patient: male, female, indeterminate, changed, changedToMale, changedToFemale, unknown\n */\n gender?: Patient.GenderEnum\n /**\n * the birth sex of the patient: male, female, indeterminate, unknown\n */\n birthSex?: Patient.BirthSexEnum\n /**\n * The id of the patient this patient has been merged with.\n */\n mergeToPatientId?: string\n /**\n * The ids of the patients that have been merged inside this patient.\n */\n mergedIds?: Array<string>\n /**\n * An alias of the person, nickname, ...\n */\n alias?: string\n /**\n * Is the patient active (boolean).\n */\n active?: boolean\n /**\n * When not active, the reason for deactivation.\n */\n deactivationReason?: Patient.DeactivationReasonEnum\n /**\n * Social security inscription number.\n */\n ssin?: string\n /**\n * Lastname at birth (can be different of the current name), depending on the country, must be used to design the patient .\n */\n maidenName?: string\n /**\n * Lastname of the spouse for a married woman, depending on the country, can be used to design the patient.\n */\n spouseName?: string\n /**\n * Lastname of the partner, should not be used to design the patient.\n */\n partnerName?: string\n /**\n * any of `single`, `in_couple`, `married`, `separated`, `divorced`, `divorcing`, `widowed`, `widower`, `complicated`, `unknown`, `contract`, `other`.\n */\n personalStatus?: Patient.PersonalStatusEnum\n /**\n * The birthdate encoded as a fuzzy date on 8 positions (YYYYMMDD) MM and/or DD can be set to 00 if unknown (19740000 is a valid date).\n */\n dateOfBirth?: number\n /**\n * The date of death encoded as a fuzzy date on 8 positions (YYYYMMDD) MM and/or DD can be set to 00 if unknown (19740000 is a valid date).\n */\n dateOfDeath?: number\n /**\n * Timestamp of the latest validation of the eID of the person..\n */\n timestampOfLatestEidReading?: number\n /**\n * The place of birth.\n */\n placeOfBirth?: string\n /**\n * The place of death.\n */\n placeOfDeath?: string\n /**\n * Is the patient deceased.\n */\n deceased?: boolean\n /**\n * The level of education (college degree, undergraduate, phd).\n */\n education?: string\n /**\n * The current professional activity.\n */\n profession?: string\n /**\n * A text note (can be confidential, encrypted by default).\n */\n note?: string\n /**\n * An administrative note, not confidential.\n */\n administrativeNote?: string\n /**\n * The nationality of the patient.\n */\n nationality?: string\n /**\n * The race of the patient.\n */\n race?: string\n /**\n * The ethnicity of the patient.\n */\n ethnicity?: string\n /**\n * The id of the user that usually handles this patient.\n */\n preferredUserId?: string\n /**\n * A picture usually saved in JPEG format.\n */\n picture?: ArrayBuffer\n /**\n * An external (from another source) id with no guarantee or requirement for unicity .\n */\n externalId?: string\n /**\n * List of insurance coverages (of class Insurability, see below).\n */\n insurabilities?: Array<Insurability>\n /**\n * List of partners, or persons of contact (of class Partnership, see below).\n */\n partnerships?: Array<Partnership>\n /**\n * Links (usually for therapeutic reasons) between this patient and healthcare parties (of class PatientHealthcareParty).\n */\n patientHealthCareParties?: Array<PatientHealthCareParty>\n /**\n * Financial information (Bank, bank account) used to reimburse the patient.\n */\n financialInstitutionInformation?: Array<FinancialInstitutionInformation>\n /**\n * Contracts between the patient and the healthcare entity.\n */\n medicalHouseContracts?: Array<MedicalHouseContract>\n /**\n * Codified list of professions exercised by this patient.\n */\n patientProfessions?: Array<CodeStub>\n /**\n * Extra parameters\n */\n parameters?: { [key: string]: Array<string> }\n /**\n * Extra properties\n */\n properties?: Array<PropertyStub>\n /**\n * For each couple of HcParties (delegator and delegate), this map contains the exchange AES key. The delegator is always this hcp, the key of the map is the id of the delegate.The AES exchange key is encrypted using RSA twice : once using this hcp public key (index 0 in the Array) and once using the other hcp public key (index 1 in the Array). For a pair of HcParties. Each HcParty always has one AES exchange key for himself.\n */\n hcPartyKeys?: { [key: string]: Array<string> }\n /**\n * Extra AES exchange keys, usually the ones we lost access to at some point. The structure is { publicKey: { delegateId: { myPubKey1: aesExKey_for_this, delegatePubKey1: aesExKey_for_delegate } } }\n */\n aesExchangeKeys?: { [key: string]: { [key: string]: { [key: string]: string } } }\n /**\n * Our private keys encrypted with our public keys. The structure is { publicKey1: { publicKey2: privateKey2_encrypted_with_publicKey1, publicKey3: privateKey3_encrypted_with_publicKey1 } }\n */\n transferKeys?: { [key: string]: { [key: string]: string } }\n /**\n * The privateKeyShamirPartitions are used to share this hcp's private RSA key with a series of other hcParties using Shamir's algorithm. The key of the map is the hcp Id with whom this partition has been shared. The value is \\\"threshold⎮partition in hex\\\" encrypted using the the partition's holder's public RSA key\n */\n privateKeyShamirPartitions?: { [key: string]: string }\n /**\n * The public key of this hcp\n */\n publicKey?: string\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find all contacts for a specific patient. These keys are in clear. You can have several to partition the medical document space.\n */\n secretForeignKeys?: Array<string>\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find the patient for a specific contact. These keys are the encrypted id (using the hcParty key for the delegate) that can be found in clear inside the patient. ids encrypted using the hcParty keys.\n */\n cryptedForeignKeys?: { [key: string]: Array<Delegation> }\n /**\n * When a document is created, the responsible generates a cryptographically random master key (never to be used for something else than referencing from other entities). He/she encrypts it using his own AES exchange key and stores it as a delegation. The responsible is thus always in the delegations as well\n */\n delegations?: { [key: string]: Array<Delegation> }\n /**\n * When a document needs to be encrypted, the responsible generates a cryptographically random master key (different from the delegation key, never to appear in clear anywhere in the db. He/she encrypts it using his own AES exchange key and stores it as a delegation\n */\n encryptionKeys?: { [key: string]: Array<Delegation> }\n /**\n * The base64 encoded data of this object, formatted as JSON and encrypted in AES using the random master key from encryptionKeys.\n */\n encryptedSelf?: string\n /**\n * The id of the medical location where this entity was created.\n */\n medicalLocationId?: string\n nonDuplicateIds?: Array<string>\n encryptedAdministrativesDocuments?: Array<string>\n comment?: string\n warning?: string\n fatherBirthCountry?: CodeStub\n birthCountry?: CodeStub\n nativeCountry?: CodeStub\n socialStatus?: CodeStub\n mainSourceOfIncome?: CodeStub\n schoolingInfos?: Array<SchoolingInfo>\n employementInfos?: Array<EmploymentInfo>\n}\nexport namespace Patient {\n export type GenderEnum = 'male' | 'female' | 'indeterminate' | 'changed' | 'changedToMale' | 'changedToFemale' | 'unknown'\n export const GenderEnum = {\n Male: 'male' as GenderEnum,\n Female: 'female' as GenderEnum,\n Indeterminate: 'indeterminate' as GenderEnum,\n Changed: 'changed' as GenderEnum,\n ChangedToMale: 'changedToMale' as GenderEnum,\n ChangedToFemale: 'changedToFemale' as GenderEnum,\n Unknown: 'unknown' as GenderEnum,\n }\n export type BirthSexEnum = 'male' | 'female' | 'indeterminate' | 'changed' | 'changedToMale' | 'changedToFemale' | 'unknown'\n export const BirthSexEnum = {\n Male: 'male' as BirthSexEnum,\n Female: 'female' as BirthSexEnum,\n Indeterminate: 'indeterminate' as BirthSexEnum,\n Changed: 'changed' as BirthSexEnum,\n ChangedToMale: 'changedToMale' as BirthSexEnum,\n ChangedToFemale: 'changedToFemale' as BirthSexEnum,\n Unknown: 'unknown' as BirthSexEnum,\n }\n export type DeactivationReasonEnum = 'deceased' | 'moved' | 'other_doctor' | 'retired' | 'no_contact' | 'unknown' | 'none'\n export const DeactivationReasonEnum = {\n Deceased: 'deceased' as DeactivationReasonEnum,\n Moved: 'moved' as DeactivationReasonEnum,\n OtherDoctor: 'other_doctor' as DeactivationReasonEnum,\n Retired: 'retired' as DeactivationReasonEnum,\n NoContact: 'no_contact' as DeactivationReasonEnum,\n Unknown: 'unknown' as DeactivationReasonEnum,\n None: 'none' as DeactivationReasonEnum,\n }\n export type PersonalStatusEnum =\n | 'single'\n | 'in_couple'\n | 'married'\n | 'separated'\n | 'divorced'\n | 'divorcing'\n | 'widowed'\n | 'widower'\n | 'complicated'\n | 'unknown'\n | 'contract'\n | 'other'\n | 'annulled'\n | 'polygamous'\n export const PersonalStatusEnum = {\n Single: 'single' as PersonalStatusEnum,\n InCouple: 'in_couple' as PersonalStatusEnum,\n Married: 'married' as PersonalStatusEnum,\n Separated: 'separated' as PersonalStatusEnum,\n Divorced: 'divorced' as PersonalStatusEnum,\n Divorcing: 'divorcing' as PersonalStatusEnum,\n Widowed: 'widowed' as PersonalStatusEnum,\n Widower: 'widower' as PersonalStatusEnum,\n Complicated: 'complicated' as PersonalStatusEnum,\n Unknown: 'unknown' as PersonalStatusEnum,\n Contract: 'contract' as PersonalStatusEnum,\n Other: 'other' as PersonalStatusEnum,\n Annulled: 'annulled' as PersonalStatusEnum,\n Polygamous: 'polygamous' as PersonalStatusEnum,\n }\n}\n"]}
|
package/icc-api/model/models.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../icc-api/model/models.ts"],"names":[],"mappings":";;;;;;;;;;;;AAA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zB,wCAAqB;AACrB,yCAAsB;AACtB,4CAAyB","sourcesContent":["export * from './AbstractFilterCode'\nexport * from './AbstractFilterContact'\nexport * from './AbstractFilterDevice'\nexport * from './AbstractFilterHealthElement'\nexport * from './AbstractFilterHealthcareParty'\nexport * from './AbstractFilterInvoice'\nexport * from './AbstractFilterMaintenanceTask'\nexport * from './AbstractFilterPatient'\nexport * from './AbstractFilterService'\nexport * from './AbstractFilterUser'\nexport * from './AccessLog'\nexport * from './AddedDocument'\nexport * from './Address'\nexport * from './AdministrationQuantity'\nexport * from './Agenda'\nexport * from './AgreementAppendix'\nexport * from './Amp'\nexport * from './AmpComponent'\nexport * from './Ampp'\nexport * from './AmppComponent'\nexport * from './Annotation'\nexport * from './ApplicationSettings'\nexport * from './AppointmentTypeAndPlace'\nexport * from './Article'\nexport * from './Atc'\nexport * from './AuthenticationResponse'\nexport * from './AuthenticationToken'\nexport * from './Basic'\nexport * from './Body'\nexport * from './Body1'\nexport * from './CalendarItem'\nexport * from './CalendarItemTag'\nexport * from './CalendarItemType'\nexport * from './CareTeamMember'\nexport * from './CareTeamMembership'\nexport * from './CheckSMFPatientResult'\nexport * from './Classification'\nexport * from './ClassificationTemplate'\nexport * from './Code'\nexport * from './CodeStub'\nexport * from './CommentedClassification'\nexport * from './Commercialization'\nexport * from './Company'\nexport * from './Contact'\nexport * from './Content'\nexport * from './Copayment'\nexport * from './Data'\nexport * from './DataOwnerRegistrationSuccess'\nexport * from './DatabaseInfo'\nexport * from './DatabaseInitialisation'\nexport * from './DatabaseSynchronization'\nexport * from './Delegation'\nexport * from './Device'\nexport * from './DeviceType'\nexport * from './DiaryNoteExportInfo'\nexport * from './Dmpp'\nexport * from './DocIdentifier'\nexport * from './Document'\nexport * from './DocumentGroup'\nexport * from './DocumentTemplate'\nexport * from './Duration'\nexport * from './EIDItem'\nexport * from './Editor'\nexport * from './EfactInvoice'\nexport * from './Employer'\nexport * from './EmploymentInfo'\nexport * from './EntityReference'\nexport * from './EntityTemplate'\nexport * from './Episode'\nexport * from './FilterChainCode'\nexport * from './FilterChainContact'\nexport * from './FilterChainDevice'\nexport * from './FilterChainHealthElement'\nexport * from './FilterChainHealthcareParty'\nexport * from './FilterChainInvoice'\nexport * from './FilterChainMaintenanceTask'\nexport * from './FilterChainPatient'\nexport * from './FilterChainService'\nexport * from './FilterChainUser'\nexport * from './FinancialInstitutionInformation'\nexport * from './FlatRateTarification'\nexport * from './FlowItem'\nexport * from './Form'\nexport * from './FormColumn'\nexport * from './FormDataOption'\nexport * from './FormLayout'\nexport * from './FormLayoutData'\nexport * from './FormPlanning'\nexport * from './FormSection'\nexport * from './FormTemplate'\nexport * from './FormTemplateLayout'\nexport * from './Formula'\nexport * from './FrontEndMigration'\nexport * from './Group'\nexport * from './GroupDatabasesInfo'\nexport * from './GuiCode'\nexport * from './GuiCodeType'\nexport * from './HealthElement'\nexport * from './HealthcareParty'\nexport * from './HealthcarePartyHistoryStatus'\nexport * from './IcureStub'\nexport * from './IdWithRev'\nexport * from './Identifier'\nexport * from './IdentityDocumentReader'\nexport * from './ImportMapping'\nexport * from './ImportResult'\nexport * from './IncapacityExportInfo'\nexport * from './IndexingInfo'\nexport * from './Ingredient'\nexport * from './Insurability'\nexport * from './Insurance'\nexport * from './Invoice'\nexport * from './InvoiceItem'\nexport * from './InvoiceSender'\nexport * from './InvoicesBatch'\nexport * from './InvoicingCode'\nexport * from './Keyword'\nexport * from './KeywordSubword'\nexport * from './LabelledOccurence'\nexport * from './LetterValue'\nexport * from './ListOfIds'\nexport * from './ListOfProperties'\nexport * from './LoginCredentials'\nexport * from './MaintenanceTask'\nexport * from './MapOfIds'\nexport * from './Measure'\nexport * from './MedexInfo'\nexport * from './MedicalHouseContract'\nexport * from './MedicalLocation'\nexport * from './Medication'\nexport * from './MedicationSchemeExportInfo'\nexport * from './Medicinalproduct'\nexport * from './Message'\nexport * from './MessageReadStatus'\nexport * from './MessageWithBatch'\nexport * from './MessagesReadStatusUpdate'\nexport * from './MimeAttachment'\nexport * from './Nmp'\nexport * from './NoGenericPrescriptionReason'\nexport * from './NoSwitchReason'\nexport * from './NumeratorRange'\nexport * from './PackagingType'\nexport * from './PaginatedDocumentKeyIdPairObject'\nexport * from './PaginatedListAccessLog'\nexport * from './PaginatedListAmp'\nexport * from './PaginatedListClassification'\nexport * from './PaginatedListClassificationTemplate'\nexport * from './PaginatedListCode'\nexport * from './PaginatedListContact'\nexport * from './PaginatedListDevice'\nexport * from './PaginatedListDocument'\nexport * from './PaginatedListEntityTemplate'\nexport * from './PaginatedListForm'\nexport * from './PaginatedListGroup'\nexport * from './PaginatedListHealthElement'\nexport * from './PaginatedListHealthcareParty'\nexport * from './PaginatedListInvoice'\nexport * from './PaginatedListMaintenanceTask'\nexport * from './PaginatedListMessage'\nexport * from './PaginatedListNmp'\nexport * from './PaginatedListPatient'\nexport * from './PaginatedListService'\nexport * from './PaginatedListString'\nexport * from './PaginatedListTarification'\nexport * from './PaginatedListUser'\nexport * from './PaginatedListVmp'\nexport * from './PaginatedListVmpGroup'\nexport * from './Paragraph'\nexport * from './ParagraphAgreement'\nexport * from './Partnership'\nexport * from './Patient'\nexport * from './PatientHealthCareParty'\nexport * from './Payment'\nexport * from './Periodicity'\nexport * from './Permission'\nexport * from './PermissionItem'\nexport * from './PersonName'\nexport * from './PharmaceuticalForm'\nexport * from './PharmaceuticalFormStub'\nexport * from './Place'\nexport * from './PlanOfAction'\nexport * from './Predicate'\nexport * from './Pricing'\nexport * from './PropertyStub'\nexport * from './PropertyTypeStub'\nexport * from './PublicKey'\nexport * from './Quantity'\nexport * from './Receipt'\nexport * from './ReferralPeriod'\nexport * from './RegimenItem'\nexport * from './RegistrationInformation'\nexport * from './RegistrationSuccess'\nexport * from './Reimbursement'\nexport * from './ReimbursementCriterion'\nexport * from './Remote'\nexport * from './RemoteAuthentication'\nexport * from './Renewal'\nexport * from './Replication'\nexport * from './ReplicateCommand'\nexport * from './ReplicationInfo'\nexport * from './ReplicationStats'\nexport * from './ReplicatorDocument'\nexport * from './ReplicatorResponse'\nexport * from './ResultInfo'\nexport * from './Right'\nexport * from './RouteOfAdministration'\nexport * from './SamText'\nexport * from './SamVersion'\nexport * from './SchoolingInfo'\nexport * from './Section'\nexport * from './Service'\nexport * from './ServiceLink'\nexport * from './SoftwareMedicalFileExport'\nexport * from './StandardSubstance'\nexport * from './StrengthRange'\nexport * from './StructureElement'\nexport * from './SubContact'\nexport * from './Substance'\nexport * from './SubstanceStub'\nexport * from './Substanceproduct'\nexport * from './Suggest'\nexport * from './SumehrContent'\nexport * from './SumehrExportInfo'\nexport * from './SumehrValidity'\nexport * from './SupplyProblem'\nexport * from './Suspension'\nexport * from './Tag'\nexport * from './Tarification'\nexport * from './Telecom'\nexport * from './TimeSeries'\nexport * from './TimeTable'\nexport * from './TimeTableHour'\nexport * from './TimeTableItem'\nexport * from './TokenWithGroup'\nexport * from './TypedValueObject'\nexport * from './Unit'\nexport * from './User'\nexport * from './UserAndHealthcareParty'\nexport * from './UserGroup'\nexport * from './Valorisation'\nexport * from './Verse'\nexport * from './VirtualForm'\nexport * from './VirtualIngredient'\nexport * from './Vmp'\nexport * from './VmpComponent'\nexport * from './VmpGroup'\nexport * from './VmpGroupStub'\nexport * from './VmpStub'\nexport * from './Vtm'\nexport * from './Wada'\nexport * from './Weekday'\n"]}
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../icc-api/model/models.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,0DAAuC;AACvC,yDAAsC;AACtC,gEAA6C;AAC7C,kEAA+C;AAC/C,0DAAuC;AACvC,kEAA+C;AAC/C,0DAAuC;AACvC,0DAAuC;AACvC,uDAAoC;AACpC,8CAA2B;AAC3B,kDAA+B;AAC/B,4CAAyB;AACzB,2DAAwC;AACxC,2CAAwB;AACxB,sDAAmC;AACnC,wCAAqB;AACrB,iDAA8B;AAC9B,yCAAsB;AACtB,kDAA+B;AAC/B,+CAA4B;AAC5B,wDAAq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B,4CAAyB;AACzB,mDAAgC;AAChC,gDAA6B;AAC7B,4DAAyC;AACzC,wDAAqC;AACrC,kDAA+B;AAC/B,2DAAwC;AACxC,2CAAwB;AACxB,yDAAsC;AACtC,4CAAyB;AACzB,gDAA6B;AAC7B,qDAAkC;AAClC,oDAAiC;AACjC,qDAAkC;AAClC,uDAAoC;AACpC,uDAAoC;AACpC,+CAA4B;AAC5B,0CAAuB;AACvB,0DAAuC;AACvC,4CAAyB;AACzB,+CAA4B;AAC5B,kDAA+B;AAC/B,4CAAyB;AACzB,4CAAyB;AACzB,gDAA6B;AAC7B,8DAA2C;AAC3C,sDAAmC;AACnC,kDAA+B;AAC/B,qDAAkC;AAClC,+CAA4B;AAC5B,8CAA2B;AAC3B,kDAA+B;AAC/B,qDAAkC;AAClC,4CAAyB;AACzB,kDAA+B;AAC/B,qDAAkC;AAClC,mDAAgC;AAChC,kDAA+B;AAC/B,+CAA4B;AAC5B,wCAAqB;AACrB,iDAA8B;AAC9B,4CAAyB;AACzB,+CAA4B;AAC5B,8CAA2B;AAC3B,kDAA+B;AAC/B,kDAA+B;AAC/B,mDAAgC;AAChC,qDAAkC;AAClC,yCAAsB;AACtB,yCAAsB;AACtB,2DAAwC;AACxC,8CAA2B;AAC3B,iDAA8B;AAC9B,0CAAuB;AACvB,gDAA6B;AAC7B,sDAAmC;AACnC,wCAAqB;AACrB,iDAA8B;AAC9B,6CAA0B;AAC1B,iDAA8B;AAC9B,4CAAyB;AACzB,wCAAqB;AACrB,yCAAsB;AACtB,4CAAyB","sourcesContent":["export * from './AbstractFilterCode'\nexport * from './AbstractFilterContact'\nexport * from './AbstractFilterDevice'\nexport * from './AbstractFilterHealthElement'\nexport * from './AbstractFilterHealthcareParty'\nexport * from './AbstractFilterInvoice'\nexport * from './AbstractFilterMaintenanceTask'\nexport * from './AbstractFilterPatient'\nexport * from './AbstractFilterService'\nexport * from './AbstractFilterUser'\nexport * from './AccessLog'\nexport * from './AddedDocument'\nexport * from './Address'\nexport * from './AdministrationQuantity'\nexport * from './Agenda'\nexport * from './AgreementAppendix'\nexport * from './Amp'\nexport * from './AmpComponent'\nexport * from './Ampp'\nexport * from './AmppComponent'\nexport * from './Annotation'\nexport * from './ApplicationSettings'\nexport * from './AppointmentTypeAndPlace'\nexport * from './Article'\nexport * from './Atc'\nexport * from './AuthenticationResponse'\nexport * from './AuthenticationToken'\nexport * from './Basic'\nexport * from './Body'\nexport * from './Body1'\nexport * from './CalendarItem'\nexport * from './CalendarItemTag'\nexport * from './CalendarItemType'\nexport * from './CareTeamMember'\nexport * from './CareTeamMembership'\nexport * from './CheckSMFPatientResult'\nexport * from './Classification'\nexport * from './ClassificationTemplate'\nexport * from './Code'\nexport * from './CodeStub'\nexport * from './CommentedClassification'\nexport * from './Commercialization'\nexport * from './Company'\nexport * from './Contact'\nexport * from './Content'\nexport * from './Copayment'\nexport * from './Data'\nexport * from './DataOwnerRegistrationSuccess'\nexport * from './DatabaseInfo'\nexport * from './DatabaseInitialisation'\nexport * from './DatabaseSynchronization'\nexport * from './Delegation'\nexport * from './Device'\nexport * from './DeviceType'\nexport * from './DiaryNoteExportInfo'\nexport * from './Dmpp'\nexport * from './DocIdentifier'\nexport * from './Document'\nexport * from './DocumentGroup'\nexport * from './DocumentTemplate'\nexport * from './Duration'\nexport * from './EIDItem'\nexport * from './Editor'\nexport * from './EfactInvoice'\nexport * from './Employer'\nexport * from './EmploymentInfo'\nexport * from './EntityReference'\nexport * from './EntityTemplate'\nexport * from './Episode'\nexport * from './FilterChainCode'\nexport * from './FilterChainContact'\nexport * from './FilterChainDevice'\nexport * from './FilterChainHealthElement'\nexport * from './FilterChainHealthcareParty'\nexport * from './FilterChainInvoice'\nexport * from './FilterChainMaintenanceTask'\nexport * from './FilterChainPatient'\nexport * from './FilterChainService'\nexport * from './FilterChainUser'\nexport * from './FinancialInstitutionInformation'\nexport * from './FlatRateTarification'\nexport * from './FlowItem'\nexport * from './Form'\nexport * from './FormColumn'\nexport * from './FormDataOption'\nexport * from './FormLayout'\nexport * from './FormLayoutData'\nexport * from './FormPlanning'\nexport * from './FormSection'\nexport * from './FormTemplate'\nexport * from './FormTemplateLayout'\nexport * from './Formula'\nexport * from './FrontEndMigration'\nexport * from './Group'\nexport * from './GroupDatabasesInfo'\nexport * from './GuiCode'\nexport * from './GuiCodeType'\nexport * from './HealthElement'\nexport * from './HealthcareParty'\nexport * from './HealthcarePartyHistoryStatus'\nexport * from './IcureStub'\nexport * from './IdWithRev'\nexport * from './Identifier'\nexport * from './IdentityDocumentReader'\nexport * from './ImportMapping'\nexport * from './ImportResult'\nexport * from './IncapacityExportInfo'\nexport * from './IndexingInfo'\nexport * from './Ingredient'\nexport * from './Insurability'\nexport * from './Insurance'\nexport * from './Invoice'\nexport * from './InvoiceItem'\nexport * from './InvoiceSender'\nexport * from './InvoicesBatch'\nexport * from './InvoicingCode'\nexport * from './Keyword'\nexport * from './KeywordSubword'\nexport * from './LabelledOccurence'\nexport * from './LetterValue'\nexport * from './ListOfIds'\nexport * from './ListOfProperties'\nexport * from './LoginCredentials'\nexport * from './MaintenanceTask'\nexport * from './MapOfIds'\nexport * from './Measure'\nexport * from './MedexInfo'\nexport * from './MedicalHouseContract'\nexport * from './MedicalLocation'\nexport * from './Medication'\nexport * from './MedicationSchemeExportInfo'\nexport * from './Medicinalproduct'\nexport * from './Message'\nexport * from './MessageReadStatus'\nexport * from './MessageWithBatch'\nexport * from './MessagesReadStatusUpdate'\nexport * from './MimeAttachment'\nexport * from './Nmp'\nexport * from './NoGenericPrescriptionReason'\nexport * from './NoSwitchReason'\nexport * from './NumeratorRange'\nexport * from './PackagingType'\nexport * from './PaginatedDocumentKeyIdPairObject'\nexport * from './PaginatedListAccessLog'\nexport * from './PaginatedListAmp'\nexport * from './PaginatedListClassification'\nexport * from './PaginatedListClassificationTemplate'\nexport * from './PaginatedListCode'\nexport * from './PaginatedListContact'\nexport * from './PaginatedListDevice'\nexport * from './PaginatedListDocument'\nexport * from './PaginatedListEntityTemplate'\nexport * from './PaginatedListForm'\nexport * from './PaginatedListGroup'\nexport * from './PaginatedListHealthElement'\nexport * from './PaginatedListHealthcareParty'\nexport * from './PaginatedListInvoice'\nexport * from './PaginatedListMaintenanceTask'\nexport * from './PaginatedListMessage'\nexport * from './PaginatedListNmp'\nexport * from './PaginatedListPatient'\nexport * from './PaginatedListService'\nexport * from './PaginatedListString'\nexport * from './PaginatedListTarification'\nexport * from './PaginatedListUser'\nexport * from './PaginatedListVmp'\nexport * from './PaginatedListVmpGroup'\nexport * from './Paragraph'\nexport * from './ParagraphAgreement'\nexport * from './Partnership'\nexport * from './Patient'\nexport * from './PatientHealthCareParty'\nexport * from './Payment'\nexport * from './Periodicity'\nexport * from './Permission'\nexport * from './PermissionItem'\nexport * from './PersonName'\nexport * from './PharmaceuticalForm'\nexport * from './PharmaceuticalFormStub'\nexport * from './Place'\nexport * from './PlanOfAction'\nexport * from './Predicate'\nexport * from './Pricing'\nexport * from './PropertyStub'\nexport * from './PropertyTypeStub'\nexport * from './PublicKey'\nexport * from './Quantity'\nexport * from './Receipt'\nexport * from './ReferralPeriod'\nexport * from './RegimenItem'\nexport * from './RegistrationInformation'\nexport * from './RegistrationSuccess'\nexport * from './Reimbursement'\nexport * from './ReimbursementCriterion'\nexport * from './Remote'\nexport * from './RemoteAuthentication'\nexport * from './Renewal'\nexport * from './Replication'\nexport * from './ReplicateCommand'\nexport * from './ReplicationInfo'\nexport * from './ReplicationStats'\nexport * from './ReplicatorDocument'\nexport * from './ReplicatorResponse'\nexport * from './ResultInfo'\nexport * from './Right'\nexport * from './RouteOfAdministration'\nexport * from './SamText'\nexport * from './SamVersion'\nexport * from './SchoolingInfo'\nexport * from './Section'\nexport * from './Service'\nexport * from './ServiceLink'\nexport * from './SoftwareMedicalFileExport'\nexport * from './StandardSubstance'\nexport * from './StrengthRange'\nexport * from './StructureElement'\nexport * from './SubContact'\nexport * from './Substance'\nexport * from './SubstanceStub'\nexport * from './Substanceproduct'\nexport * from './Suggest'\nexport * from './SumehrContent'\nexport * from './SumehrExportInfo'\nexport * from './SumehrValidity'\nexport * from './SupplyProblem'\nexport * from './Suspension'\nexport * from './Tag'\nexport * from './Tarification'\nexport * from './Telecom'\nexport * from './TimeSeries'\nexport * from './TimeTable'\nexport * from './TimeTableHour'\nexport * from './TimeTableItem'\nexport * from './TokenWithGroup'\nexport * from './TypedValueObject'\nexport * from './Unit'\nexport * from './User'\nexport * from './UserAndHealthcareParty'\nexport * from './UserGroup'\nexport * from './Valorisation'\nexport * from './Verse'\nexport * from './VirtualForm'\nexport * from './VirtualIngredient'\nexport * from './Vmp'\nexport * from './VmpComponent'\nexport * from './VmpGroup'\nexport * from './VmpGroupStub'\nexport * from './VmpStub'\nexport * from './Vtm'\nexport * from './Wada'\nexport * from './Weekday'\n"]}
|
package/icc-x-api/crypto/AES.js
CHANGED
|
@@ -82,7 +82,7 @@ class AESUtils {
|
|
|
82
82
|
const cryptoKeyPromise = this.crypto.subtle.generateKey(this.aesKeyGenParams, extractable, keyUsages);
|
|
83
83
|
return toHex === undefined || !toHex
|
|
84
84
|
? cryptoKeyPromise.then(resolve, reject)
|
|
85
|
-
: cryptoKeyPromise.then((k) => this.exportKey(k, 'raw'), reject).then((raw) => resolve(binary_utils_1.ua2hex(raw)), reject);
|
|
85
|
+
: cryptoKeyPromise.then((k) => this.exportKey(k, 'raw'), reject).then((raw) => resolve((0, binary_utils_1.ua2hex)(raw)), reject);
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
// noinspection JSMethodCanBeStatic
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AES.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/AES.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAC/B,wDAA8C;AAE9C,MAAa,QAAQ;IAgBnB,YAAY,SAAiB,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW,CA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I,CAAA;YACxB,MAAM,SAAS,GAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;YACpD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,MAAa,EAAE,MAAa,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QACvI,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAtJD,4BAsJC;AAEY,QAAA,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAA","sourcesContent":["import { utils } from './utils'\nimport { ua2hex } from '../utils/binary-utils'\n\nexport class AESUtils {\n /********* AES Config **********/\n ivLength = 16\n aesAlgorithmEncryptName = 'AES-CBC'\n\n aesKeyGenParams: AesKeyGenParams = {\n name: 'AES-CBC',\n length: 256,\n }\n private crypto: Crypto\n private _debug: boolean\n\n set debug(value: boolean) {\n this._debug = value\n }\n\n constructor(crypto: Crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : ({} as Crypto)) {\n this.crypto = crypto\n this._debug = false\n }\n\n encrypt(cryptoKey: CryptoKey, plainData: ArrayBuffer | Uint8Array, rawKey = '<NA>'): Promise<ArrayBuffer> {\n return new Promise((resolve: (value: ArrayBuffer) => any, reject: (reason: any) => any) => {\n if (plainData instanceof Uint8Array) {\n const buffer = plainData.buffer\n plainData = (buffer.byteLength > plainData.byteLength ? buffer.slice(0, plainData.byteLength) : buffer) as ArrayBuffer\n }\n const aesAlgorithmEncrypt = {\n name: this.aesAlgorithmEncryptName,\n iv: this.generateIV(this.ivLength),\n }\n this._debug && console.log(`encrypt ${plainData} with ${rawKey}`)\n this.crypto.subtle\n .encrypt(\n {\n ...aesAlgorithmEncrypt,\n } /* some ill behaved implementations change the values in place */,\n cryptoKey,\n plainData\n )\n .then(\n (cipherData) => resolve(utils.appendBuffer(aesAlgorithmEncrypt.iv.buffer as ArrayBuffer, cipherData)),\n (err) => reject('AES encryption failed: ' + err)\n )\n })\n }\n\n /**\n *\n * @param cryptoKey (CryptoKey)\n * @param encryptedData (ArrayBuffer)\n * @param rawKey\n * @returns {Promise} will be ArrayBuffer\n */\n decrypt(cryptoKey: CryptoKey, encryptedData: ArrayBuffer | Uint8Array, rawKey = '<NA>'): Promise<ArrayBuffer> {\n return new Promise((resolve: (value: ArrayBuffer) => any, reject: (reason: any) => any) => {\n if (!cryptoKey) {\n return reject('No crypto key provided for decryption')\n }\n const encryptedDataUint8 = encryptedData instanceof ArrayBuffer ? new Uint8Array(encryptedData) : encryptedData\n const aesAlgorithmEncrypt = {\n name: this.aesAlgorithmEncryptName,\n iv: encryptedDataUint8.subarray(0, this.ivLength),\n\n /*\n * IF THIS BIT OF CODE PRODUCES A DOMEXCEPTION CODE 0 ERROR, IT MIGHT BE RELATED TO THIS:\n *\n * NOTOK:\n * if (!hcparty.hcPartyKeys && !hcparty.hcPartyKeys[hcpartyId] && hcparty.hcPartyKeys[hcpartyId].length !== 2) {\n * throw 'No hcPartyKey for this Healthcare party(' + hcpartyId + ').';\n * }\n * var delegateHcPartyKey = hcparty.hcPartyKeys[hcpartyId][1];\n *\n * SHOULD BE:\n * var delegatorId = patient.delegations[hcpartyId][0].owner;\n * if (!hcparty.hcPartyKeys && !hcparty.hcPartyKeys[delegatorId] && hcparty.hcPartyKeys[delegatorId].length !== 2) {\n * throw 'No hcPartyKey for this Healthcare party(' + delegatorId + ').';\n * }\n * var delegateHcPartyKey = hcparty.hcPartyKeys[delegatorId][1];\n */\n }\n this._debug && console.log(`decrypt with ${rawKey}`)\n this.crypto.subtle\n .decrypt(aesAlgorithmEncrypt, cryptoKey, encryptedDataUint8.subarray(this.ivLength, encryptedDataUint8.length))\n .then(resolve, (err) => {\n reject('AES decryption failed: ' + err)\n })\n })\n }\n\n // generate an AES key\n // noinspection JSUnusedGlobalSymbols\n /**\n *\n * @param toHex boolean, if true, it returns hex String\n * @returns {Promise} either Hex string or CryptoKey\n */\n generateCryptoKey(toHex: false): Promise<CryptoKey>\n generateCryptoKey(toHex: true): Promise<string>\n generateCryptoKey(toHex: boolean): Promise<string | CryptoKey> {\n return new Promise((resolve: (value: CryptoKey | string) => any, reject: (reason: any) => any) => {\n const extractable = true\n const keyUsages: KeyUsage[] = ['decrypt', 'encrypt']\n const cryptoKeyPromise: Promise<CryptoKey> = this.crypto.subtle.generateKey(this.aesKeyGenParams, extractable, keyUsages) as Promise<CryptoKey>\n return toHex === undefined || !toHex\n ? cryptoKeyPromise.then(resolve, reject)\n : cryptoKeyPromise.then((k) => this.exportKey(k, 'raw'), reject).then((raw) => resolve(ua2hex(raw)), reject)\n })\n }\n\n // noinspection JSMethodCanBeStatic\n generateIV(ivByteLength: number): Uint8Array {\n return new Uint8Array(this.crypto.getRandomValues(new Uint8Array(ivByteLength)))\n }\n\n /**\n * This function return a promise which will be the key Format will be either 'raw' or 'jwk'.\n * JWK: Json Web key (ref. http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11)\n *\n * @param cryptoKey CryptoKey\n * @param format will be 'raw' or 'jwk'\n * @returns {Promise} will the AES Key\n */\n exportKey(cryptoKey: CryptoKey, format: 'raw'): Promise<ArrayBuffer>\n exportKey(cryptoKey: CryptoKey, format: 'jwk'): Promise<JsonWebKey>\n exportKey(cryptoKey: CryptoKey, format: string): Promise<ArrayBuffer | JsonWebKey> {\n return new Promise((resolve: (value: ArrayBuffer | JsonWebKey) => any, reject: (reason: any) => any) => {\n return this.crypto.subtle.exportKey(format as any, cryptoKey).then(resolve, reject)\n })\n }\n\n /**\n * the ability to import a key that have already been created elsewhere, for use within the web\n * application that is invoking the import function, for use within the importing web application's\n * origin. This necessiates an interoperable key format, such as JSON Web Key [JWK] which may be\n * represented as octets.\n *\n * https://chromium.googlesource.com/chromium/blink.git/+/6b902997e3ca0384c8fa6fe56f79ecd7589d3ca6/LayoutTests/crypto/resources/common.js\n *\n * @param format 'raw' or 'jwk'\n * @param aesKey\n * @returns {*}\n */\n importKey(format: string, aesKey: JsonWebKey | ArrayBuffer | Uint8Array): Promise<CryptoKey> {\n return new Promise((resolve: (value: CryptoKey) => any, reject: (reason: any) => any) => {\n const extractable = true\n const keyUsages: KeyUsage[] = ['decrypt', 'encrypt']\n return this.crypto.subtle.importKey(format as any, aesKey as any, this.aesKeyGenParams, extractable, keyUsages).then(resolve, reject)\n })\n }\n}\n\nexport const AES = new AESUtils()\n"]}
|
|
1
|
+
{"version":3,"file":"AES.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/AES.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAC/B,wDAA8C;AAE9C,MAAa,QAAQ;IAgBnB,YAAY,SAAiB,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAE,EAAa;QAfvI,iCAAiC;QACjC,aAAQ,GAAG,EAAE,CAAA;QACb,4BAAuB,GAAG,SAAS,CAAA;QAEnC,oBAAe,GAAoB;YACjC,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,GAAG;SACZ,CAAA;QASC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,CAAC;IAPD,IAAI,KAAK,CAAC,KAAc;QACtB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,CAAC;IAOD,OAAO,CAAC,SAAoB,EAAE,SAAmC,EAAE,MAAM,GAAG,MAAM;QAChF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAoC,EAAE,MAA4B,EAAE,EAAE;YACxF,IAAI,SAAS,YAAY,UAAU,EAAE;gBACnC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAA;gBAC/B,SAAS,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KA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AI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;IAClF,CAAC;IAYD,SAAS,CAAC,SAAoB,EAAE,MAAc;QAC5C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAiD,EAAE,MAA4B,EAAE,EAAE;YACrG,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,MAAa,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QACrF,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,MAAc,EAAE,MAA6C;QACrE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAkC,EAAE,MAA4B,EAAE,EAAE;YACtF,MAAM,WAAW,GAAG,IAAI,CAAA;YACxB,MAAM,SAAS,GAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;YACpD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,MAAa,EAAE,MAAa,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QACvI,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAtJD,4BAsJC;AAEY,QAAA,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAA","sourcesContent":["import { utils } from './utils'\nimport { ua2hex } from '../utils/binary-utils'\n\nexport class AESUtils {\n /********* AES Config **********/\n ivLength = 16\n aesAlgorithmEncryptName = 'AES-CBC'\n\n aesKeyGenParams: AesKeyGenParams = {\n name: 'AES-CBC',\n length: 256,\n }\n private crypto: Crypto\n private _debug: boolean\n\n set debug(value: boolean) {\n this._debug = value\n }\n\n constructor(crypto: Crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : ({} as Crypto)) {\n this.crypto = crypto\n this._debug = false\n }\n\n encrypt(cryptoKey: CryptoKey, plainData: ArrayBuffer | Uint8Array, rawKey = '<NA>'): Promise<ArrayBuffer> {\n return new Promise((resolve: (value: ArrayBuffer) => any, reject: (reason: any) => any) => {\n if (plainData instanceof Uint8Array) {\n const buffer = plainData.buffer\n plainData = (buffer.byteLength > plainData.byteLength ? buffer.slice(0, plainData.byteLength) : buffer) as ArrayBuffer\n }\n const aesAlgorithmEncrypt = {\n name: this.aesAlgorithmEncryptName,\n iv: this.generateIV(this.ivLength),\n }\n this._debug && console.log(`encrypt ${plainData} with ${rawKey}`)\n this.crypto.subtle\n .encrypt(\n {\n ...aesAlgorithmEncrypt,\n } /* some ill behaved implementations change the values in place */,\n cryptoKey,\n plainData\n )\n .then(\n (cipherData) => resolve(utils.appendBuffer(aesAlgorithmEncrypt.iv.buffer as ArrayBuffer, cipherData)),\n (err) => reject('AES encryption failed: ' + err)\n )\n })\n }\n\n /**\n *\n * @param cryptoKey (CryptoKey)\n * @param encryptedData (ArrayBuffer)\n * @param rawKey\n * @returns {Promise} will be ArrayBuffer\n */\n decrypt(cryptoKey: CryptoKey, encryptedData: ArrayBuffer | Uint8Array, rawKey = '<NA>'): Promise<ArrayBuffer> {\n return new Promise((resolve: (value: ArrayBuffer) => any, reject: (reason: any) => any) => {\n if (!cryptoKey) {\n return reject('No crypto key provided for decryption')\n }\n const encryptedDataUint8 = encryptedData instanceof ArrayBuffer ? new Uint8Array(encryptedData) : encryptedData\n const aesAlgorithmEncrypt = {\n name: this.aesAlgorithmEncryptName,\n iv: encryptedDataUint8.subarray(0, this.ivLength),\n\n /*\n * IF THIS BIT OF CODE PRODUCES A DOMEXCEPTION CODE 0 ERROR, IT MIGHT BE RELATED TO THIS:\n *\n * NOTOK:\n * if (!hcparty.hcPartyKeys && !hcparty.hcPartyKeys[hcpartyId] && hcparty.hcPartyKeys[hcpartyId].length !== 2) {\n * throw 'No hcPartyKey for this Healthcare party(' + hcpartyId + ').';\n * }\n * var delegateHcPartyKey = hcparty.hcPartyKeys[hcpartyId][1];\n *\n * SHOULD BE:\n * var delegatorId = patient.delegations[hcpartyId][0].owner;\n * if (!hcparty.hcPartyKeys && !hcparty.hcPartyKeys[delegatorId] && hcparty.hcPartyKeys[delegatorId].length !== 2) {\n * throw 'No hcPartyKey for this Healthcare party(' + delegatorId + ').';\n * }\n * var delegateHcPartyKey = hcparty.hcPartyKeys[delegatorId][1];\n */\n }\n this._debug && console.log(`decrypt with ${rawKey}`)\n this.crypto.subtle\n .decrypt(aesAlgorithmEncrypt, cryptoKey, encryptedDataUint8.subarray(this.ivLength, encryptedDataUint8.length))\n .then(resolve, (err) => {\n reject('AES decryption failed: ' + err)\n })\n })\n }\n\n // generate an AES key\n // noinspection JSUnusedGlobalSymbols\n /**\n *\n * @param toHex boolean, if true, it returns hex String\n * @returns {Promise} either Hex string or CryptoKey\n */\n generateCryptoKey(toHex: false): Promise<CryptoKey>\n generateCryptoKey(toHex: true): Promise<string>\n generateCryptoKey(toHex: boolean): Promise<string | CryptoKey> {\n return new Promise((resolve: (value: CryptoKey | string) => any, reject: (reason: any) => any) => {\n const extractable = true\n const keyUsages: KeyUsage[] = ['decrypt', 'encrypt']\n const cryptoKeyPromise: Promise<CryptoKey> = this.crypto.subtle.generateKey(this.aesKeyGenParams, extractable, keyUsages) as Promise<CryptoKey>\n return toHex === undefined || !toHex\n ? cryptoKeyPromise.then(resolve, reject)\n : cryptoKeyPromise.then((k) => this.exportKey(k, 'raw'), reject).then((raw) => resolve(ua2hex(raw)), reject)\n })\n }\n\n // noinspection JSMethodCanBeStatic\n generateIV(ivByteLength: number): Uint8Array {\n return new Uint8Array(this.crypto.getRandomValues(new Uint8Array(ivByteLength)))\n }\n\n /**\n * This function return a promise which will be the key Format will be either 'raw' or 'jwk'.\n * JWK: Json Web key (ref. http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11)\n *\n * @param cryptoKey CryptoKey\n * @param format will be 'raw' or 'jwk'\n * @returns {Promise} will the AES Key\n */\n exportKey(cryptoKey: CryptoKey, format: 'raw'): Promise<ArrayBuffer>\n exportKey(cryptoKey: CryptoKey, format: 'jwk'): Promise<JsonWebKey>\n exportKey(cryptoKey: CryptoKey, format: string): Promise<ArrayBuffer | JsonWebKey> {\n return new Promise((resolve: (value: ArrayBuffer | JsonWebKey) => any, reject: (reason: any) => any) => {\n return this.crypto.subtle.exportKey(format as any, cryptoKey).then(resolve, reject)\n })\n }\n\n /**\n * the ability to import a key that have already been created elsewhere, for use within the web\n * application that is invoking the import function, for use within the importing web application's\n * origin. This necessiates an interoperable key format, such as JSON Web Key [JWK] which may be\n * represented as octets.\n *\n * https://chromium.googlesource.com/chromium/blink.git/+/6b902997e3ca0384c8fa6fe56f79ecd7589d3ca6/LayoutTests/crypto/resources/common.js\n *\n * @param format 'raw' or 'jwk'\n * @param aesKey\n * @returns {*}\n */\n importKey(format: string, aesKey: JsonWebKey | ArrayBuffer | Uint8Array): Promise<CryptoKey> {\n return new Promise((resolve: (value: CryptoKey) => any, reject: (reason: any) => any) => {\n const extractable = true\n const keyUsages: KeyUsage[] = ['decrypt', 'encrypt']\n return this.crypto.subtle.importKey(format as any, aesKey as any, this.aesKeyGenParams, extractable, keyUsages).then(resolve, reject)\n })\n }\n}\n\nexport const AES = new AESUtils()\n"]}
|
|
@@ -34,7 +34,7 @@ class UtilsClass {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
jwk2pkcs8(jwk) {
|
|
37
|
-
return asn1_packer_1.pack([
|
|
37
|
+
return (0, asn1_packer_1.pack)([
|
|
38
38
|
0x30,
|
|
39
39
|
[
|
|
40
40
|
[0x02, '00'],
|
|
@@ -46,14 +46,14 @@ class UtilsClass {
|
|
|
46
46
|
0x30,
|
|
47
47
|
[
|
|
48
48
|
[0x02, '00'],
|
|
49
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.n))],
|
|
50
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.e))],
|
|
51
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.d))],
|
|
52
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.p))],
|
|
53
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.q))],
|
|
54
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.dp))],
|
|
55
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.dq))],
|
|
56
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.qi))],
|
|
49
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.n))],
|
|
50
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.e))],
|
|
51
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.d))],
|
|
52
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.p))],
|
|
53
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.q))],
|
|
54
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.dp))],
|
|
55
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.dq))],
|
|
56
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.qi))],
|
|
57
57
|
],
|
|
58
58
|
],
|
|
59
59
|
],
|
|
@@ -62,23 +62,23 @@ class UtilsClass {
|
|
|
62
62
|
]);
|
|
63
63
|
}
|
|
64
64
|
jwk2pkcs1(jwk) {
|
|
65
|
-
return asn1_packer_1.pack([
|
|
65
|
+
return (0, asn1_packer_1.pack)([
|
|
66
66
|
0x30,
|
|
67
67
|
[
|
|
68
68
|
[0x02, '00'],
|
|
69
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.n))],
|
|
70
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.e))],
|
|
71
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.d))],
|
|
72
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.p))],
|
|
73
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.q))],
|
|
74
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.dp))],
|
|
75
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.dq))],
|
|
76
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.qi))],
|
|
69
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.n))],
|
|
70
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.e))],
|
|
71
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.d))],
|
|
72
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.p))],
|
|
73
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.q))],
|
|
74
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.dp))],
|
|
75
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.dq))],
|
|
76
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.qi))],
|
|
77
77
|
],
|
|
78
78
|
]);
|
|
79
79
|
}
|
|
80
80
|
jwk2spki(jwk) {
|
|
81
|
-
return asn1_packer_1.pack([
|
|
81
|
+
return (0, asn1_packer_1.pack)([
|
|
82
82
|
0x30,
|
|
83
83
|
[
|
|
84
84
|
[0x30, [[0x06, '2a864886f70d010101'], [0x05]]],
|
|
@@ -88,8 +88,8 @@ class UtilsClass {
|
|
|
88
88
|
[
|
|
89
89
|
0x30,
|
|
90
90
|
[
|
|
91
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.n))],
|
|
92
|
-
[0x02, binary_utils_1.ua2hex(binary_utils_1.b64Url2ua(jwk.e))],
|
|
91
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.n))],
|
|
92
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.e))],
|
|
93
93
|
],
|
|
94
94
|
],
|
|
95
95
|
],
|
|
@@ -99,13 +99,14 @@ class UtilsClass {
|
|
|
99
99
|
}
|
|
100
100
|
spkiToJwk(buf) {
|
|
101
101
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
|
102
|
-
const asn1 = asn1_parser_1.parseAsn1(new Uint8Array(buf));
|
|
102
|
+
const asn1 = (0, asn1_parser_1.parseAsn1)(new Uint8Array(buf));
|
|
103
103
|
var modulus = undefined;
|
|
104
104
|
var exponent = undefined;
|
|
105
105
|
if (asn1.type === 0x30 &&
|
|
106
106
|
((_b = (_a = asn1.children) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.type) === 0x30 &&
|
|
107
107
|
((_f = (_e = (_d = (_c = asn1.children) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.children) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.type) === 0x06 &&
|
|
108
|
-
binary_utils_1.ua2hex((_l = (_k = (_j = (_h = (_g = asn1.children) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.children) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.value) !== null && _l !== void 0 ? _l : new Uint8Array()) === '2a864886f70d010101')
|
|
108
|
+
(0, binary_utils_1.ua2hex)((_l = (_k = (_j = (_h = (_g = asn1.children) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.children) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.value) !== null && _l !== void 0 ? _l : new Uint8Array()) === '2a864886f70d010101' // pragma: allowlist secret (object identifier of RSA)
|
|
109
|
+
) {
|
|
109
110
|
modulus = (_s = (_r = (_q = (_p = (_o = (_m = asn1.children) === null || _m === void 0 ? void 0 : _m[1]) === null || _o === void 0 ? void 0 : _o.children) === null || _p === void 0 ? void 0 : _p[0]) === null || _q === void 0 ? void 0 : _q.children) === null || _r === void 0 ? void 0 : _r[0]) === null || _s === void 0 ? void 0 : _s.value;
|
|
110
111
|
exponent = (_y = (_x = (_w = (_v = (_u = (_t = asn1.children) === null || _t === void 0 ? void 0 : _t[1]) === null || _u === void 0 ? void 0 : _u.children) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.children) === null || _x === void 0 ? void 0 : _x[1]) === null || _y === void 0 ? void 0 : _y.value;
|
|
111
112
|
}
|
|
@@ -120,26 +121,26 @@ class UtilsClass {
|
|
|
120
121
|
kty: 'RSA',
|
|
121
122
|
alg: 'RSA-OAEP',
|
|
122
123
|
ext: true,
|
|
123
|
-
n: binary_utils_1.ua2b64Url(this.minimalRep(modulus)),
|
|
124
|
-
e: binary_utils_1.ua2b64Url(this.minimalRep(exponent)),
|
|
124
|
+
n: (0, binary_utils_1.ua2b64Url)(this.minimalRep(modulus)),
|
|
125
|
+
e: (0, binary_utils_1.ua2b64Url)(this.minimalRep(exponent)),
|
|
125
126
|
};
|
|
126
127
|
}
|
|
127
128
|
pkcs8ToJwk(buf) {
|
|
128
129
|
var _a, _b;
|
|
129
|
-
const parsed = asn1_parser_1.parseAsn1(new Uint8Array(buf));
|
|
130
|
+
const parsed = (0, asn1_parser_1.parseAsn1)(new Uint8Array(buf));
|
|
130
131
|
const seq = ((_a = parsed.children) === null || _a === void 0 ? void 0 : _a.length) === 3 && parsed.children[2].type === 0x04 && ((_b = parsed.children[2].children) === null || _b === void 0 ? void 0 : _b.length) === 1
|
|
131
132
|
? parsed.children[2].children[0]
|
|
132
133
|
: parsed;
|
|
133
134
|
return {
|
|
134
135
|
kty: 'RSA',
|
|
135
|
-
n: binary_utils_1.ua2b64Url(this.minimalRep(seq.children[1].value)),
|
|
136
|
-
e: binary_utils_1.ua2b64Url(this.minimalRep(seq.children[2].value)),
|
|
137
|
-
d: binary_utils_1.ua2b64Url(this.minimalRep(seq.children[3].value)),
|
|
138
|
-
p: binary_utils_1.ua2b64Url(this.minimalRep(seq.children[4].value)),
|
|
139
|
-
q: binary_utils_1.ua2b64Url(this.minimalRep(seq.children[5].value)),
|
|
140
|
-
dp: binary_utils_1.ua2b64Url(this.minimalRep(seq.children[6].value)),
|
|
141
|
-
dq: binary_utils_1.ua2b64Url(this.minimalRep(seq.children[7].value)),
|
|
142
|
-
qi: binary_utils_1.ua2b64Url(this.minimalRep(seq.children[8].value)),
|
|
136
|
+
n: (0, binary_utils_1.ua2b64Url)(this.minimalRep(seq.children[1].value)),
|
|
137
|
+
e: (0, binary_utils_1.ua2b64Url)(this.minimalRep(seq.children[2].value)),
|
|
138
|
+
d: (0, binary_utils_1.ua2b64Url)(this.minimalRep(seq.children[3].value)),
|
|
139
|
+
p: (0, binary_utils_1.ua2b64Url)(this.minimalRep(seq.children[4].value)),
|
|
140
|
+
q: (0, binary_utils_1.ua2b64Url)(this.minimalRep(seq.children[5].value)),
|
|
141
|
+
dp: (0, binary_utils_1.ua2b64Url)(this.minimalRep(seq.children[6].value)),
|
|
142
|
+
dq: (0, binary_utils_1.ua2b64Url)(this.minimalRep(seq.children[7].value)),
|
|
143
|
+
qi: (0, binary_utils_1.ua2b64Url)(this.minimalRep(seq.children[8].value)),
|
|
143
144
|
};
|
|
144
145
|
}
|
|
145
146
|
minimalRep(b) {
|
|
@@ -210,7 +211,7 @@ class UtilsClass {
|
|
|
210
211
|
crypt(obj, cryptor, keys) {
|
|
211
212
|
return __awaiter(this, void 0, void 0, function* () {
|
|
212
213
|
const subObj = _.pick(obj, keys.filter((k) => !k.includes('*')));
|
|
213
|
-
obj.encryptedSelf = binary_utils_1.b2a(binary_utils_1.ua2string(yield cryptor(subObj)));
|
|
214
|
+
obj.encryptedSelf = (0, binary_utils_1.b2a)((0, binary_utils_1.ua2string)(yield cryptor(subObj)));
|
|
214
215
|
Object.keys(subObj).forEach((k) => delete obj[k]);
|
|
215
216
|
yield keys
|
|
216
217
|
.filter((k) => k.includes('*'))
|
|
@@ -244,7 +245,7 @@ class UtilsClass {
|
|
|
244
245
|
}
|
|
245
246
|
}), Promise.resolve());
|
|
246
247
|
if (obj.encryptedSelf) {
|
|
247
|
-
Object.assign(obj, yield decryptor(binary_utils_1.string2ua(binary_utils_1.a2b(obj.encryptedSelf))));
|
|
248
|
+
Object.assign(obj, yield decryptor((0, binary_utils_1.string2ua)((0, binary_utils_1.a2b)(obj.encryptedSelf))));
|
|
248
249
|
}
|
|
249
250
|
return obj;
|
|
250
251
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAgC;AAEhC,4BAA2B;AAC3B,wDAAoG;AACpG,sDAA2C;AAC3C,sDAAgD;AAEhD,MAAa,UAAU;IACrB,gBAAe,CAAC;IAEhB,aAAa,CAAI,cAAiD,EAAE,GAAW,EAAE,IAA0B;QACzG,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAA;QACpC,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,GAAS,EAAE;gBACxC,IA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,GAAG,CAAC,aAAa,EAAE;gBACrB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,SAAS,CAAC,wBAAS,CAAC,kBAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;aACvE;YACD,OAAO,GAAG,CAAA;QACZ,CAAC;KAAA;CACF;AAxPD,gCAwPC;AAEY,QAAA,KAAK,GAAG,IAAI,UAAU,EAAE,CAAA","sourcesContent":["import * as moment from 'moment'\nimport { Moment } from 'moment'\nimport * as _ from 'lodash'\nimport { a2b, b2a, b64Url2ua, string2ua, ua2b64Url, ua2hex, ua2string } from '../utils/binary-utils'\nimport { pack } from '../utils/asn1-packer'\nimport { parseAsn1 } from '../utils/asn1-parser'\n\nexport class UtilsClass {\n constructor() {}\n\n notConcurrent<T>(concurrencyMap: { [key: string]: PromiseLike<T> }, key: string, proc: () => PromiseLike<T>): PromiseLike<T> {\n const inFlight = concurrencyMap[key]\n if (!inFlight) {\n return (concurrencyMap[key] = (async () => {\n try {\n return await proc()\n } finally {\n delete concurrencyMap[key]\n }\n })())\n } else {\n return concurrencyMap[key].then(() => this.notConcurrent(concurrencyMap, key, proc))\n }\n }\n\n jwk2pkcs8(jwk: any): string {\n return pack([\n 0x30,\n [\n [0x02, '00'],\n [0x30, [[0x06, '2a864886f70d010101'], [0x05]]],\n [\n 0x04,\n [\n [\n 0x30,\n [\n [0x02, '00'],\n [0x02, ua2hex(b64Url2ua(jwk.n))],\n [0x02, ua2hex(b64Url2ua(jwk.e))],\n [0x02, ua2hex(b64Url2ua(jwk.d))],\n [0x02, ua2hex(b64Url2ua(jwk.p))],\n [0x02, ua2hex(b64Url2ua(jwk.q))],\n [0x02, ua2hex(b64Url2ua(jwk.dp))],\n [0x02, ua2hex(b64Url2ua(jwk.dq))],\n [0x02, ua2hex(b64Url2ua(jwk.qi))],\n ],\n ],\n ],\n ],\n ],\n ])\n }\n\n jwk2pkcs1(jwk: any): string {\n return pack([\n 0x30,\n [\n [0x02, '00'],\n [0x02, ua2hex(b64Url2ua(jwk.n))],\n [0x02, ua2hex(b64Url2ua(jwk.e))],\n [0x02, ua2hex(b64Url2ua(jwk.d))],\n [0x02, ua2hex(b64Url2ua(jwk.p))],\n [0x02, ua2hex(b64Url2ua(jwk.q))],\n [0x02, ua2hex(b64Url2ua(jwk.dp))],\n [0x02, ua2hex(b64Url2ua(jwk.dq))],\n [0x02, ua2hex(b64Url2ua(jwk.qi))],\n ],\n ])\n }\n\n jwk2spki(jwk: any): string {\n return pack([\n 0x30,\n [\n [0x30, [[0x06, '2a864886f70d010101'], [0x05]]],\n [\n 0x03,\n [\n [\n 0x30,\n [\n [0x02, ua2hex(b64Url2ua(jwk.n))],\n [0x02, ua2hex(b64Url2ua(jwk.e))],\n ],\n ],\n ],\n ],\n ],\n ])\n }\n\n spkiToJwk(buf: Uint8Array): { kty: string; alg: string; n: string; e: string; ext: boolean } {\n const asn1 = parseAsn1(new Uint8Array(buf))\n\n var modulus: Uint8Array | undefined = undefined\n var exponent: Uint8Array | undefined = undefined\n if (\n asn1.type === 0x30 &&\n asn1.children?.[0]?.type === 0x30 &&\n asn1.children?.[0]?.children?.[0]?.type === 0x06 &&\n ua2hex(asn1.children?.[0]?.children?.[0]?.value ?? new Uint8Array()) === '2a864886f70d010101'\n ) {\n modulus = asn1.children?.[1]?.children?.[0]?.children?.[0]?.value\n exponent = asn1.children?.[1]?.children?.[0]?.children?.[1]?.value\n } else if (asn1.type === 0x30 && asn1.children?.[0]?.type === 0x02 && asn1.children?.[1]?.type === 0x02) {\n modulus = asn1.children?.[0]?.value\n exponent = asn1.children?.[1]?.value\n }\n\n if (!modulus || !exponent) {\n throw new Error('Invalid spki format')\n }\n return {\n kty: 'RSA',\n alg: 'RSA-OAEP',\n ext: true,\n n: ua2b64Url(this.minimalRep(modulus)),\n e: ua2b64Url(this.minimalRep(exponent)),\n }\n }\n\n pkcs8ToJwk(buf: Uint8Array | ArrayBuffer) {\n const parsed = parseAsn1(new Uint8Array(buf))\n const seq =\n parsed.children?.length === 3 && parsed.children[2].type === 0x04 && parsed.children[2].children?.length === 1\n ? parsed.children[2].children[0]\n : parsed\n return {\n kty: 'RSA',\n n: ua2b64Url(this.minimalRep(seq.children![1].value as Uint8Array)),\n e: ua2b64Url(this.minimalRep(seq.children![2].value as Uint8Array)),\n d: ua2b64Url(this.minimalRep(seq.children![3].value as Uint8Array)),\n p: ua2b64Url(this.minimalRep(seq.children![4].value as Uint8Array)),\n q: ua2b64Url(this.minimalRep(seq.children![5].value as Uint8Array)),\n dp: ua2b64Url(this.minimalRep(seq.children![6].value as Uint8Array)),\n dq: ua2b64Url(this.minimalRep(seq.children![7].value as Uint8Array)),\n qi: ua2b64Url(this.minimalRep(seq.children![8].value as Uint8Array)),\n }\n }\n\n minimalRep(b: Uint8Array) {\n let i = 0\n while (b[i] === 0) {\n i++\n }\n return b.slice(i)\n }\n\n /**\n * Provide a view over the given Uint8Array where any trailing null bytes at\n * the end are truncated.\n *\n * This can be used to ignore null bytes at the end of a padded UTF-8 string\n * without needing to copy that string, assuming code point U+0000 is encoded\n * in one null byte according to standards rather than in a multi-byte\n * overlong form.\n */\n truncateTrailingNulls(a: Uint8Array) {\n let end = a.byteLength - 1\n while (a[end] === 0 && end >= 0) {\n end--\n }\n // end is now either the last non-null position in a or -1; in the latter\n // case the returned array will have length 0.\n return a.subarray(0, end + 1)\n }\n\n /**\n *\n * @param buffer1 {Uint8Array}\n * @param buffer2{ Uint8Array}\n * @returns {ArrayBuffer}\n */\n appendBuffer(buffer1: ArrayBuffer, buffer2: ArrayBuffer): ArrayBuffer {\n const tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength)\n tmp.set(new Uint8Array(buffer1), 0)\n tmp.set(new Uint8Array(buffer2), buffer1.byteLength)\n return tmp.buffer as ArrayBuffer\n }\n\n //Convenience methods for dates management\n after(d1: number, d2: number): boolean {\n return d1 === null || d2 === null || d1 === undefined || d2 === undefined || this.moment(d1)!.isAfter(this.moment(d2)!)\n }\n\n before(d1: number, d2: number): boolean {\n return d1 === null || d2 === null || d1 === undefined || d2 === undefined || this.moment(d1)!.isBefore(this.moment(d2)!)\n }\n\n moment(epochOrLongCalendar: number): Moment | null {\n if (!epochOrLongCalendar && epochOrLongCalendar !== 0) {\n return null\n }\n if (epochOrLongCalendar >= 18000101 && epochOrLongCalendar < 25400000) {\n return moment('' + epochOrLongCalendar, 'YYYYMMDD')\n } else if (epochOrLongCalendar >= 18000101000000) {\n return moment('' + epochOrLongCalendar, 'YYYYMMDDHHmmss')\n } else {\n return moment(epochOrLongCalendar)\n }\n }\n\n /**\n * Encrypt object graph recursively\n *\n * @param obj the object to encrypt\n * @param cryptor the cryptor function (returns a promise)\n * @param keys the keys to be crypted: ex for a Patient ['note', 'addresses.*.[\"street\", \"houseNumber\", \"telecoms.*.telecomNumber\"]']\n */\n async crypt(obj: any, cryptor: (obj: { [key: string]: string }) => Promise<ArrayBuffer>, keys: Array<string>) {\n const subObj = _.pick(\n obj,\n keys.filter((k) => !k.includes('*'))\n )\n obj.encryptedSelf = b2a(ua2string(await cryptor(subObj)))\n Object.keys(subObj).forEach((k) => delete obj[k])\n\n await keys\n .filter((k) => k.includes('*'))\n .reduce(async (prev: Promise<void>, k: any) => {\n await prev\n const k1 = k.split('.*.')[0]\n const k2 = k.substr(k1.length + 3)\n\n const mapped = await Promise.all((_.get(obj, k1) || []).map((so: any) => this.crypt(so, cryptor, k2.startsWith('[') ? JSON.parse(k2) : [k2])))\n _.set(obj, k1, mapped)\n }, Promise.resolve())\n\n return obj\n }\n\n /**\n * Decrypt object graph recursively\n *\n * @param obj the object to encrypt\n * @param decryptor the decryptor function (returns a promise)\n */\n async decrypt(obj: any, decryptor: (obj: Uint8Array) => Promise<{ [key: string]: string }>) {\n await Object.keys(obj).reduce(async (prev: Promise<void>, k: any) => {\n await prev\n if (Array.isArray(obj[k])) {\n await (obj[k] as Array<any>)\n .filter((o) => typeof o === 'object' && o !== null)\n .reduce(async (prev: Promise<void>, so: any) => {\n await prev\n await this.decrypt(so, decryptor)\n }, Promise.resolve())\n }\n }, Promise.resolve())\n if (obj.encryptedSelf) {\n Object.assign(obj, await decryptor(string2ua(a2b(obj.encryptedSelf))))\n }\n return obj\n }\n}\n\nexport const utils = new UtilsClass()\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAgC;AAEhC,4BAA2B;AAC3B,wDAAoG;AACpG,sDAA2C;AAC3C,sDAAgD;AAEhD,MAAa,UAAU;IACrB,gBAAe,CAAC;IAEhB,aAAa,CAAI,cAAiD,EAAE,GAAW,EAAE,IAA0B;QACzG,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAA;QACpC,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,GAAS,EAAE;gBACxC,IAAI;oBACF,OAAO,MAAM,IAAI,EAAE,CAAA;iBACpB;wBAAS;oBACR,OAAO,cAAc,CAAC,GAAG,CAAC,CAAA;iBAC3B;YACH,CAAC,CAAA,CAAC,EAAE,CAAC,CAAA;SACN;aAAM;YACL,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;SACrF;IACH,CAAC;IAED,SAAS,CAAC,GAAQ;QAChB,OAAO,IAAA,kBAAI,EAAC;YACV,IAAI;YACJ;gBACE,CAAC,IAAI,EAAE,IAAI,CAAC;gBACZ,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,oBAAoB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC9C;oBACE,IAAI;oBACJ;wBACE;4BACE,IAAI;4BACJ;gCACE,CAAC,IAAI,EAAE,IAAI,CAAC;gCACZ,CAAC,IA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ourcesContent":["import * as moment from 'moment'\nimport { Moment } from 'moment'\nimport * as _ from 'lodash'\nimport { a2b, b2a, b64Url2ua, string2ua, ua2b64Url, ua2hex, ua2string } from '../utils/binary-utils'\nimport { pack } from '../utils/asn1-packer'\nimport { parseAsn1 } from '../utils/asn1-parser'\n\nexport class UtilsClass {\n constructor() {}\n\n notConcurrent<T>(concurrencyMap: { [key: string]: PromiseLike<T> }, key: string, proc: () => PromiseLike<T>): PromiseLike<T> {\n const inFlight = concurrencyMap[key]\n if (!inFlight) {\n return (concurrencyMap[key] = (async () => {\n try {\n return await proc()\n } finally {\n delete concurrencyMap[key]\n }\n })())\n } else {\n return concurrencyMap[key].then(() => this.notConcurrent(concurrencyMap, key, proc))\n }\n }\n\n jwk2pkcs8(jwk: any): string {\n return pack([\n 0x30,\n [\n [0x02, '00'],\n [0x30, [[0x06, '2a864886f70d010101'], [0x05]]], // pragma: allowlist secret (object identifier of RSA)\n [\n 0x04,\n [\n [\n 0x30,\n [\n [0x02, '00'],\n [0x02, ua2hex(b64Url2ua(jwk.n))],\n [0x02, ua2hex(b64Url2ua(jwk.e))],\n [0x02, ua2hex(b64Url2ua(jwk.d))],\n [0x02, ua2hex(b64Url2ua(jwk.p))],\n [0x02, ua2hex(b64Url2ua(jwk.q))],\n [0x02, ua2hex(b64Url2ua(jwk.dp))],\n [0x02, ua2hex(b64Url2ua(jwk.dq))],\n [0x02, ua2hex(b64Url2ua(jwk.qi))],\n ],\n ],\n ],\n ],\n ],\n ])\n }\n\n jwk2pkcs1(jwk: any): string {\n return pack([\n 0x30,\n [\n [0x02, '00'],\n [0x02, ua2hex(b64Url2ua(jwk.n))],\n [0x02, ua2hex(b64Url2ua(jwk.e))],\n [0x02, ua2hex(b64Url2ua(jwk.d))],\n [0x02, ua2hex(b64Url2ua(jwk.p))],\n [0x02, ua2hex(b64Url2ua(jwk.q))],\n [0x02, ua2hex(b64Url2ua(jwk.dp))],\n [0x02, ua2hex(b64Url2ua(jwk.dq))],\n [0x02, ua2hex(b64Url2ua(jwk.qi))],\n ],\n ])\n }\n\n jwk2spki(jwk: any): string {\n return pack([\n 0x30,\n [\n [0x30, [[0x06, '2a864886f70d010101'], [0x05]]], // pragma: allowlist secret (object identifier of RSA)\n [\n 0x03,\n [\n [\n 0x30,\n [\n [0x02, ua2hex(b64Url2ua(jwk.n))],\n [0x02, ua2hex(b64Url2ua(jwk.e))],\n ],\n ],\n ],\n ],\n ],\n ])\n }\n\n spkiToJwk(buf: Uint8Array): { kty: string; alg: string; n: string; e: string; ext: boolean } {\n const asn1 = parseAsn1(new Uint8Array(buf))\n\n var modulus: Uint8Array | undefined = undefined\n var exponent: Uint8Array | undefined = undefined\n if (\n asn1.type === 0x30 &&\n asn1.children?.[0]?.type === 0x30 &&\n asn1.children?.[0]?.children?.[0]?.type === 0x06 &&\n ua2hex(asn1.children?.[0]?.children?.[0]?.value ?? new Uint8Array()) === '2a864886f70d010101' // pragma: allowlist secret (object identifier of RSA)\n ) {\n modulus = asn1.children?.[1]?.children?.[0]?.children?.[0]?.value\n exponent = asn1.children?.[1]?.children?.[0]?.children?.[1]?.value\n } else if (asn1.type === 0x30 && asn1.children?.[0]?.type === 0x02 && asn1.children?.[1]?.type === 0x02) {\n modulus = asn1.children?.[0]?.value\n exponent = asn1.children?.[1]?.value\n }\n\n if (!modulus || !exponent) {\n throw new Error('Invalid spki format')\n }\n return {\n kty: 'RSA',\n alg: 'RSA-OAEP',\n ext: true,\n n: ua2b64Url(this.minimalRep(modulus)),\n e: ua2b64Url(this.minimalRep(exponent)),\n }\n }\n\n pkcs8ToJwk(buf: Uint8Array | ArrayBuffer) {\n const parsed = parseAsn1(new Uint8Array(buf))\n const seq =\n parsed.children?.length === 3 && parsed.children[2].type === 0x04 && parsed.children[2].children?.length === 1\n ? parsed.children[2].children[0]\n : parsed\n return {\n kty: 'RSA',\n n: ua2b64Url(this.minimalRep(seq.children![1].value as Uint8Array)),\n e: ua2b64Url(this.minimalRep(seq.children![2].value as Uint8Array)),\n d: ua2b64Url(this.minimalRep(seq.children![3].value as Uint8Array)),\n p: ua2b64Url(this.minimalRep(seq.children![4].value as Uint8Array)),\n q: ua2b64Url(this.minimalRep(seq.children![5].value as Uint8Array)),\n dp: ua2b64Url(this.minimalRep(seq.children![6].value as Uint8Array)),\n dq: ua2b64Url(this.minimalRep(seq.children![7].value as Uint8Array)),\n qi: ua2b64Url(this.minimalRep(seq.children![8].value as Uint8Array)),\n }\n }\n\n minimalRep(b: Uint8Array) {\n let i = 0\n while (b[i] === 0) {\n i++\n }\n return b.slice(i)\n }\n\n /**\n * Provide a view over the given Uint8Array where any trailing null bytes at\n * the end are truncated.\n *\n * This can be used to ignore null bytes at the end of a padded UTF-8 string\n * without needing to copy that string, assuming code point U+0000 is encoded\n * in one null byte according to standards rather than in a multi-byte\n * overlong form.\n */\n truncateTrailingNulls(a: Uint8Array) {\n let end = a.byteLength - 1\n while (a[end] === 0 && end >= 0) {\n end--\n }\n // end is now either the last non-null position in a or -1; in the latter\n // case the returned array will have length 0.\n return a.subarray(0, end + 1)\n }\n\n /**\n *\n * @param buffer1 {Uint8Array}\n * @param buffer2{ Uint8Array}\n * @returns {ArrayBuffer}\n */\n appendBuffer(buffer1: ArrayBuffer, buffer2: ArrayBuffer): ArrayBuffer {\n const tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength)\n tmp.set(new Uint8Array(buffer1), 0)\n tmp.set(new Uint8Array(buffer2), buffer1.byteLength)\n return tmp.buffer as ArrayBuffer\n }\n\n //Convenience methods for dates management\n after(d1: number, d2: number): boolean {\n return d1 === null || d2 === null || d1 === undefined || d2 === undefined || this.moment(d1)!.isAfter(this.moment(d2)!)\n }\n\n before(d1: number, d2: number): boolean {\n return d1 === null || d2 === null || d1 === undefined || d2 === undefined || this.moment(d1)!.isBefore(this.moment(d2)!)\n }\n\n moment(epochOrLongCalendar: number): Moment | null {\n if (!epochOrLongCalendar && epochOrLongCalendar !== 0) {\n return null\n }\n if (epochOrLongCalendar >= 18000101 && epochOrLongCalendar < 25400000) {\n return moment('' + epochOrLongCalendar, 'YYYYMMDD')\n } else if (epochOrLongCalendar >= 18000101000000) {\n return moment('' + epochOrLongCalendar, 'YYYYMMDDHHmmss')\n } else {\n return moment(epochOrLongCalendar)\n }\n }\n\n /**\n * Encrypt object graph recursively\n *\n * @param obj the object to encrypt\n * @param cryptor the cryptor function (returns a promise)\n * @param keys the keys to be crypted: ex for a Patient ['note', 'addresses.*.[\"street\", \"houseNumber\", \"telecoms.*.telecomNumber\"]']\n */\n async crypt(obj: any, cryptor: (obj: { [key: string]: string }) => Promise<ArrayBuffer>, keys: Array<string>) {\n const subObj = _.pick(\n obj,\n keys.filter((k) => !k.includes('*'))\n )\n obj.encryptedSelf = b2a(ua2string(await cryptor(subObj)))\n Object.keys(subObj).forEach((k) => delete obj[k])\n\n await keys\n .filter((k) => k.includes('*'))\n .reduce(async (prev: Promise<void>, k: any) => {\n await prev\n const k1 = k.split('.*.')[0]\n const k2 = k.substr(k1.length + 3)\n\n const mapped = await Promise.all((_.get(obj, k1) || []).map((so: any) => this.crypt(so, cryptor, k2.startsWith('[') ? JSON.parse(k2) : [k2])))\n _.set(obj, k1, mapped)\n }, Promise.resolve())\n\n return obj\n }\n\n /**\n * Decrypt object graph recursively\n *\n * @param obj the object to encrypt\n * @param decryptor the decryptor function (returns a promise)\n */\n async decrypt(obj: any, decryptor: (obj: Uint8Array) => Promise<{ [key: string]: string }>) {\n await Object.keys(obj).reduce(async (prev: Promise<void>, k: any) => {\n await prev\n if (Array.isArray(obj[k])) {\n await (obj[k] as Array<any>)\n .filter((o) => typeof o === 'object' && o !== null)\n .reduce(async (prev: Promise<void>, so: any) => {\n await prev\n await this.decrypt(so, decryptor)\n }, Promise.resolve())\n }\n }, Promise.resolve())\n if (obj.encryptedSelf) {\n Object.assign(obj, await decryptor(string2ua(a2b(obj.encryptedSelf))))\n }\n return obj\n }\n}\n\nexport const utils = new UtilsClass()\n"]}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -194,10 +198,10 @@ class PatientFilterBuilder extends FilterBuilder {
|
|
|
194
198
|
}), this.hcpId));
|
|
195
199
|
}
|
|
196
200
|
olderThan(age) {
|
|
197
|
-
return this.withDateOfBirthBetween(10000101, parseInt(date_fns_1.format(date_fns_1.add(new Date(), { years: -age }), 'yyyyMMdd')));
|
|
201
|
+
return this.withDateOfBirthBetween(10000101, parseInt((0, date_fns_1.format)((0, date_fns_1.add)(new Date(), { years: -age }), 'yyyyMMdd')));
|
|
198
202
|
}
|
|
199
203
|
youngerThan(age) {
|
|
200
|
-
return this.withDateOfBirthBetween(parseInt(date_fns_1.format(date_fns_1.add(new Date(), { years: -age }), 'yyyyMMdd')), 99991231);
|
|
204
|
+
return this.withDateOfBirthBetween(parseInt((0, date_fns_1.format)((0, date_fns_1.add)(new Date(), { years: -age }), 'yyyyMMdd')), 99991231);
|
|
201
205
|
}
|
|
202
206
|
byGenderEducationProfession(gender, education, profession) {
|
|
203
207
|
return this.composer(this, new PatientFilterBuilder(() => new PatientByHcPartyGenderEducationProfession_1.PatientByHcPartyGenderEducationProfession({
|