3.0.80 • Published 4 years ago

@taktik/icc-api v3.0.80

Weekly downloads
58
License
MIT
Repository
github
Last release
4 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

4 years ago

3.0.79

4 years ago

3.0.77

4 years ago

3.0.76

4 years ago

3.0.74

4 years ago

3.0.75

4 years ago

3.0.71

4 years ago

3.0.72

4 years ago

3.0.67

4 years ago

3.0.68

4 years ago

3.0.69

4 years ago

3.0.70

4 years ago

3.0.65

4 years ago

3.0.66

4 years ago

3.0.64

4 years ago

3.0.63

4 years ago

3.0.62

4 years ago

3.0.61

4 years ago

3.0.57

5 years ago

3.0.58

5 years ago

3.0.56

5 years ago

3.0.55

5 years ago

3.0.54

5 years ago

3.0.53

5 years ago

3.0.50

5 years ago

3.0.51

5 years ago

3.0.49

5 years ago

3.0.48

5 years ago

3.0.47

5 years ago

3.0.46

5 years ago

3.0.45

5 years ago

3.0.44

5 years ago

3.0.43

5 years ago

3.0.41

5 years ago

3.0.42

5 years ago

3.0.40

5 years ago

3.0.39

5 years ago

3.0.38

5 years ago

3.0.37

5 years ago

3.0.36

5 years ago

3.0.34

5 years ago

3.0.33

5 years ago

3.0.32

5 years ago

3.0.31

5 years ago

3.0.30

5 years ago

3.0.29

5 years ago

3.0.28

5 years ago

3.0.27

5 years ago

3.0.26

5 years ago

3.0.25

5 years ago

3.0.21

5 years ago

3.0.22

5 years ago

3.0.20

5 years ago

3.0.19

5 years ago

3.0.18

5 years ago

3.0.17

5 years ago

3.0.16

5 years ago

3.0.15

5 years ago

3.0.14

5 years ago

3.0.13

5 years ago

3.0.12

5 years ago

3.0.11

5 years ago

3.0.10

5 years ago

3.0.9

5 years ago

3.0.8

5 years ago

3.0.7

5 years ago

3.0.6

5 years ago

3.0.5

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago