#[non_exhaustive]pub enum MessageOrigin {
WebApp(ContractInstanceId),
Delegate(DelegateKey),
}Expand description
Identifies where an inbound application message originated from.
When a web app sends a message to a delegate through the WebSocket API with
an authentication token, the runtime resolves the token to the originating
contract and wraps it in MessageOrigin::WebApp. When one delegate sends a
message to another via OutboundDelegateMsg::SendDelegateMessage, the
runtime attests the caller’s identity in MessageOrigin::Delegate.
Delegates receive this as the origin parameter of
DelegateInterface::process.
This enum is #[non_exhaustive]: downstream code matching on it must
include a wildcard arm so future variants can be added without a
source-level breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
WebApp(ContractInstanceId)
The message was sent by a web application backed by the given contract.
Delegate(DelegateKey)
The message was sent by another delegate via
OutboundDelegateMsg::SendDelegateMessage. The carried key is the
runtime-attested identity of the calling delegate; the receiver can
trust it to make authorization decisions.
Note: an inter-delegate message replaces rather than composes with
any inherited WebApp origin the calling delegate may itself hold.
The receiver sees only Delegate(caller_key) for the duration of the
call, and does not gain contract access on behalf of any web app the
caller was acting for. Authorization should be made on the calling
delegate’s identity alone.
Trait Implementations§
Source§impl Clone for MessageOrigin
impl Clone for MessageOrigin
Source§fn clone(&self) -> MessageOrigin
fn clone(&self) -> MessageOrigin
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more