pub struct Credentials {
pub api_key: String,
pub user_id: String,
pub email: String,
pub name: Option<String>,
pub authenticated_at: DateTime<Utc>,
pub auth_url: String,
}Expand description
Stored credentials for authenticated user
Saved to ~/.mecha10/credentials.json after successful login.
Fields§
§api_key: StringUser’s API key for authenticating with control plane
user_id: StringUser ID from the auth system
email: StringUser’s email address
name: Option<String>User’s display name
authenticated_at: DateTime<Utc>When the credentials were obtained
auth_url: StringThe auth server URL used for authentication
Implementations§
Source§impl Credentials
impl Credentials
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Check if credentials appear valid (non-empty api_key).
No longer requires a mecha_ prefix: a CredentialsService::load() call can now
synthesize Credentials from MECHA10_API_KEY (control-plane service key, an
opaque shared secret with no fixed prefix convention) as well as from a real
device-code-login UserApiKey (which does happen to be mecha_-prefixed). Both are
“appears valid” in the same sense here - actual key validity is always determined
server-side (mecha10-api’s jobs::auth::AuthUser), never locally.
Sourcepub fn masked_api_key(&self) -> String
pub fn masked_api_key(&self) -> String
Get a masked version of the API key for display
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
Get display name (name if available, otherwise email)
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Credentials
impl Debug for Credentials
Source§impl<'de> Deserialize<'de> for Credentials
impl<'de> Deserialize<'de> for Credentials
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Credentials, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Credentials, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Credentials
impl Serialize for Credentials
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnsafeUnpin for Credentials
impl UnwindSafe for Credentials
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more