innmind/ssh-key-provider

Access user ssh keys from different locations

3.2.0 2023-11-01 07:55 UTC

This package is auto-updated.

Last update: 2024-11-30 02:13:37 UTC


README

Build Status codecov Type Coverage

Small library to retrieve all public keys from different locations.

Installation

composer require innmind/ssh-key-provider

Usage

use Innmind\OperatingSystem\Factory;
use Innmind\SshKeyProvider\{
    Cache,
    Merge,
    Local,
    Github,
};
use Innmind\Url\Path;

$os = Factory::build();
$provide = Cache::of(
    Merge::of(
        Local::of(
            $os->filesystem()->mount(Path::of($_SERVER['USER'].'/.ssh/')),
        ),
        Github::of(
            $os->remote()->http(),
            'GithubUsername',
        ),
    ),
);

$sshKeys = $provide();

This example will retrieve all keys define in the GithubUsername account and the key id_rsa.pub on the local machine.