Laravel AT Protocol Client (alpha & unstable)
1<?php
2
3namespace SocialDept\AtpClient\Session;
4
5use SocialDept\AtpClient\Data\Credentials;
6use SocialDept\AtpClient\Data\DPoPKey;
7
8class Session
9{
10 public function __construct(
11 protected Credentials $credentials,
12 protected DPoPKey $dpopKey,
13 protected string $pdsEndpoint,
14 ) {}
15
16 public function identifier(): string
17 {
18 return $this->credentials->identifier;
19 }
20
21 public function did(): string
22 {
23 return $this->credentials->did;
24 }
25
26 public function accessToken(): string
27 {
28 return $this->credentials->accessToken;
29 }
30
31 public function refreshToken(): string
32 {
33 return $this->credentials->refreshToken;
34 }
35
36 public function dpopKey(): DPoPKey
37 {
38 return $this->dpopKey;
39 }
40
41 public function pdsEndpoint(): string
42 {
43 return $this->pdsEndpoint;
44 }
45
46 public function isExpired(): bool
47 {
48 return $this->credentials->isExpired();
49 }
50
51 public function expiresIn(): int
52 {
53 return $this->credentials->expiresIn();
54 }
55
56 public function withCredentials(Credentials $credentials): self
57 {
58 return new self($credentials, $this->dpopKey, $this->pdsEndpoint);
59 }
60}