Rust

store

Module

Session data carried between requests in a cookie or header.

Contents

use utopia_auth::Store;
Rust
pub struct Store

Session data carried in a cookie or header: properties encoded as base64 JSON, plus an optional key naming it.

Rust
use php_std::Value;
use utopia_auth::Store;

let mut store = Store::new();
store.set_property(b"id", Value::from("u1"));
assert_eq!(store.encode()?, "eyJpZCI6InUxIn0=");

let mut decoded = Store::new();
decoded.decode(b"eyJpZCI6InUxIn0=");
assert_eq!(decoded.property(b"id"), Some(&Value::from("u1")));
assert_eq!(decoded.property(b"missing"), None);
Also implements Default.