innmind/ssh-key-provider

从不同位置访问用户SSH密钥

3.2.0 2023-11-01 07:55 UTC

This package is auto-updated.

Last update: 2024-08-30 01:38:12 UTC


README

Build Status codecov Type Coverage

一个用于从不同位置检索所有公钥的小型库。

安装

composer require innmind/ssh-key-provider

用法

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();

以下示例将检索在 GithubUsername 账户中定义的所有密钥以及本地机器上的 id_rsa.pub 密钥。