Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950<?php
declare(strict_types=1);
namespace Wotnak\Atproto\Auth;
use Psr\Http\Message\RequestInterface;use Wotnak\Atproto\Client\AuthenticatedSessionInterface;
/** * Authenticated session for com.atproto.server credential sessions. * * @api */final readonly class AtprotoAuthenticatedSession implements AuthenticatedSessionInterface {
public function __construct( private AtprotoSession $session, ) {}
/** * Returns the access token. */ public function getAccessToken(): string { return $this->session->accessJwt; }
/** * Adds authentication proof to the request. */ public function sign(RequestInterface $request): RequestInterface { return $request->withHeader('Authorization', 'Bearer ' . $this->session->accessJwt); }
/** * Returns the subject DID. */ public function getSubjectDid(): string { return $this->session->did; }
/** * Returns the PDS URL. */ public function getPdsUrl(): ?string { return $this->session->pdsUrl; }
}