The TIC library for node.js.
Example
const tic = require('tic.api.js')
- ticApi
- .setProvider
- .create
- .from([seed], [iota], [password]) ⇒
Promise
- .fromMasterClient(masterClient, [password]) ⇒
Promise
- .from([seed], [iota], [password]) ⇒
- .init
- .fromMasterSeed(masterSeed, [password], [iota]) ⇒
Promise
- .fromMam(masterClient, [password]) ⇒
Promise
- .fromSeeds(seeds, masterClient) ⇒
Promise
- .fromMasterSeed(masterSeed, [password], [iota]) ⇒
- .profile
- .putInfo(client, info) ⇒
Promise
- .removeInfo(client, properties) ⇒
Promise
- .get(channelRoot, iota) ⇒
Promise
- .putInfo(client, info) ⇒
- .contacts
- .trust(client, contacts) ⇒
Promise
- .distrust(client, contacts) ⇒
Promise
- .get(contactsRoot, iota) ⇒
Promise
- .trust(client, contacts) ⇒
- .rating
Sets the node to use for all requests to the tangle. The given node must support pow.
Kind: static property of ticApi
Param | Type | Description |
---|---|---|
url | string |
the url of the node to use. |
used for creating a new tic account.
Kind: static property of ticApi
- .create
- .from([seed], [iota], [password]) ⇒
Promise
- .fromMasterClient(masterClient, [password]) ⇒
Promise
- .from([seed], [iota], [password]) ⇒
Creates two random seeds for the profile and contacts channels. The roots of these channels are stored on the public master channel created by the given seed. If configured the seeds of the channels are stored on the restricted channel, so that they can be retrieved later by the masterSeed.
Kind: static method of create
Fulfil: TICClient
- the initialized TICClient.
Param | Type | Default | Description |
---|---|---|---|
[seed] | string |
"mamClient.generateSeed()" |
The seed for the master channel. |
[iota] | IotaClass |
mamClient.getIota() |
The iota client for the MAM client. |
[password] | string |
"seed" |
the tryte-encoded password to save the seed of the profiles channels on the restricted master channel. if it's null the seeds are not saved. |
Creates two random seeds for the profile and contacts channels. The roots of these channels are stored on the public master channel given by the masterClient. If configured the seeds of the channels are stored on the restricted channel, so that they can be retrieved later by the masterSeed.
Kind: static method of create
Fulfil: TICClient
- the initialized TICClient.
Param | Type | Default | Description |
---|---|---|---|
masterClient | MAMClient |
The MAMClient for the master channel. | |
[password] | boolean |
masterClient.mam.channel.seed |
the tryte-encoded password to save the seed of the profiles channels on the restricted master channel. if it's null the seeds are not saved. |
used to initalize an existing tic account
Kind: static property of ticApi
- .init
- .fromMasterSeed(masterSeed, [password], [iota]) ⇒
Promise
- .fromMam(masterClient, [password]) ⇒
Promise
- .fromSeeds(seeds, masterClient) ⇒
Promise
- .fromMasterSeed(masterSeed, [password], [iota]) ⇒
Initializes a TICClient from a masterSeed by retrieving the channel seeds from the restricted MAM channel with the password. If the seeds are not stored in the restricted channel the channel MAMClients will be returned undefined.
Kind: static method of init
Fulfil: TICClient
- the initialized TICClient.
Param | Type | Default | Description |
---|---|---|---|
masterSeed | string |
The seed for the master channel. | |
[password] | string |
"masterSeed" |
the tryte-encoded password used to save the seed of the profiles channels on the restricted master channel. if it's null the seeds are not retrieved. |
[iota] | IotaClass |
mamClient.getIota() |
The iota client for the MAM client. |
Initializes a TICClient from a masterClient by retrieving the channel seeds from the restricted MAM channel. If the seeds are not stored in the restricted channel the channel MAMClients will be returned undefined.
Kind: static method of init
Fulfil: TICClient
- the initialized TICClient.
Param | Type | Default | Description |
---|---|---|---|
masterClient | MAMClient |
The MAMClient for the master channel. | |
[password] | string |
"masterSeed" |
the tryte-encoded password used to save the seed of the profiles channels on the restricted master channel. if it's null the seeds are not retrieved. |
Initializes a TICClient from a masterClient and the channel seeds. If the seeds are not provided the channel MAMClients will be returned undefined.
Kind: static method of init
Fulfil: TICClient
- the initialized TICClient.
Param | Type | Description |
---|---|---|
seeds | Object |
the seed for the profileand contacts channels. |
masterClient | MAMClient |
The MAMClient for the master channel. |
Properties
Name | Type | Description |
---|---|---|
seeds.profile | MAMClient |
The seed for the profile channel. |
seeds.contacts | MAMClient |
The seed for the contacts channel. |
used to modify your own tic account or read others.
Kind: static property of ticApi
- .profile
- .putInfo(client, info) ⇒
Promise
- .removeInfo(client, properties) ⇒
Promise
- .get(channelRoot, iota) ⇒
Promise
- .putInfo(client, info) ⇒
Adds the provided info to the profile MAM channel.
Kind: static method of profile
Fulfil: string
- the root address of the attached message.
Param | Type | Description |
---|---|---|
client | MAMClient |
the MAMClient of the profile channel. |
info | Object |
an Object containing contact informaton to be added to the profile. |
Deletes the the specified info to the profile MAM channel.
Kind: static method of profile
Fulfil: string
- the root address of the attached message.
Param | Type | Description |
---|---|---|
client | MAMClient |
the MAMClient of the profile channel. |
properties | Array.<string> |
an array of strings containing contact informaton properties to be deleted from the profile. |
Reads the contents of the profile MAM channel.
Kind: static method of profile
Fulfil: Object
- the compiled content of the profile MAM channel.
Param | Type | Description |
---|---|---|
channelRoot | string |
the root address of the profile channel. |
iota | IotaClass |
The iota client for the MAM client. |
used to modify your list of contacts or get the one from others.
Kind: static property of ticApi
- .contacts
- .trust(client, contacts) ⇒
Promise
- .distrust(client, contacts) ⇒
Promise
- .get(contactsRoot, iota) ⇒
Promise
- .trust(client, contacts) ⇒
Adds the provided contacts to the trusted contacts in the contacts MAM channel.
Kind: static method of contacts
Fulfil: string
- the root address of the attached message.
Param | Type | Description |
---|---|---|
client | MAMClient |
the MAMClient of the contacts channel. |
contacts | Array.<string> |
the master channel roots of the contacts to be added to the trusted contacts. |
Adds the provided contacts to the distrusted contacts in the contacts MAM channel.
Kind: static method of contacts
Fulfil: string
- the root address of the attached message.
Param | Type | Description |
---|---|---|
client | MAMClient |
the MAMClient of the contacts channel. |
contacts | Array.<string> |
the master channel roots of the contacts to be added to the distrusted contacts. |
Reads the contents of the contacts MAM channel.
Kind: static method of contacts
Fulfil: Array
- an array of master channel
roots of the contacts assigned to "trust" or "distrust" compiled from the MAM channel.
Param | Type | Description |
---|---|---|
contactsRoot | string |
the root address of the contacts channel. |
iota | IotaClass |
The iota client for the MAM client. |
used to get the rating of another tic account.
Kind: static property of ticApi
rating.fromMasterChannelRoot(sourceMasterChannelRoot, targetMasterChannelRoot, iota, [depth]) ⇒ Promise
Computes the RatingSearchResult of a given profile by taking all contacts of the source and their contacts recursivly for a given max amount of steps (depth) and summing their stored trust and distrust messages.
Kind: static method of rating
Fulfil: RatingSearchResult
- the RatingSearchResult of the target.
Param | Type | Default | Description |
---|---|---|---|
sourceMasterChannelRoot | string |
the source's root address of the masterChannel. | |
targetMasterChannelRoot | string |
the channel root adress of the master channel of the target. | |
iota | IotaClass |
an initialized iota client. | |
[depth] | number |
5 |
the amount of steps to get the contacts of the source's contacts. |
Computes the RatingSearchResult of a given profile by taking all contacts of the source and their contacts recursivly for a given max amount of steps (depth) and summing their stored trust and distrust messages.
Kind: static method of rating
Fulfil: RatingSearchResult
- the RatingSearchResult of the target.
Param | Type | Default | Description |
---|---|---|---|
masterClient | MAMClient |
the source's initialized MAMClient for the master channel. | |
targetMasterChannelRoot | string |
the channel root adress of the master channel of the target. | |
[depth] | number |
5 |
the amount of steps to get the contacts of the source's contacts. |
Computes the RatingSearchResult of a given profile by taking all contacts of the source and their contacts recursivly for a given max amount of steps (depth) and summing their stored trust and distrust messages.
Kind: static method of rating
Fulfil: RatingSearchResult
- the RatingSearchResult of the target.
Param | Type | Default | Description |
---|---|---|---|
tic | TICClient |
the source's initialized TICClient. | |
targetMasterChannelRoot | string |
the channel root adress of the master channel of the target. | |
[depth] | number |
5 |
the amount of steps to get the contacts of the source's contacts. |
The types listed below are used by the ticApi.
- types
- ~TICClient :
Object
- ~Contact :
Object
- ~Rating :
Object
- ~RatingSearchResult :
Object
- ~TICClient :
An Object containing the master MAM client and MAM clients for the profiles channel. With this object all requests regarding a specific TIC account can be handled.
Kind: inner typedef of types
Properties
Name | Type | Description |
---|---|---|
masterClient | MAMClient |
The MAMClient for the master channel. |
masterRoot | string |
The channel root of the master channel. |
channelClients | Object |
The MAMClients for the accounts channels. |
channelClients.profile | MAMClient |
The MAMClient for the profile channel. |
channelClients.contacts | MAMClient |
The MAMClient for the contacts channel. |
An object containing information about a contact.
Kind: inner typedef of types
Properties
Name | Type | Description |
---|---|---|
masterRoot | string |
the channel root of the master channel of the contact. |
contacts | Array.<Contact> |
the contacts of the contact. |
depth | Number |
the highest layer of the graph, created by a RatingSearchResult, where the contact exists. |
rating | string |
the rating (trust, distrust or unknown) that the contact gave the target of a RatingSearchResult |
An Object consisting of numbers representing the amounts of contacts rating a specific account 'trusted', 'distrusted' or 'unknown'. These numbers can be computed by specific measures (see RatingSearchResult).
Kind: inner typedef of types
Properties
Name | Type | Description |
---|---|---|
trust | number |
a number representing the amount of contacts rating a given account trustworthy. |
distrust | number |
a number representing the amount of contacts rating a given account not trustworthy. |
unknown | number |
a number representing the amount of contacts not rating a given a account. |
An object containing both the Rating for a given contact computed by multiple measures and the Contacts visited recursivly in the search to derive it.
Kind: inner typedef of types
Properties
Name | Type | Description |
---|---|---|
graph | Contact |
The paths of the rating searches source account to the Contacts, created while computing the rating for a given account, in form of a graph with a single root. The root is the account from where the search started (source account). The graph may contain cycles, so printing it may cause infinite loops. The children of a node in the graph are the accounts that are trusted by the contacts and the target of the rating search, even if they declared it as distrusting. |
contacts | Object |
An object containg all visited contacts. The keys are the master channel roots of the contacts. Their values are the Contacts themself. A contact is only visited if it's trusted. Additionally this property includes the target of the RatingSearch as a Contact. |
visited | Array.<Contact> |
an array containing all visited Contacts and the target. |
rating | Object |
An object containing Ratings derived with different measures. |
rating.flat | Rating |
a Rating computed by considering all visited contacts equally. |
rating.weighted | Rating |
A Rating where the value of a rating is weighted by the lowest depth where it was found in the graph. the root has depth 0. The rating is weighted by 'rating / (depth + 1)'. |
rating.perLevel | Array.<Rating> |
An array of Ratings, one for each layer of the graph. The nth element in the array contains the rating of all contacts at depth n. |
© 2018 Robin Lamberti <lamberti.robin@gmail.com>. Documented by jsdoc-to-markdown.