Skip to main content

@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

Constructors

constructor

new Mercury(castor, protocol, api): Mercury

Creates an instance of Mercury.

Parameters

NameType
castorCastor
protocolDIDCommProtocol
apiApi

Returns

Mercury

Defined in

src/mercury/Mercury.ts:29

Properties

api

api: Api

Defined in

src/mercury/Mercury.ts:32


castor

castor: Castor

Defined in

src/mercury/Mercury.ts:30


protocol

protocol: DIDCommProtocol

Defined in

src/mercury/Mercury.ts:31

Methods

getDIDCommDID

getDIDCommDID(document): undefined | DID

Parameters

NameType
documentDIDDocument

Returns

undefined | DID

Defined in

src/mercury/Mercury.ts:186


getDIDCommURL

getDIDCommURL(document): undefined | URL

Parameters

NameType
documentDIDDocument

Returns

undefined | URL

Defined in

src/mercury/Mercury.ts:177


makeRequest

makeRequest<T>(service, message): Promise<T>

Type parameters

Name
T

Parameters

NameType
serviceundefined | Service | URL
messagestring

Returns

Promise<T>

Defined in

src/mercury/Mercury.ts:101


notDid

notDid(did): did is undefined

Parameters

NameType
didundefined | DID

Returns

did is undefined

Defined in

src/mercury/Mercury.ts:142


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

NameType
messageMessage

Returns

Promise<string>

Implementation of

Mercury.packMessage

Defined in

src/mercury/Mercury.ts:42


prepareForwardMessage

prepareForwardMessage(msg, encrypted, mediatorDID): ForwardMessage

Parameters

NameType
msgMessage
encryptedstring
mediatorDIDDID

Returns

ForwardMessage

Defined in

src/mercury/Mercury.ts:158


requiresForwarding

requiresForwarding(document): boolean

Parameters

NameType
documentDIDDocument

Returns

boolean

Defined in

src/mercury/Mercury.ts:199


sendMessage

sendMessage<T>(message): Promise<T>

Asynchronously sends a given message and returns the response data.

Type parameters

Name
T

Parameters

NameType
messageMessage

Returns

Promise<T>

Async

Implementation of

Mercury.sendMessage

Defined in

src/mercury/Mercury.ts:70


sendMessageParseMessage

sendMessageParseMessage(message): Promise<undefined | Message>

Asynchronously sends a given message and returns the response message object.

Parameters

NameType
messageMessage

Returns

Promise<undefined | Message>

Async

Implementation of

Mercury.sendMessageParseMessage

Defined in

src/mercury/Mercury.ts:130


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

NameType
messagestring

Returns

Promise<Message>

Implementation of

Mercury.unpackMessage

Defined in

src/mercury/Mercury.ts:58