new RiseMessage(solution, bodyopt, headopt)
Interface allowing for authenticated message exchange.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
solution | RiseSolution | Identity solution data. | |
body | Object.<string, string> | <optional> | Key-value data to include. |
head | Object.<string, string> | <optional> | Additional headers. |
Members
body :Object.<string, string>|string
Key-value pairs given for the message.
Type:
- Object.<string, string> |
string
head :RiseMessage~Head
Default message headers, plus any custom ones supplied.
Type:
Methods
encrypt(publicKey) → {EncryptedRiseMessage}
Encrypts the message state for the public key provided.
Parameters:
| Name | Type | Description |
|---|---|---|
publicKey | Uint8Array | | Recipient public key. |
Returns:
- Type:
- EncryptedRiseMessage
sign(privateKey) → {SignedRiseMessage}
Signs the message state using the private key provided.
Parameters:
| Name | Type | Description |
|---|---|---|
privateKey | Uint8Array | | Identity to use for signature. |
Returns:
- Type:
- SignedRiseMessage
toBuffer() → {buffer}
Serializes the message to wire format.
Returns:
- Type:
- buffer
unwrap() → {Object.<string, (string|RiseMessage|EncryptedRiseMessage|SignedRiseMessage|string)>}
Returns only the body of this message.
Returns:
- Type:
- Object.<string, (string|RiseMessage|EncryptedRiseMessage|SignedRiseMessage|string)>
validate() → {boolean}
Ensures the solution header is valid.
Returns:
- Type:
- boolean
(static) fromBuffer(message) → {RiseMessage|EncryptedRiseMessage|SignedRiseMessage}
Creates a new message instance from the serialized message.
Parameters:
| Name | Type | Description |
|---|---|---|
message | buffer | Binary blob to deserialize. |
Returns:
- Type:
- RiseMessage |
EncryptedRiseMessage | SignedRiseMessage