provider-core 0.1.1

Provider abstractions for the SteadyMux local continuity router.
Documentation
// SPDX-License-Identifier: AGPL-3.0-or-later

//! Non-Unix compile-compatibility stub for the device-local credential store.
//!
//! The real store is Unix-only: it depends on owner-only permissions, inode
//! identity, hardlink detection, and process-group control. On Windows and
//! other non-Unix targets every operation fails closed with
//! `UnsupportedPlatform` while the shared public types remain available for
//! the CLI surface.

pub use crate::local_credential_types::*;
use std::path::PathBuf;
use zeroize::Zeroizing;

#[derive(Clone)]
pub struct LocalCredentialStore {
    _private: (),
}

impl std::fmt::Debug for LocalCredentialStore {
    fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        formatter
            .debug_struct("LocalCredentialStore")
            .field("root", &"[DEVICE_LOCAL]")
            .finish()
    }
}

impl LocalCredentialStore {
    pub fn production_setup_root_path() -> Result<PathBuf, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn ensure_production_setup_root() -> Result<PathBuf, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn production() -> Result<Self, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn production_existing() -> Result<Self, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn add(
        &self,
        _provider: &str,
        _label: &str,
        _secret: &[u8],
    ) -> Result<CredentialMetadata, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn rotate_preview(
        &self,
        _credential_ref: &str,
        _expires_at_epoch_seconds: u64,
    ) -> Result<CredentialLifecyclePreview, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn remove_preview(
        &self,
        _credential_ref: &str,
        _expires_at_epoch_seconds: u64,
    ) -> Result<CredentialLifecyclePreview, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn reconcile_rotate(
        &self,
        _credential_ref: &str,
        _request: CredentialLifecycleRequestIdentity<'_>,
    ) -> Result<CredentialRotationReconciliation, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn reconcile_remove(
        &self,
        _credential_ref: &str,
        _request: CredentialLifecycleRequestIdentity<'_>,
    ) -> Result<CredentialRemovalReconciliation, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn rotate_apply(
        &self,
        _credential_ref: &str,
        _secret: &[u8],
        _approval: CredentialLifecycleApproval<'_>,
    ) -> Result<CredentialLifecycleOutcome, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn remove_apply(
        &self,
        _credential_ref: &str,
        _approval: CredentialLifecycleApproval<'_>,
    ) -> Result<CredentialLifecycleOutcome, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn list(&self) -> Result<Vec<CredentialMetadata>, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn lock_inventory(&self) -> Result<CredentialInventoryGuard, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn lock_lifecycle_inventory(
        &self,
    ) -> Result<CredentialInventoryGuard, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn status(&self, _credential_ref: &str) -> Result<CredentialStatus, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn resolve(
        &self,
        _credential_ref: &str,
    ) -> Result<Zeroizing<Vec<u8>>, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn verify_available(&self, _credential_ref: &str) -> Result<(), CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }
}

pub struct CredentialInventoryGuard {
    _private: (),
}

impl CredentialInventoryGuard {
    pub fn credentials(&self) -> &[CredentialMetadata] {
        &[]
    }

    pub fn rotate_preview_with_bindings(
        &self,
        _credential_ref: &str,
        _bound_phases: &[String],
        _bound_routes: &[String],
        _expires_at_epoch_seconds: u64,
    ) -> Result<CredentialLifecyclePreview, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn remove_preview_with_bindings(
        &self,
        _credential_ref: &str,
        _bound_phases: &[String],
        _bound_routes: &[String],
        _expires_at_epoch_seconds: u64,
    ) -> Result<CredentialLifecyclePreview, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn reconcile_rotate(
        &self,
        _credential_ref: &str,
        _request: CredentialLifecycleRequestIdentity<'_>,
    ) -> Result<CredentialRotationReconciliation, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn reconcile_remove(
        &self,
        _credential_ref: &str,
        _request: CredentialLifecycleRequestIdentity<'_>,
    ) -> Result<CredentialRemovalReconciliation, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn rotate_apply_with_bindings(
        &self,
        _credential_ref: &str,
        _secret: &[u8],
        _approval: CredentialLifecycleApproval<'_>,
        _bound_phases: &[String],
        _bound_routes: &[String],
    ) -> Result<CredentialLifecycleOutcome, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn remove_apply_with_bindings(
        &self,
        _credential_ref: &str,
        _approval: CredentialLifecycleApproval<'_>,
        _bound_phases: &[String],
        _bound_routes: &[String],
    ) -> Result<CredentialLifecycleOutcome, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn verify_available(&self, _credential_ref: &str) -> Result<(), CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }

    pub fn status(&self, _credential_ref: &str) -> Result<CredentialStatus, CredentialStoreError> {
        Err(CredentialStoreError::UnsupportedPlatform)
    }
}