pub use tilo_platform_caps::{Availability, availability, available};
pub type Unsupported = tilo_platform_caps::Unsupported<Feature>;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Feature {
Store,
OsKeychain,
Blocking,
}
pub(crate) const WEB_KEYCHAIN: &str =
"Browsers have no keychain; Tilo encrypts secrets with a key the browser keeps.";
pub(crate) const WEB_BLOCKING: &str = "The browser's storage answers asynchronously.";
impl tilo_platform_caps::Feature for Feature {
fn targets(self) -> [Availability; 3] {
use Availability::{Available, Unsupported};
match self {
Self::Store => [Available, Available, Available],
Self::OsKeychain => [Available, Available, Unsupported(WEB_KEYCHAIN)],
Self::Blocking => [Available, Available, Unsupported(WEB_BLOCKING)],
}
}
}