githubapi

package
v0.0.0-...-fddcde1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

The tokenauth command demonstrates using the oauth2.StaticTokenSource.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoValidKeys = errors.New("no valid keys found for user")
View Source
var ErrTooManyValidKeys = errors.New("multiple valid keys found for user; can't decide")
View Source
var PublicKeyName = "send-me-a-secret-jwpyl"

PublicKeyName is just a random string used as the public key name so it doesn't accidentally collide with other public keys that the user might have. Don't change this string!

Functions

func GetCurrentUsername

func GetCurrentUsername(githubClient *github.Client) (string, error)

func GetGithubClient

func GetGithubClient(token string) *github.Client

func GetPublicKeyFromGithubUnauthenticated

func GetPublicKeyFromGithubUnauthenticated(githubClient *github.Client,
	username string, isValidKey func(*rsa.PublicKey) bool) (*rsa.PublicKey, error)

GetPublicKeyFromGithubUnauthenticated fetches an rsa key from `username` on github with the correct keyLength. (keyLength is hackily used to identify keys generated for send-me-a-secret, since the title is not publicly available.) If there are no valid keys or if there is more than one matching key, this returns an error.

func UploadPublicKeyToGithub

func UploadPublicKeyToGithub(githubClient *github.Client, publicKey string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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