verity_ic/whitelist/
mod.rs1use std::{cell::RefCell, collections::HashMap};
6
7use candid::Principal;
8
9thread_local! {
10 pub static WHITE_LIST: RefCell<HashMap<Principal, bool>> = RefCell::default();
12}
13
14pub fn add_to_whitelist(principal: Principal) {
16 WHITE_LIST.with(|rc| rc.borrow_mut().insert(principal, true));
17}
18
19pub fn remove_from_whitelist(principal: Principal) {
21 WHITE_LIST.with(|rc| rc.borrow_mut().remove(&principal));
22}
23
24pub fn is_whitelisted(principal: Principal) -> bool {
27 WHITE_LIST.with(|rc| rc.borrow().clone().contains_key(&principal))
28}