pub fn msg_caller_info_data() -> Vec<u8> ⓘExpand description
Gets auxiliary data about the caller as provided by the canister with which the caller’s identity is associated.
This only returns non-empty data if the caller is a self-authenticating principal authenticated by canister signatures (e.g. Internet Identity). Returns empty bytes when the caller is another canister.
The data is guaranteed to be signed by the canister returned from msg_caller_info_signer,
so the signer should be checked before trusting the payload.
use ic_cdk::api::{msg_caller_info_data, msg_caller_info_signer};
if msg_caller_info_signer().is_some() {
let data = msg_caller_info_data();
// Decode per the signer's documented format (e.g. identity attributes).
}