pub enum Auth {
Session(SessionAuth),
Oauth(OauthPlaceholder),
Anonymous,
}Expand description
The auth material a PdsClient carries.
A small enum rather than a bare string, so the match stays exhaustive if a second direct-auth mechanism is added alongside app-password sessions.
Variants§
Session(SessionAuth)
A bearer access token from a com.atproto.server.createSession
(app-password) session. This is the direct-PDS auth used by local runs
and tests; the live web path authenticates via the OAuth sidecar instead
(see SidecarClient).
Oauth(OauthPlaceholder)
The atproto OAuth confidential-client path is handled entirely by the
@atproto/oauth-client sidecar (SidecarClient), which mints, DPoP-binds,
and refreshes tokens. The direct PdsClient does not carry OAuth tokens;
this variant is a placeholder so the Auth enum documents that the OAuth
path lives elsewhere.
Anonymous
No credentials at all — an unauthenticated public read of a repo the
caller does not own. com.atproto.repo.listRecords is public on a
standard PDS, so a stranger’s community.lexicon.rss.* records can be
read with no session; this variant makes that expressible without
inventing a fake token.
A client holding it is read-only: Auth::bearer returns an error,
so every write path (create_record / put_record / delete_record /
apply_writes, all of which go through
authed_headers) fails closed. Construct one
via PdsClient::anonymous.
Implementations§
Source§impl Auth
impl Auth
Sourcepub fn bearer(&self) -> Result<&str>
pub fn bearer(&self) -> Result<&str>
The bearer access token to present on com.atproto.repo.* calls.
Only Auth::Session carries a token (the session’s accessJwt).
Auth::Oauth carries none — the sidecar owns the OAuth path — so it
returns an error pointing callers at SidecarClient. Auth::Anonymous
carries none by construction, which is what makes an anonymous client
read-only.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Auth
impl RefUnwindSafe for Auth
impl Send for Auth
impl Sync for Auth
impl Unpin for Auth
impl UnsafeUnpin for Auth
impl UnwindSafe for Auth
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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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