magi-code 0.105.0

Repository-aware CLI coding agent for terminal work
Documentation
//! Credential data shared with configuration; resolution belongs to auth.

use std::fmt;

#[derive(Clone, PartialEq, Eq)]
pub(crate) enum ProviderCredential {
    ApiKey {
        key: String,
    },
    OAuth {
        access: String,
        account_id: Option<String>,
    },
    NoAuth,
}

impl fmt::Debug for ProviderCredential {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::ApiKey { .. } => f
                .debug_struct("ApiKey")
                .field("key", &"<redacted>")
                .finish(),
            Self::OAuth { account_id, .. } => f
                .debug_struct("OAuth")
                .field("access", &"<redacted>")
                .field("account_id", &account_id.as_ref().map(|_| "<redacted>"))
                .finish(),
            Self::NoAuth => f.debug_struct("NoAuth").finish(),
        }
    }
}