Docs
  • Welcome to the ipEHR docs
  • Concepts
    • Basics
      • What is EHR?
      • What is ipEHR?
      • ipEHR and the problems it solves
      • How ipEHR works
    • Components
      • Gateway
      • Datastore Node
      • Document Index
      • Users Directory
      • Access Management
      • Data publishing
    • Encryption
  • Guides
    • Install
      • Contracts deployment
      • Gateway
      • Stat
  • Reference
    • APIs
      • Gateway HTTP REST API
      • Stat HTTP REST API
    • Contracts
      • EhrIndexer
      • Users
      • AccessStore
      • DataStore
Powered by GitBook
On this page
  • Users
  • User groups
  1. Concepts
  2. Components

Users Directory

PreviousDocument IndexNextAccess Management

Last updated 1 year ago

The corresponding is used for registration and authentication of users.

Users

enum Role { Patient, Doctor }

mapping (address => User) private usersStore;
mapping (uint64 => address) private userCodes;

struct User {
      bytes32     IDHash;
      Role        role;
      Attribute[] attrs;
}

A passwordHash is written to the attributes, which is later used for authentication.

A eight-digit numeric code is stored for users with the Doctor role, which is then used for convenient identification of doctors by patients. The code is calculated as follows:

uint64 code = uint64(bytes8(IDHash)) % 99999999;

User groups

mapping (bytes32 => UserGroup) private userGroups;   // groupIdHash => UserGroup

struct GroupMember {
      bytes32 userIDHash;
      bytes   userIDEncr;    // userID encrypted by group key
}

struct UserGroup {
      Attribute[]   attrs;
      GroupMember[] members;  
}
Users smart contract