3.0.80 • Published 3 years ago

@taktik/icc-api v3.0.80

Weekly downloads
58
License
MIT
Repository
github
Last release
3 years ago

Crypto model in iCure

Lexic

  • "ABCD" is a non encrypted key (uuid, ...)
  • {AB} is the encryption key of the pair AB, where hcParty A gives delegation to hcParty B. The encryption key is stored encrypted in the hcPartyKeys of hcParty A document (see below)
  • <ABCD>_{AB} is the key ABCD encrypted with encryption key {AB}
  • <{AB}>_{A} is the encryption key {AB} encrypted with the public key of hcParty A

The encryption keys are stored in the hcParty document that gives delegation to other user, since only the user can modify his hcParty document in CouchDB. The hcParty B needs to access the hcParty A document to decrypt (with his private key) the encryption key {AB} stored in the field hcPartyKeys.

## HCP A ##
hcPartyKeys: {
   A: [ <{AA}>_{A}, <{AA}>_{A} ]
   B: [ <{AB}>_{A}, <{AB}>_{B} ]
}

Document type relations

## Patient 1234 ##
ID: "1234"
Delegations: { A->A: <ABCD>_{AA}, A->B: <ABCD>_{AB} }
EncryptionKeys: { A->A: <DCBA>_{AA}, A->B: <DCBA>_{AB} }
## Contact 4567 ##
ID: "4567"
SecretForeignKeys: [ "ABCD" ]
CryptedForeignKeys: { A->A: <1234>_{AA}, A->B: <1234>_{AB} }
EncryptionKeys: { A->A: <EFGH>_{AA}, A->B: <EFGH>_{AB} }

The delegations of the patient document store the encrypted secretForeignKeys that you find in clear in the contact document. And allows, once decrypted, to find the contacts of a patient.

On the other side, the cryptedForeignKeys of the contact document allows, once decrypted, to find the corresponding patient document.

The encryptionKeys of a document are used to encrypt the content of the corresponding document. As for the delegations, the document encryption keys are stored encrypted with the encryption keys {AA}, {AB}, ...

The healthElement documents are linked to patient documents in the same way as the contact. This means that the healthElement documents have also SecretForeignKeys and CryptedForeignKeys, beside the encryptionKeys.

Delegations

  • Delegations === encrypted foreign key of all patient icureStoredDocument => it makes the link from a patient to a storedDocument
  • CryptedForeignKeys === encrypted patient.ID => it makes the link from a storedDocument to a patient
  • EncryptionKeys === encrypted encryptionKey (probably symmetric)

Multi profession

Contacts and delegations need to be segmented. => need to have segmented auto-delegations

Usage

Instalation

Install from npm

npm install --save icc-api

ES6 import

Example ES6 include

import * as IccApi from 'icc-api'
3.0.80

3 years ago

3.0.79

3 years ago

3.0.77

3 years ago

3.0.76

3 years ago

3.0.74

3 years ago

3.0.75

3 years ago

3.0.71

3 years ago

3.0.72

3 years ago

3.0.67

3 years ago

3.0.68

3 years ago

3.0.69

3 years ago

3.0.70

3 years ago

3.0.65

3 years ago

3.0.66

3 years ago

3.0.64

3 years ago

3.0.63

3 years ago

3.0.62

3 years ago

3.0.61

3 years ago

3.0.57

3 years ago

3.0.58

3 years ago

3.0.56

3 years ago

3.0.55

3 years ago

3.0.54

3 years ago

3.0.53

3 years ago

3.0.50

3 years ago

3.0.51

3 years ago

3.0.49

3 years ago

3.0.48

3 years ago

3.0.47

3 years ago

3.0.46

3 years ago

3.0.45

3 years ago

3.0.44

3 years ago

3.0.43

3 years ago

3.0.41

4 years ago

3.0.42

4 years ago

3.0.40

4 years ago

3.0.39

4 years ago

3.0.38

4 years ago

3.0.37

4 years ago

3.0.36

4 years ago

3.0.34

4 years ago

3.0.33

4 years ago

3.0.32

4 years ago

3.0.31

4 years ago

3.0.30

4 years ago

3.0.29

4 years ago

3.0.28

4 years ago

3.0.27

4 years ago

3.0.26

4 years ago

3.0.25

4 years ago

3.0.21

4 years ago

3.0.22

4 years ago

3.0.20

4 years ago

3.0.19

4 years ago

3.0.18

4 years ago

3.0.17

4 years ago

3.0.16

4 years ago

3.0.15

4 years ago

3.0.14

4 years ago

3.0.13

4 years ago

3.0.12

4 years ago

3.0.11

4 years ago

3.0.10

4 years ago

3.0.9

4 years ago

3.0.8

4 years ago

3.0.7

4 years ago

3.0.6

4 years ago

3.0.5

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago