Files
id/src/Id/Concerns/ManagesSshKeys.php
2025-09-21 17:12:19 +00:00

28 lines
583 B
PHP

<?php
namespace Anikeen\Id\Concerns;
use Anikeen\Id\ApiOperations\Get;
use Anikeen\Id\Resources\SshKeys;
use Throwable;
trait ManagesSshKeys
{
use Get;
/**
* Get currently authed user with Bearer Token.
*
* @throws Throwable
*/
public function sshKeysByUserId(string $sskKeyId): SshKeys
{
if (!isset($this->sshKeysCache)) {
$this->sshKeysCache = SshKeys::builder(fn() => $this->get(sprintf('v1/users/%s/ssh-keys/json', $sskKeyId)))
->setParent($this);
}
return $this->sshKeysCache;
}
}