hearro

HearRo SDK

Abstraction for interacting with the HearRo API.

The SDK will manage the GraphQL client and handle packing/unpacking DidComm messages where appropriate.

Almost All functions return promises that can be async/awaited to recieve the results of the function.

Most API interaction with HearRo is via DidComm messages with the User's agent. All HearRo users have a static connection to their cloud agent, and the keys for interacting with this agent are provided in their embeded wallet. This wallet is never sent over the wire unencrypted - once they log in, the wallet must be opened (decrypted) locally. At this point the user will be able to interact with their cloud agent, who is responsible for managing their cloud wallet and all their conections to HearRo resources.

new hearro(options: Object)
Parameters
options (Object) SDK Configuration Options
Name Description
options.api Object API Access options
options.api.httpEndpoint String HTTP Endpoint
options.orgId String HearRo Organization DID
Instance Members
login(options)
loggedInUser()
logOutUser()
createUser(options)
openWallet(options)
closeWallet()
myAgentKey(publicKey)
emailExists(email)
sendInvite(options)
acceptInvite(options)
invites()
connections()
conversations()
conversationParticipants(id)
addConversationParticipant(options)
sendConversationInvite(options)
acceptConversationInvite(options)
conversationInvites()
conversationMessage(options)
loadConversationMessages(options)
subscribeConversationMessages(options)
newConversation(label, participants)
conversationItems(options)
createConversationItem(options)
loadConversationItemData(options)
saveConversationItemData(options)
deleteConversationItem(options)
getRTCSession(options)

User

User

Type: Object

Properties
user (Object) : HearRo user data
  • user.id String

    HearRo DID

  • user.email String

    email address

  • user.name (Name | null)

    user's real name

diddoc ((Object | null)) : peer DID Document representing the user's static connection to the agent
walletOpen (Boolean) : whether the user's wallet is open

Invite

Invite

Type: Object

Properties
id (String) : invite id
meta (Object) : invite meta data

Connection

Connection

Type: Object

Properties
doc (Object) : Did Doc
entity (Entity) : HearRo entity data for this connection
meta (Object) : meta data for this connection

Conversation

Conversation

Type: Object

Properties
data (Object) : Diddoc for the conversation
meta (Object) : metadata for the conversation

ConversationItem

ConversationItem

Type: Object

Properties
owner_id (String) : conversation participant that owns the item
id (String) : id of the item in the conversation. While universally unique, only accessible in the context of the conversation.
conversation_id (String) : id of the conversation this item belongs to
name (String) : name of the item
mime_type (String) : mime type of the item (e.g. "application/pdf")
size (Number) : size of the item
status (Number) : status of the item (Created, Error, Completed)
data (String) : base64 encoded raw data for the item
meta (Object) : additional optional metadata for this object

Entity

Entity

Type: Object

Properties
name (Name) : entity name
description (String) : entity description
image (Array<Image>) : images for the entity
link (Array<Link>) : links to data for this entity
parent (String) : if the entity has a parent

Image

Image

Type: Object

Properties
location (String) : url for the image
type (String) : type of image (e.g. "avatar")
Link

Type: Object

Properties
name (String) : data name
description (String) : description of the data
location (String) : url for the data
type (String) : mimetype (e.g. "application/pdf")

Name

Name

Type: Object

Properties
first ((String | undefined)) : first name
last ((String | undefined)) : last name
Label ((String | undefined)) : Label

ConversationMessage

ConversationMessage

Type: Object

Properties
body (String) : message body
conversation_id (String) : id of the conversation
mesasge_id (String) : id over the message
sender (String) : conversation Peer DID for the sender
timestamp (String) : RFC3339 timestamp when the sender sent the message
received (String) : RFC3339 timestemp when HearRo received the message

RTCSession

RTCSession

Type: Object

Properties
id (String) : rtc session did
conversation_id (String) : id of the conversation that owns this session
participants ((Array | undefined)) : list of allowed participants. If undefined all conversation participants may join
originator (String) : did of the participant that created the session
timestamp (String) : RFC3339 timestamp when the session was started
rtc_server (String) : HearRo rtc server responsible for this session
state (Number) : session state. Allowed values are: Active - 0; Locked - 1; Finished - 3; Archived - 4
null-null ((Array | undefined)) : list participants currently in the session