@atala/prism-wallet-sdk / Exports / Mercury
Class: Mercury
Mercury is a powerful and flexible library for working with decentralized identifiers and secure communications protocols. Whether you are a developer looking to build a secure and private messaging app or a more complex decentralized system requiring trusted peer-to-peer connections, Mercury provides the tools and features you need to establish, manage, and secure your communications easily.
Export
Mercury
Implements
Table of contents
Constructors
Properties
Methods
- getDIDCommDID
- getDIDCommURL
- makeRequest
- notDid
- packMessage
- prepareForwardMessage
- requiresForwarding
- sendMessage
- sendMessageParseMessage
- unpackMessage
Constructors
constructor
• new Mercury(castor
, protocol
, api
): Mercury
Creates an instance of Mercury.
Parameters
Name | Type |
---|---|
castor | Castor |
protocol | DIDCommProtocol |
api | Api |
Returns
Defined in
Properties
api
• api: Api
Defined in
castor
• castor: Castor
Defined in
protocol
• protocol: DIDCommProtocol
Defined in
Methods
getDIDCommDID
▸ getDIDCommDID(document
): undefined
| DID
Parameters
Name | Type |
---|---|
document | DIDDocument |
Returns
undefined
| DID
Defined in
getDIDCommURL
▸ getDIDCommURL(document
): undefined
| URL
Parameters
Name | Type |
---|---|
document | DIDDocument |
Returns
undefined
| URL
Defined in
makeRequest
▸ makeRequest<T
>(service
, message
): Promise
<T
>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
service | undefined | Service | URL |
message | string |
Returns
Promise
<T
>
Defined in
notDid
▸ notDid(did
): did is undefined
Parameters
Name | Type |
---|---|
did | undefined | DID |
Returns
did is undefined
Defined in
packMessage
▸ packMessage(message
): Promise
<string
>
Asynchronously packs a given message object into a string representation. This function may throw an error if the message object is invalid.
Parameters
Name | Type |
---|---|
message | Message |
Returns
Promise
<string
>
Implementation of
Defined in
prepareForwardMessage
▸ prepareForwardMessage(msg
, encrypted
, mediatorDID
): ForwardMessage
Parameters
Name | Type |
---|---|
msg | Message |
encrypted | string |
mediatorDID | DID |
Returns
ForwardMessage
Defined in
requiresForwarding
▸ requiresForwarding(document
): boolean
Parameters
Name | Type |
---|---|
document | DIDDocument |
Returns
boolean
Defined in
sendMessage
▸ sendMessage<T
>(message
): Promise
<T
>
Asynchronously sends a given message and returns the response data.
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
message | Message |
Returns
Promise
<T
>
Async
Implementation of
Defined in
sendMessageParseMessage
▸ sendMessageParseMessage(message
): Promise
<undefined
| Message
>
Asynchronously sends a given message and returns the response message object.
Parameters
Name | Type |
---|---|
message | Message |
Returns
Promise
<undefined
| Message
>
Async
Implementation of
Mercury.sendMessageParseMessage
Defined in
unpackMessage
▸ unpackMessage(message
): Promise
<Message
>
Asynchronously unpacks a given string representation of a message into a message object. This function may throw an error if the string is not a valid message representation.
Parameters
Name | Type |
---|---|
message | string |
Returns
Promise
<Message
>