Skip to main content

Mercury

@hyperledger/identus-sdk v8.0.0


@hyperledger/identus-sdk / overview / Mercury

Class: Mercury

Defined in: packages/lib/sdk/src/mercury/index.ts:23

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.

Mercury

Implements

Constructors

Constructor

new Mercury(castor: Castor, protocol: DIDCommProtocol, api: Api): Mercury

Defined in: packages/lib/sdk/src/mercury/index.ts:31

Creates an instance of Mercury.

Parameters

ParameterTypeDescription
castorCastor-
protocolDIDCommProtocol-
apiApi-

Returns

Mercury

Properties

PropertyModifierTypeDefined in
apipublicApipackages/lib/sdk/src/mercury/index.ts:34
castorpublicCastorpackages/lib/sdk/src/mercury/index.ts:32
protocolpublicDIDCommProtocolpackages/lib/sdk/src/mercury/index.ts:33

Methods

packMessage()

packMessage(message: Message): Promise<string>

Defined in: packages/lib/sdk/src/mercury/index.ts:44

Asynchronously packs a given message object into a string representation. This function may throw an error if the message object is invalid.

Parameters

ParameterTypeDescription
messageMessage-

Returns

Promise<string>

Implementation of

Mercury.packMessage


sendMessage()

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

Defined in: packages/lib/sdk/src/mercury/index.ts:72

Asynchronously sends a given message and returns the response data.

Type Parameters

Type ParameterDescription
T

Parameters

ParameterTypeDescription
messageMessage-

Returns

Promise<T>

Implementation of

Mercury.sendMessage


sendMessageParseMessage()

sendMessageParseMessage(message: Message): Promise<Message | undefined>

Defined in: packages/lib/sdk/src/mercury/index.ts:132

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

Parameters

ParameterTypeDescription
messageMessage-

Returns

Promise<Message | undefined>

Implementation of

Mercury.sendMessageParseMessage


unpackMessage()

unpackMessage(message: string): Promise<Message>

Defined in: packages/lib/sdk/src/mercury/index.ts:60

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

ParameterTypeDescription
messagestring-

Returns

Promise<Message>

Implementation of

Mercury.unpackMessage