ic-auth 0.48.6

Canonical authentication, proof verification and bounded receiver/issuer state with optional stable upgrade checkpoints
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use ic_storage::{
    AllocationGrants, GenericAllocationPolicy, MemoryAuthority, MemoryRequest, MemoryRuntime,
    RuntimeMemory, SealedDeclarationSnapshot, StableKey, VectorMemory,
};

pub fn lease(backing: &VectorMemory) -> RuntimeMemory<VectorMemory> {
    let mut host = MemoryRuntime::new(backing.clone()).unwrap();
    let name = "auth.test.v1";
    let requests =
        SealedDeclarationSnapshot::new(vec![MemoryRequest::new("auth", name).unwrap()]).unwrap();
    let grants =
        AllocationGrants::new(vec![MemoryAuthority::new("auth", "auth.").unwrap()]).unwrap();
    host.bootstrap(&requests, &grants, &GenericAllocationPolicy)
        .unwrap();
    host.open_memory(&StableKey::parse(name).unwrap()).unwrap()
}