Laravel AT Protocol Client (alpha & unstable)
1<?php
2
3namespace SocialDept\AtpClient\Data;
4
5use SocialDept\AtpClient\Enums\AuthType;
6
7class Credentials
8{
9 public function __construct(
10 public readonly string $did,
11 public readonly string $accessToken,
12 public readonly string $refreshToken,
13 public readonly \DateTimeInterface $expiresAt,
14 public readonly ?string $handle = null,
15 public readonly ?string $issuer = null,
16 public readonly array $scope = [],
17 public readonly AuthType $authType = AuthType::OAuth,
18 ) {}
19
20 public function isExpired(): bool
21 {
22 return now()->isAfter($this->expiresAt);
23 }
24
25 public function expiresIn(): int
26 {
27 return now()->diffInSeconds($this->expiresAt, false);
28 }
29}