pub struct ClerkAuth { /* private fields */ }Expand description
Manages the Clerk cookie and the JWT lifecycle for one account.
Implementations§
Source§impl ClerkAuth
impl ClerkAuth
Sourcepub fn user_id(&self) -> Option<&str>
pub fn user_id(&self) -> Option<&str>
The Suno user ID, available after authenticate.
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
The account display name, or "Suno" when none is known.
Sourcepub async fn authenticate(&mut self, http: &impl Http) -> Result<String>
pub async fn authenticate(&mut self, http: &impl Http) -> Result<String>
Fetch the Clerk session and a first JWT, returning the user ID.
Sourcepub async fn ensure_jwt(&mut self, http: &impl Http) -> Result<String>
pub async fn ensure_jwt(&mut self, http: &impl Http) -> Result<String>
Return a valid JWT, refreshing it when missing or near expiry.
Sourcepub fn invalidate_jwt(&mut self)
pub fn invalidate_jwt(&mut self)
Drop the cached JWT so the next ensure_jwt refreshes.
Auto Trait Implementations§
impl Freeze for ClerkAuth
impl RefUnwindSafe for ClerkAuth
impl Send for ClerkAuth
impl Sync for ClerkAuth
impl Unpin for ClerkAuth
impl UnsafeUnpin for ClerkAuth
impl UnwindSafe for ClerkAuth
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
Mutably borrows from an owned value. Read more