Function ic_cdk::api::set_certified_data

source ·
pub fn set_certified_data(data: &[u8])
Expand description

Sets the certified data of this canister.

Canisters can store up to 32 bytes of data that is certified by the system on a regular basis. One can call data_certificate function from a query call to get a certificate authenticating the value set by calling this function.

This function can only be called from the following contexts:

  • “canister_init”, “canister_pre_upgrade” and “canister_post_upgrade” hooks.
  • “canister_update” calls.
  • reply or reject callbacks.

§Panics

  • This function traps if data.len() > 32.
  • This function traps if it’s called from an illegal context (e.g., from a query call).