ic_dbms_canister/utils.rs
1mod trap;
2
3use candid::Principal;
4
5pub use self::trap::trap;
6
7/// Returns the caller's principal.
8pub fn caller() -> Principal {
9 #[cfg(target_family = "wasm")]
10 {
11 ic_cdk::api::msg_caller()
12 }
13 #[cfg(not(target_family = "wasm"))]
14 {
15 // dummy principal for non-wasm targets (e.g., during unit tests)
16 Principal::from_text("ghsi2-tqaaa-aaaan-aaaca-cai").expect("it should be valid")
17 }
18}