Skip to main content
Version: v1.2

Message

Notice

An encrypted command and signature.

Table of contents​

Constructors​

Properties​

Methods​

Constructors​

constructor​

• new Message(msgType, data): Message

Create a new instance of a Message

Parameters​

NameTypeDescription
msgTypebigintthe type of the message
databigint[]the data of the message

Returns​

Message

Defined in​

message.ts:23

Properties​

data​

• data: bigint[]

Defined in​

message.ts:14


msgType​

• msgType: bigint

Defined in​

message.ts:12


DATA_LENGTH​

▪ Static DATA_LENGTH: number = 10

Defined in​

message.ts:16

Methods​

asArray​

▸ asArray(): bigint[]

Return the message as an array of bigints

Returns​

bigint[]

the message as an array of bigints

Defined in​

message.ts:33


asCircuitInputs​

▸ asCircuitInputs(): bigint[]

Return the message as a circuit input

Returns​

bigint[]

the message as a circuit input

Defined in​

message.ts:48


asContractParam​

▸ asContractParam(): IMessageContractParams

Return the message as a contract param

Returns​

IMessageContractParams

the message as a contract param

Defined in​

message.ts:39


copy​

▸ copy(): Message

Create a copy of the message

Returns​

Message

a copy of the message

Defined in​

message.ts:61


equals​

▸ equals(m): boolean

Check if two messages are equal

Parameters​

NameTypeDescription
mMessagethe message to compare with

Returns​

boolean

the result of the comparison

Defined in​

message.ts:72


hash​

▸ hash(encPubKey): bigint

Hash the message data and a public key

Parameters​

NameTypeDescription
encPubKeyPubKeythe public key that is used to encrypt this message

Returns​

bigint

the hash of the message data and the public key

Defined in​

message.ts:55


toJSON​

▸ toJSON(): IMessageContractParams

Serialize to a JSON object

Returns​

IMessageContractParams

Defined in​

message.ts:86


fromJSON​

▸ fromJSON(json): Message

Deserialize into a Message instance

Parameters​

NameTypeDescription
jsonIMessageContractParamsthe json representation

Returns​

Message

the deserialized object as a Message instance

Defined in​

message.ts:95