Skip to main content

rustify_licensing/core/
status.rs

1//! Runtime unlock status — the single bit the app gates features on.
2
3/// Runtime unlock status. `Active`/`Grace` both mean paid features are unlocked.
4/// `Active`/`Grace` mean paid features are unlocked.
5#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
6pub enum LicenseStatus {
7    /// Startup / a check is in flight — nothing decided yet.
8    #[default]
9    Unknown,
10    /// No key, an authoritative denial, or grace expired. Features off.
11    Locked,
12    /// Online validation succeeded. Features on.
13    Active,
14    /// Offline within the grace window off a cached validation. Features on.
15    Grace,
16}
17
18impl LicenseStatus {
19    /// Are paid features unlocked?
20    pub fn unlocked(self) -> bool {
21        matches!(self, LicenseStatus::Active | LicenseStatus::Grace)
22    }
23}