Users Directory

The corresponding Users smart contract 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;  
}

Last updated