Users

Functions

userNew

function userNew(
    address addr, 
    bytes32 IDHash, 
    Role role, 
    Attribute[] calldata attrs,
    address signer,
    uint deadline,
    bytes calldata signature
) external onlyAllowed(msg.sender)

New user registration

Parameters

NameTypeDescription

addr

address

New user address

IDHash

bytes32

New user ID hash. Sha3(userID+systemID)

role

New user role.

attrs

New user attributes.

signer

address

Address of the signer of the request

deadline

uint

Expiration timestamp of the request

signature

bytes

Cryptographic signature of the request performed by the signer's key

getUser

function getUser(address addr) external view returns(User memory)

Getting ehrID for userID

Parameters

NameTypeDescription

addr

address

User address

Return Values:

NameTypeDescription

user

getUserByCode

function getUserByCode(uint64 code) external view returns(User memory)

Retrieving a user by unique code. Useful for searching for a doctor by numeric code.

Parameters

NameTypeDescription

code

uint64

User unique code

Return Values:

NameTypeDescription

user

userGroupCreate

function userGroupCreate(
    bytes32 groupIdHash, 
    Attribute[] calldata attrs, 
    address signer,
    uint deadline,
    bytes calldata signature
 ) external onlyAllowed(msg.sender) 

Creating a user group

Parameters

NameTypeDescription

groupIdHash

bytes32

attrs

User group attributes

signer

address

Address of the signer of the request

deadline

uint

Expiration timestamp of the request

signature

bytes

Cryptographic signature of the request performed by the signer's key

groupAddUser

function groupAddUser(GroupAddUserParams calldata p) external

Adding a user to a group

Parameters

NameTypeDescription

p

User address

groupRemoveUser

function groupRemoveUser(
    bytes32 groupIDHash, 
    bytes32 userIDHash, 
    address signer,
    uint deadline,
    bytes calldata signature
) external

Removing a user from a group

Parameters

NameTypeDescription

groupIDHash

bytes32

userIDHash

bytes32

signer

address

Address of the signer of the request

deadline

uint

Expiration timestamp of the request

signature

bytes

Cryptographic signature of the request performed by the signer's key

userGroupGetByID

function userGroupGetByID(bytes32 groupIdHash) external view returns(UserGroup memory)

Getting a user group by ID

Parameters

NameTypeDescription

groupIDHash

bytes32

User group ID hash

Return Values:

NameTypeDescription

userGroup

setAccess

function setAccess(
    bytes32 accessID,
    IAccessStore.Access memory a,
    address signer,
    uint deadline,
    bytes calldata signature
) external

Sets the access level to the object

Parameters

NameTypeDescription

accessID

bytes32

a

signer

address

Address of the signer of the request

deadline

uint

Expiration timestamp of the request

signature

bytes

Cryptographic signature of the request performed by the signer's key

Models

Role

enum Role { Patient, Doctor }

Attribute

struct Attribute {
    Code  code;
    bytes value;
}

AccessLevel

enum AccessLevel { NoAccess, Owner, Admin, Read }

User

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

UserGroup

struct UserGroup {
    Attribute[] attrs;
    GroupMember[] members;  
}

Parameters

NameTypeDescription

attrs

User group attributes

members

Array of user group members

GroupMember

struct GroupMember {
    bytes32 userIDHash;
    bytes userIDEncr;
}

Parameters

NameTypeDescription

userIDHash

bytes32

User id hash

userIDEncr

bytes

User ID encrypted by group key

GroupAddUserParams

struct GroupAddUserParams {
    bytes32 groupIDHash;
    bytes32 userIDHash;
    AccessLevel level;
    bytes userIDEncr;
    bytes keyEncr;
    address signer;
    uint deadline;
    bytes signature;
}

Parameters:

NameTypeDescription

groupIDHash

bytes32

userIDHash

bytes32

level

userIDEncr

bytes

userID encrypted by group key

keyEncr

bytes

group key encrypted by adding user public key

signer

address

Address of the signer of the request

deadline

uint

Expiration timestamp of the request

signature

bytes

Cryptographic signature of the request performed by the signer's key

IAccessStore.Access

struct Access {
    AccessKind   kind;
    bytes32      idHash;
    bytes        idEncr;    // id encrypted by access key
    bytes        keyEncr;   // access key encrypted by user private key
    AccessLevel  level;
}

Last updated