1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Async single-blob backend for the WASM persistent-provider path.
//!
//! [CR-4] The Sqlite variant uses synchronous local-file I/O; the IndexedDb
//! variant CAN'T because IDB is async-only on the web. Rather than introduce
//! a Rust-side IDB binding (extra wasm-bindgen surface + duplicate the host's
//! AES-GCM wrapper), the WASM build asks the host to round-trip a single
//! serialized snapshot blob through its existing encrypted-IDB storage layer
//! (`packages/ui/src/storage-mls/PingStorage.web.ts`).
//!
//! Why a separate trait from `ping_core::Storage`: this crate must NOT depend
//! on `ping-core` (the dep edge runs the other way). The host implements
//! this trait by wrapping its own `Storage` — typically writing the
//! snapshot under a reserved namespace + key (e.g. `("__mls", "snapshot")`)
//! so it sits alongside the metadata entries the host already manages.
use Future;
use Pin;
/// Future returned by [`AsyncBlobStore`] methods. Mirrors the
/// `Send`-bound pattern from `ping_core::storage::StorageFuture`: on native
/// targets the future must cross tokio threads, on WASM the runtime is
/// single-threaded and `JsFuture` is `!Send`.
pub type BlobFuture<'a, T> = ;
pub type BlobFuture<'a, T> = ;
/// Async single-blob storage. Reads + writes the entire MLS snapshot as one
/// opaque byte slab; the provider takes care of (de)serialising the
/// `MemoryStorage` HashMap inside that slab.
///
/// Native targets get `Send + Sync` so the provider can be shared across
/// tokio threads; WASM drops the bound to match `wasm-bindgen` + `JsFuture`
/// being `!Send`.
///
/// `Debug` is required so [`crate::StorageBackend`] can still derive `Debug`
/// without resorting to a manual impl on the enum.