Skip to main content

Mercury

@hyperledger/identus-sdk v7.0.0


@hyperledger/identus-sdk / overview / Mercury

Class: Mercury

Defined in: src/mercury/Mercury.ts:19

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: src/mercury/Mercury.ts:27

Creates an instance of Mercury.

Parameters

ParameterTypeDescription
castorCastor
protocolDIDCommProtocol
apiApi

Returns

Mercury

Properties

PropertyModifierTypeDefined in
apipublicApisrc/mercury/Mercury.ts:30
castorpublicCastorsrc/mercury/Mercury.ts:28
protocolpublicDIDCommProtocolsrc/mercury/Mercury.ts:29

Methods

packMessage()

packMessage(message: Message): Promise<string>

Defined in: src/mercury/Mercury.ts:40

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: src/mercury/Mercury.ts:68

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: src/mercury/Mercury.ts:128

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: src/mercury/Mercury.ts:56

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