SSH keys
Users keep their public SSH keys in Anikeen ID, so services can install them on servers.
The user's SSH keys (user token)
| Method | Path | Body |
|---|---|---|
GET | /api/v1/ssh-keys | – |
POST | /api/v1/ssh-keys | public_key (required), name |
GET | /api/v1/ssh-keys/{id} | – |
PUT | /api/v1/ssh-keys/{id} | name and/or public_key |
DELETE | /api/v1/ssh-keys/{id} | – |
Scopes: ssh-keys:read to read, ssh-keys to change.
public_keymust be a valid SSH public key (at most 16384 characters).nameis at most 255 characters. Without a name, the key's comment is used (orSSH key).
shell
curl -X POST https://id.anikeen.com/api/v1/ssh-keys \
-H 'Authorization: Bearer USER_TOKEN' \
-H 'Accept: application/json' -H 'Content-Type: application/json' \
-d '{"name": "Laptop", "public_key": "ssh-ed25519 AAAAC3Nza… ada@laptop"}'php
$key = $user->sshKeys()->create('ssh-ed25519 AAAAC3Nza… ada@laptop', 'Laptop');
$key->update('Work laptop');
$key->delete();
foreach ($user->sshKeys()->toArray() as $sshKey) {
echo $sshKey->name;
}SSH keys of any user (trusted apps)
http
GET /api/v1/client/users/{user}/ssh-keys
Authorization: Bearer APP_TOKENThe app token needs ssh-keys:read or ssh-keys, and the app must be trusted. Newest keys first.
php
$sshKeys = app(\Anikeen\Id\AnikeenId::class)->sshKeysByUserId($anikeenUserId);
foreach ($sshKeys->toArray() as $sshKey) {
echo $sshKey->name;
}