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
| Name | Type | Description |
|---|---|---|
msgType | bigint | the type of the message |
data | bigint[] | the data of the message |
Returns
Defined in
Properties
data
• data: bigint[]
Defined in
msgType
• msgType: bigint
Defined in
DATA_LENGTH
▪ Static DATA_LENGTH: number = 10
Defined in
Methods
asArray
▸ asArray(): bigint[]
Return the message as an array of bigints
Returns
bigint[]
the message as an array of bigints
Defined in
asCircuitInputs
▸ asCircuitInputs(): bigint[]
Return the message as a circuit input
Returns
bigint[]
the message as a circuit input
Defined in
asContractParam
▸ asContractParam(): IMessageContractParams
Return the message as a contract param
Returns
the message as a contract param
Defined in
copy
▸ copy(): Message
Create a copy of the message
Returns
a copy of the message
Defined in
equals
▸ equals(m): boolean
Check if two messages are equal
Parameters
| Name | Type | Description |
|---|---|---|
m | Message | the message to compare with |
Returns
boolean
the result of the comparison
Defined in
hash
▸ hash(encPubKey): bigint
Hash the message data and a public key
Parameters
| Name | Type | Description |
|---|---|---|
encPubKey | PubKey | the public key that is used to encrypt this message |
Returns
bigint
the hash of the message data and the public key
Defined in
toJSON
▸ toJSON(): IMessageContractParams
Serialize to a JSON object
Returns
Defined in
fromJSON
▸ fromJSON(json): Message
Deserialize into a Message instance
Parameters
| Name | Type | Description |
|---|---|---|
json | IMessageContractParams | the json representation |
Returns
the deserialized object as a Message instance