Documentation
¶
Overview ¶
The tokenauth command demonstrates using the oauth2.StaticTokenSource.
Index ¶
- Variables
- func GetCurrentUsername(githubClient *github.Client) (string, error)
- func GetGithubClient(token string) *github.Client
- func GetPublicKeyFromGithubUnauthenticated(githubClient *github.Client, username string, ...) (*rsa.PublicKey, error)
- func UploadPublicKeyToGithub(githubClient *github.Client, publicKey string) error
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 GetGithubClient ¶
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.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.