new RiseMessage(solution, bodyopt, headopt)
Interface allowing for authenticated message exchange.
Name | Type | Attributes | Description |
---|---|---|---|
solution | module:rise~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.
- Object.<string, string> |
string
head :module:rise~RiseMessage~Head
Default message headers, plus any custom ones supplied.
Methods
encrypt(publicKey) → {module:rise~EncryptedRiseMessage}
Encrypts the message state for the public key provided.
Name | Type | Description |
---|---|---|
publicKey | Uint8Array | | Recipient public key. |
sign(privateKey) → {module:rise~SignedRiseMessage}
Signs the message state using the private key provided.
Name | Type | Description |
---|---|---|
privateKey | Uint8Array | | Identity to use for signature. |
toBuffer() → {buffer}
Serializes the message to wire format.
- Type:
- buffer
unwrap() → {Object.<string, (string|module:rise~RiseMessage|module:rise~EncryptedRiseMessage|module:rise~SignedRiseMessage|string)>}
Returns only the body of this message.
- Type:
- Object.<string, (string|module:rise~RiseMessage|module:rise~EncryptedRiseMessage|module:rise~SignedRiseMessage|string)>
validate() → {boolean}
Ensures the solution header is valid.
- Type:
- boolean
(static) fromBuffer(message) → {module:rise~RiseMessage|module:rise~EncryptedRiseMessage|module:rise~SignedRiseMessage}
Creates a new message instance from the serialized message.
Name | Type | Description |
---|---|---|
message | buffer | Binary blob to deserialize. |
Type Definitions
Head
Protocol headers included in every rise message.
- object
Name | Type | Description |
---|---|---|
nonce | string | One-time token to prevent replay attacks. |
version | string | Version of the rise package. Analagous to user agent. |
ciphertext | boolean | Indicates if the message body should be treated as ciphertext (it is encrypted). |
solution | module:rise~RiseSolution | Sender authentication data. |