import GraphConnector from 'runtime-core/src/graphconnector/GraphConnector.js'
GraphConnector
The Graph Connector contains the contact list/address book.
Constructor Summary
Public Constructor | ||
public |
constructor(hypertyRuntimeURL: string, messageBus: messageBus, storageManager: storageManager) Constructs a new and empty Graph Connector. |
Member Summary
Public Members | ||
public |
contacts: *[] |
|
public |
|
|
public |
|
|
public |
|
|
public |
groups: *[] |
|
public |
|
|
public |
|
|
public get |
messageBus: * Returns the MessageBus. |
|
public set |
messageBus(messageBus: MessageBus): * Sets the MessageBus. |
|
public |
privateKey: * |
|
public |
|
|
public |
|
Method Summary
Public Methods | ||
public |
addContact(guid: string, firstName: string, lastName: string): boolean Add a contact to the Graph Connector. |
|
public |
addGroupName(guid: string, groupName: string): boolean Adds a group to a contact identified by a GUID. |
|
public |
Adds a Legacy ID for the user. |
|
public |
Adds a UserID for the user. |
|
public |
Calculates the Bloom filter containing all non-private contacts. |
|
public |
Checks, if the given GUID is known and returns a list of contacs that are direct connections as well as a list of contacts that (most likely) know the given contact. |
|
public |
editContact(guidOld: string, firstName: string, lastName: string, guidNew: string, privStatus: boolean): array Edit the values for a specific contact. |
|
public |
Type cast one object to another equivalent to "$.extend" of jquery |
|
public |
Generates a GUID and returns a mnemonic from which the GUID can be re-created later. |
|
public |
getAllContacts(): array Returns all the contacts, excluding the owner. |
|
public |
getContact(name: string): array Returns the list of contacts which matches the search string "name". |
|
public |
getContactUserIDs(guid: string): array Returns ArrayList of userIDs of a contact, if contact not found then it will return a string 'Contact Does not exist' |
|
public |
Returns the globalRegistryRecord for the owner. |
|
public |
Returns all contacts with a given group name, including the owner if applicable. |
|
public |
getGroupNames(): array Returns all unique group names. |
|
public |
To return the owner. |
|
public |
To check whether the GUID already exist. |
|
public |
queryGlobalRegistry(guid: string): Promise Queries the Global Registry for a given GUID. |
|
public |
removeContact(guid: string): boolean Removes a contact from the Graph Connector. |
|
public |
removeGroupName(guid: string, groupName: string): boolean Removes a group for a contact, identified by a GUID. |
|
public |
Removes a LegacyID for the user. |
|
public |
removeLocation(guid: string): boolean Removes a location for a user identified by a given GUID. |
|
public |
Removes a UserID for the user. |
|
public |
sendGlobalRegistryRecord(jwt: string): Propmise Takes the Global Registry Record as a signed JWT and sends it to the Global Registry via the MessageBus. |
|
public |
Sets active attribute of the GlobalRegistryRecord. |
|
public |
setBloomFilter1HopContact(guid: string, bf: BloomFilter): boolean Sets the bloomfilter of a contact. |
|
public |
setContactUserIDs(guid: string, uid: string, domain: string): boolean Returns success if the userID is successfully added for a contact |
|
public |
setDefaults(voice: string, chat: string, video: string): boolean set User Defaults. |
|
public |
setLocation(guid: string, locationName: string): boolean Adds a location for a user identified by a given GUID. |
|
public |
setOwnerName(fname: string, lname: string): boolean Sets the first name and last name of the owner. |
|
public |
setRevoked(int: int): boolean Sets revoked attribute of the GlobalRegistryRecord. |
|
public |
setTimeout(Timeout: Date): boolean Sets Timeout attribute of the GlobalRegistryRecord. |
|
public |
SignGenerates a public/private key pair from a given mnemonic. |
|
public |
store the entry into the storage Manager for the given keys: globalRegistryRecord, contacts, groups. |
|
public |
updateContactInfo(guid: string, firstName: string, lastName: string): boolean Add a contact to the Graph Connector. |
|
public |
Generates a public/private key pair from a given mnemonic (16 words). |
Public Constructors
public constructor(hypertyRuntimeURL: string, messageBus: messageBus, storageManager: storageManager) source
Constructs a new and empty Graph Connector.
Params:
Name | Type | Attribute | Description |
hypertyRuntimeURL | string | The Hyperty Runtime URL. |
|
messageBus | messageBus | The Message Bus. |
|
storageManager | storageManager | the storage Manager. |
Public Members
public contacts: *[] source
public contactsBloomFilter1Hop: * source
public globalRegistryRecord: * source
public groups: *[] source
public lastCalculationBloomFilter1Hop: * source
public privateKey: * source
public storageManager: * source
Public Methods
public addContact(guid: string, firstName: string, lastName: string): boolean source
Add a contact to the Graph Connector.
public addGroupName(guid: string, groupName: string): boolean source
Adds a group to a contact identified by a GUID.
public addUserID(): boolean source
Adds a UserID for the user.
Return:
boolean | returns false if the userID exists and the user ID will not be added, true otherwise. |
public calculateBloomFilter1Hop() source
Calculates the Bloom filter containing all non-private contacts.
public checkGUID(guid: string): array source
Checks, if the given GUID is known and returns a list of contacs that are direct connections as well as a list of contacts that (most likely) know the given contact.
Params:
Name | Type | Attribute | Description |
guid | string | GUID of the contact to look for. |
Return:
array | relatedContacts List of related direct contacts and of related friends-of-friends contacts.The format is: RelatedContacts<Direct<GraphConnectorContactData>,FoF<GraphConnectorContactData>>. |
public editContact(guidOld: string, firstName: string, lastName: string, guidNew: string, privStatus: boolean): array source
Edit the values for a specific contact.
Return:
array | Returns the array which contains the contact with new values |
public extend(obj1: Object, obj2: Object): Object source
Type cast one object to another equivalent to "$.extend" of jquery
public generateGUID(): string source
Generates a GUID and returns a mnemonic from which the GUID can be re-created later.
public getAllContacts(): array source
Returns all the contacts, excluding the owner.
Return:
array | All the contacts. The format is: Contacts<GraphConnectorContactData>. |
public getContact(name: string): array source
Returns the list of contacts which matches the search string "name". Ex. "Joh" will return users with first or last name "John" or "Aljohanas".
Params:
Name | Type | Attribute | Description |
name | string | First or last name to look for in the contact list. |
Return:
array | matchingContacts Contacts matching the given name. The format is: Contacts<GraphConnectorContactData>. |
public getContactUserIDs(guid: string): array source
Returns ArrayList of userIDs of a contact, if contact not found then it will return a string 'Contact Does not exist'
Params:
Name | Type | Attribute | Description |
guid | string | guid of the contact whose userID has to be added. |
Return:
array | success returns Arraylist of userID of a contact, if contact not found then it will return a string 'Contact Does not exist' |
public getGroup(groupName: string): array source
Returns all contacts with a given group name, including the owner if applicable.
Params:
Name | Type | Attribute | Description |
groupName | string | Name of the group to return. |
Return:
array | matchingContacts Contacts matching the given group name. The format is: Contacts<GraphConnectorContactData>. |
public getGroupNames(): array source
Returns all unique group names.
Return:
array | Array containing all unique group names. |
public guidExist(guid: string): boolean source
To check whether the GUID already exist.
Params:
Name | Type | Attribute | Description |
guid | string | GUID which needs to be checked. |
public queryGlobalRegistry(guid: string): Promise source
Queries the Global Registry for a given GUID. Adds the UserID information from the Global Registry to a contact, if the given GUID matches a user in the contacts. Returns a Graph Connector Contact Data as a Promise.
Params:
Name | Type | Attribute | Description |
guid | string | The GUID to query the Global Registry for |
public removeContact(guid: string): boolean source
Removes a contact from the Graph Connector.
Params:
Name | Type | Attribute | Description |
guid | string | GUID of the user to be removed. |
public removeGroupName(guid: string, groupName: string): boolean source
Removes a group for a contact, identified by a GUID.
public removeLegacyID(type: string, category: string, description: string, id: string): boolean source
Removes a LegacyID for the user.
public removeLocation(guid: string): boolean source
Removes a location for a user identified by a given GUID.
Params:
Name | Type | Attribute | Description |
guid | string | GUID of the contact. |
public sendGlobalRegistryRecord(jwt: string): Propmise source
Takes the Global Registry Record as a signed JWT and sends it to the Global Registry via the MessageBus. Returns the response code of the REST-interface of the Global Registry as a Promise.
Params:
Name | Type | Attribute | Description |
jwt | string | The Global Registry Record as a signed JWT. |
Return:
Propmise | Promise Response Code from Global Registry. |
public setActive(int: int): boolean source
Sets active attribute of the GlobalRegistryRecord.
Params:
Name | Type | Attribute | Description |
int | int | Value to set the active flag of the GlobalRegistryRecord to. |
public setBloomFilter1HopContact(guid: string, bf: BloomFilter): boolean source
Sets the bloomfilter of a contact.
Params:
Name | Type | Attribute | Description |
guid | string | GUID of the contact to set the bloom filter. |
|
bf | BloomFilter | BloomFilter object. |
public setContactUserIDs(guid: string, uid: string, domain: string): boolean source
Returns success if the userID is successfully added for a contact
public setLocation(guid: string, locationName: string): boolean source
Adds a location for a user identified by a given GUID.
public setOwnerName(fname: string, lname: string): boolean source
Sets the first name and last name of the owner.
public setRevoked(int: int): boolean source
Sets revoked attribute of the GlobalRegistryRecord.
Params:
Name | Type | Attribute | Description |
int | int | Value to set the revoked flag of the GlobalRegistryRecord to. |
public setTimeout(Timeout: Date): boolean source
Sets Timeout attribute of the GlobalRegistryRecord.
Params:
Name | Type | Attribute | Description |
Timeout | Date | Date to set the timeout of the GlobalRegistryRecord to. |
public signGlobalRegistryRecord(): string source
SignGenerates a public/private key pair from a given mnemonic.
public storeGraphConnector() source
store the entry into the storage Manager for the given keys: globalRegistryRecord, contacts, groups.
public updateContactInfo(guid: string, firstName: string, lastName: string): boolean source
Add a contact to the Graph Connector.
public useGUID(mnemonicAndSalt: string): Promise source
Generates a public/private key pair from a given mnemonic (16 words). Expects a string containing 16 words seperated by single spaces. Retrieves data from the Global Registry.
Params:
Name | Type | Attribute | Description |
mnemonicAndSalt | string | A string of 16 words. |