@atala/prism-wallet-sdk / Exports / ConnectionsManager
Class: ConnectionsManager
ConnectionsManager is responsible of establishing didcomm connection and mediation process with other mediators through didcomm and is also responsible of managing the task to periodically fetch messages from the mediator once connection is established
ConnectionsManager
Implements
Table of contents
Constructors
Properties
- agentCredentials
- cancellable
- cancellables
- castor
- events
- mediationHandler
- mercury
- options
- pairings
- pluto
Accessors
Methods
- addConnection
- awaitMessageResponse
- findIndex
- processMessages
- registerMediator
- removeConnection
- sendMessage
- startFetchingMessages
- startMediator
- stopAllEvents
- stopFetchingMessages
Constructors
constructor
• new ConnectionsManager(castor
, mercury
, pluto
, agentCredentials
, mediationHandler
, pairings?
, options?
): ConnectionsManager
Creates an instance of ConnectionsManager.
Parameters
Name | Type | Default value |
---|---|---|
castor | Castor | undefined |
mercury | Mercury | undefined |
pluto | Pluto | undefined |
agentCredentials | AgentCredentials | undefined |
mediationHandler | MediatorHandler | undefined |
pairings? | DIDPair [] | [] |
options? | AgentOptions | undefined |
Returns
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:69
Properties
agentCredentials
• agentCredentials: AgentCredentials
Implementation of
ConnectionsManagerInterface.agentCredentials
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:73
cancellable
• Optional
cancellable: CancellableTask
<void
>
Cancellable task used to listen for new messages, stopping the Agent should also stop this from running and destroy the instance of the task until agent is started again
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:48
cancellables
• cancellables: CancellableTask
<any
>[] = []
An array with cancellable tasks, mainly used to store one or multiple didcomm connections in storage implementation at the same time. All of them can be cancelled despite they run asyncronously when the Edge agent stops
Implementation of
ConnectionsManagerInterface.cancellables
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:40
castor
• castor: Castor
Implementation of
ConnectionsManagerInterface.castor
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:70
events
• events: AgentMessageEvents
A list of public facing events which will notify the user interface when specific things happen, for now when new messages arrive or didcomm connections are established in order to make UI more reactive
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:57
mediationHandler
• mediationHandler: MediatorHandler
Implementation of
ConnectionsManagerInterface.mediationHandler
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:74
mercury
• mercury: Mercury
Implementation of
ConnectionsManagerInterface.mercury
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:71
options
• Optional
options: AgentOptions
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:76
pairings
• pairings: DIDPair
[] = []
Implementation of
ConnectionsManagerInterface.pairings
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:75
pluto
• pluto: Pluto
Implementation of
ConnectionsManagerInterface.pluto
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:72
Accessors
withWebsocketsExperiment
• get
withWebsocketsExperiment(): boolean
Returns
boolean
Implementation of
ConnectionsManagerInterface.withWebsocketsExperiment
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:81
Methods
addConnection
▸ addConnection(paired
): Promise
<void
>
Asyncronously add a didPair (didcomm connection) into pluto
Parameters
Name | Type |
---|---|
paired | DIDPair |
Returns
Promise
<void
>
Async
Implementation of
ConnectionsManagerInterface.addConnection
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:187
awaitMessageResponse
▸ awaitMessageResponse(id
): Promise
<undefined
| Message
>
Asyncronously wait for a message response just by waiting for new messages that match the specified ID
Parameters
Name | Type |
---|---|
id | string |
Returns
Promise
<undefined
| Message
>
Async
Implementation of
ConnectionsManagerInterface.awaitMessageResponse
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:120
findIndex
▸ findIndex(pair
): number
Find the specified did pair connection index
Parameters
Name | Type |
---|---|
pair | DIDPair |
Returns
number
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:211
processMessages
▸ processMessages(unreadMessages?
): Promise
<void
>
Asyncronously process unread messages that are received by either http or websockets didcomm transport This method replaces awaitMessages()
Parameters
Name | Type | Default value |
---|---|---|
unreadMessages | { attachmentId : string ; message : Message }[] | [] |
Returns
Promise
<void
>
Implementation of
ConnectionsManagerInterface.processMessages
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:131
registerMediator
▸ registerMediator(hostDID
): Promise
<void
>
Asyncronously establish mediator with a mediator by providing the Host DID
Parameters
Name | Type |
---|---|
hostDID | DID |
Returns
Promise
<void
>
Async
Implementation of
ConnectionsManagerInterface.registerMediator
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:242
removeConnection
▸ removeConnection(pair
): Promise
<void
>
Remove a didPair or a didcomm connection, this does not mean the mediator will do this but just means the connection will be removed from the current storage
Parameters
Name | Type |
---|---|
pair | DIDPair |
Returns
Promise
<void
>
Async
Implementation of
ConnectionsManagerInterface.removeConnection
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:228
sendMessage
▸ sendMessage(message
): Promise
<undefined
| Message
>
Asyncronously store a message and send it as didcomm message through the mercury implementation
Parameters
Name | Type |
---|---|
message | Message |
Returns
Promise
<undefined
| Message
>
Async
Implementation of
ConnectionsManagerInterface.sendMessage
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:253
startFetchingMessages
▸ startFetchingMessages(iterationPeriod
): Promise
<void
>
Asyncronously start fetching new messages
Parameters
Name | Type |
---|---|
iterationPeriod | number |
Returns
Promise
<void
>
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:264
startMediator
▸ startMediator(): Promise
<void
>
Asyncronously Start the mediator, just checking if we had one stored in Database and setting that one as default during the Agent start
Returns
Promise
<void
>
Async
Implementation of
ConnectionsManagerInterface.startMediator
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:92
stopAllEvents
▸ stopAllEvents(): void
Stops all the running events
Returns
void
Implementation of
ConnectionsManagerInterface.stopAllEvents
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:104
stopFetchingMessages
▸ stopFetchingMessages(): void
Asyncronously stop fetching messages
Returns
void