Skip to main content

phemios_core/
lib.rs

1//! Framework-independent Phémios client policies.
2#![warn(missing_docs)]
3pub mod cache;
4pub mod download;
5pub mod network;
6
7/// Current typed IPC contract understood by the web frontend.
8pub const BRIDGE_VERSION: u32 = 1;
9
10/// Validate the browser bridge before accepting a future native operation.
11pub fn validate_bridge(version: u32) -> Result<(), &'static str> {
12    if version == BRIDGE_VERSION {
13        Ok(())
14    } else {
15        Err("Incompatible Phémios desktop bridge. Update the application.")
16    }
17}
18
19#[cfg(test)]
20#[path = "lib_tests.rs"]
21mod tests;
22
23pub mod playback;
24
25pub mod radio;
26
27pub mod federation;
28pub mod local;
29
30/// Shared native service-key request policy.
31pub mod enrichment;
32
33/// Read-only discovery of OS-mounted player/card/drive destinations.
34pub mod volumes;
35
36pub mod podcast;
37
38/// Explicit LAN control of a separately installed HQPlayer engine.
39pub mod hqplayer;
40
41/// Explicit streaming downloads of public podcast enclosures.
42pub mod podcast_download;
43
44/// Explicit attributed public encyclopedia retrieval.
45pub mod encyclopedia;
46
47/// Validated system-browser handoff for explicit public source links.
48pub mod external_links;
49
50/// Explicit upcoming live music claims from a configured public provider.
51pub mod concerts;
52
53/// Native account-owned podcast subscriptions and listened evidence.
54pub mod podcast_store;
55mod private_storage;
56
57/// Account-private retained Wikipedia articles.
58pub mod article_store;
59mod private_documents;
60
61#[cfg(test)]
62#[path = "podcast_store_test_support.rs"]
63mod private_store_test_support;
64
65/// Explicit portable backups of account-private podcast and article documents.
66pub mod personal_backup;
67
68/// Public local server connection profiles, admitted before certificate trust.
69pub mod server_profile;
70
71/// Fill a bounded native-only transfer token without exposing a randomness command to the webview.
72pub fn transfer_random(bytes: &mut [u8]) -> Result<(), String> {
73    if bytes.len() > 64 {
74        return Err("Jeton de transfert invalide.".into());
75    }
76    getrandom::fill(bytes).map_err(|_| "Générateur de jeton indisponible.".into())
77}
78
79pub mod session_cleanup;