github

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package github fetches SSH public keys from GitHub user profiles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchKeys

func FetchKeys(username string) ([]string, error)

FetchKeys fetches SSH keys using the default client (backward compat).

Types

type Client

type Client struct {
	BaseURL string
	HTTP    *http.Client
}

Client fetches SSH keys from GitHub's public API.

func NewClient

func NewClient() *Client

NewClient creates a GitHub client with a 10s timeout.

func (*Client) FetchKeys

func (c *Client) FetchKeys(ctx context.Context, username string) ([]string, error)

FetchKeys retrieves SSH public keys for a GitHub username. Returns the keys as a slice of strings (one per line from <BaseURL>/<user>.keys).

type KeyFetcher

type KeyFetcher interface {
	FetchKeys(ctx context.Context, username string) ([]string, error)
}

KeyFetcher fetches SSH public keys for a user.

type MockClient

type MockClient struct {
	Keys map[string][]string
	Err  error
}

MockClient is a test double for KeyFetcher.

func (*MockClient) FetchKeys

func (m *MockClient) FetchKeys(_ context.Context, username string) ([]string, error)

FetchKeys returns pre-configured keys or error for testing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL