Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion SE050Sim/se050-sim/src/bin/tcp_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,16 @@ fn main() {

eprintln!("[se050-sim] Listening on port {}", port);

let store = Arc::new(Mutex::new(ObjectStore::new()));
// Optional persistence: with SE050_SIM_STORE=/path/store.json the object store survives
// restarts, like a real secure element keeps its objects across power cycles.
let store = match std::env::var("SE050_SIM_STORE") {
Ok(path) if !path.is_empty() => {
eprintln!("[se050-sim] Persisting objects to {}", path);
ObjectStore::with_persistence(std::path::PathBuf::from(path))
}
_ => ObjectStore::new(),
};
let store = Arc::new(Mutex::new(store));

for stream in listener.incoming() {
match stream {
Expand Down