auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package auth は GitHub のアクセストークンを解決するロジックを提供します。

解決の優先順位は次のとおりです:

  1. gh CLI (`gh auth token`)
  2. 設定ファイル (~/.config/ghs/config.toml の github_token)

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrGHNotInstalled は gh CLI 自体が PATH 上に存在しないことを示します。
	ErrGHNotInstalled = errors.New("gh CLI がインストールされていません")
	// ErrGHNotAuthenticated は gh CLI が未ログイン状態であることを示します。
	ErrGHNotAuthenticated = errors.New("gh CLI で認証されていません")
)
View Source
var ErrTokenNotFound = errors.New("github のアクセストークンが見つかりません")

ErrTokenNotFound は GitHub トークンを取得できなかったときに返されます。

Functions

This section is empty.

Types

type Result

type Result struct {
	Token  string
	Source Source
}

Result はトークン解決の結果を表します。

func ResolveToken

func ResolveToken(fallbackToken string) (*Result, error)

ResolveToken は優先順位に従って GitHub トークンを取得します。 fallbackToken には設定ファイルから読み込んだトークンを渡します。

type Source

type Source string

Source はトークンの取得元を表します。

const (
	// SourceGHCLI は gh CLI からトークンを取得したことを表します。
	SourceGHCLI Source = "gh CLI"
	// SourceConfig は設定ファイルからトークンを取得したことを表します。
	SourceConfig Source = "config.toml"
)

Jump to

Keyboard shortcuts

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