chromeauth

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 35 Imported by: 0 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

Index

Constants

View Source
const Supported = false

Supported 表示本平台能从 Chrome 导入账户

Variables

View Source
var ErrCredentialsRejected = errors.New("Chrome OAuth 续签材料失效")

ErrCredentialsRejected 表示上游已拒绝保存的 Chrome 续签材料

View Source
var ErrSignedOut = errors.New("Cookie 未登录 AI Studio 或已失效")

ErrSignedOut 表示 Cookie 打开 AI Studio 时被转到登录页

Functions

func DebugAddresses added in v0.2.14

func DebugAddresses(ctx context.Context) ([]string, error)

DebugAddresses 从本机进程命令行找出开启远程调试端口的 Chromium 浏览器,返回去重排序后的 127.0.0.1:端口

func DebugBrowserName added in v0.2.14

func DebugBrowserName(ctx context.Context, address string) (string, error)

DebugBrowserName 返回远程调试地址对应浏览器的产品名与版本

func DefaultChromeRoot

func DefaultChromeRoot() (string, error)

DefaultChromeRoot 返回稳定版 Chrome User Data 目录

func Refresh

Refresh 以导入来源 Chrome profile 的身份使用保存的 OAuth 续签材料重新签发 Google Cookie,来源未记录目录时使用稳定版 Chrome 目录

Types

type Account

type Account struct {
	ID          string `json:"id"`
	GaiaID      string `json:"-"`
	Profile     string `json:"profile"`
	DisplayName string `json:"display_name"`
	Email       string `json:"email"`
	Locale      string `json:"locale"`
	Importable  bool   `json:"importable"`
}

Account 描述本机 Chrome 中可发现的 Google 账号

func Discover

func Discover(string) ([]Account, error)

Discover 只读列出本机 Chrome Google 账号

type CDPBrowser added in v0.2.14

type CDPBrowser struct {
	Cookies  string
	Locale   string
	Timezone string
}

CDPBrowser 是经远程调试地址读取的浏览器 Cookie 与页面语言、时区

func ReadCDPBrowser added in v0.2.14

func ReadCDPBrowser(ctx context.Context, address string) (CDPBrowser, error)

ReadCDPBrowser 经 Chromium 远程调试地址读取浏览器全部未分区 Cookie,并在第一个页面中读取 navigator.language 与 Intl 时区,没有页面时语言与时区为空

type CookieAccount added in v0.2.17

type CookieAccount struct {
	AuthUser int
	Email    string
}

CookieAccount 是同一份 Cookie 中一个 Google 会话序号上登录 AI Studio 的账户

func DiscoverCookieAccounts added in v0.2.17

func DiscoverCookieAccounts(ctx context.Context, state *aistudio.StorageState, proxy string) ([]CookieAccount, error)

DiscoverCookieAccounts 从 u/0 起依次打开 Cookie 中各会话的对话页,返回各序号登录的账户,序号不存在或账户与前面重复时结束

type ImportOptions

type ImportOptions struct {
	AccountIDs []string
	ChromeRoot string
	Proxy      string
	Profiles   []string
	Emails     []string
}

ImportOptions 保存 Chrome 批量导入参数

type ImportResult

type ImportResult struct {
	Profile     string
	DisplayName string
	Email       string
	Locale      string
	CookieCount int
	State       aistudio.StorageState
}

ImportResult 返回一个已验证前的账号状态

func Import

func Import(ctx context.Context, options ImportOptions) ([]ImportResult, error)

Import 用本机 Chrome 的 OAuth 续签材料生成 Playwright storage state

type Verification

type Verification struct {
	Email      string
	ModelCount int
}

Verification 保存 AI Studio 登录页与模型目录验收结果

func VerifyAuthUser added in v0.2.17

func VerifyAuthUser(ctx context.Context, state *aistudio.StorageState, proxy string, authUser int) (Verification, error)

VerifyAuthUser 验证 Cookie 中第 authUser 个会话的账号可访问 WAA 页面并读取实时模型目录

Jump to

Keyboard shortcuts

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