Show / Hide Table of Contents

Interface IMessageCodec<T>

Namespace: Libplanet.Net.Messages
Assembly: Libplanet.Net.dll
Syntax
public interface IMessageCodec<T>
Type Parameters
Name Description
T

Methods

| Improve this Doc View Source

Decode(T, Boolean)

Decodes given -typed encoded into Message and checks its validity. Encode(Message, PrivateKey, AppProtocolVersion, BoundPeer, DateTimeOffset)

Declaration
Message Decode(T encoded, bool reply)
Parameters
Type Name Description
T encoded

A -typed instance to parse.

Boolean reply

A flag to express whether the target is a reply of other message.

Returns
Type Description
Message

A Message parsed from encoded.

Exceptions
Type Condition
InvalidMessageSignatureException

Thrown when the signer of encoded is invalid.

| Improve this Doc View Source

Encode(Message, PrivateKey, AppProtocolVersion, BoundPeer, DateTimeOffset)

Encodes the message to -typed instance with given privateKey and peer.

Declaration
T Encode(Message message, PrivateKey privateKey, AppProtocolVersion appProtocolVersion, BoundPeer peer, DateTimeOffset timestamp)
Parameters
Type Name Description
Message message

The message to encode.

PrivateKey privateKey

The PrivateKey to sign the encoded message.

AppProtocolVersion appProtocolVersion

The AppProtocolVersion of the transport layer.

BoundPeer peer

The BoundPeer-typed representation of the transport layer. AsPeer

DateTimeOffset timestamp

The of the time message is encoded.

Returns
Type Description
T

A containing the signed Message.

Exceptions
Type Condition
InvalidCredentialException

Thrown when privateKey's PublicKey does not match that of peer.

  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2022 Planetarium