chromeauth

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 40 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 ErrBoundSessionRejected = errors.New("Google DBSC 会话刷新被拒绝")

ErrBoundSessionRejected 表示 Google 拒绝刷新保存的 DBSC 会话

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 CheckAccess added in v0.3.7

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

CheckAccess 以 Cookie 中第 authUser 个会话打开对话页并读取 GetLoggingContext,返回页面中登录账户的邮箱;Google 拒绝该账户使用 AI Studio 时返回官网跳转页对应的原因,出口地区不受支持不算拒绝

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,并返回 google.com 的 DBSC 会话登记

func RotateBoundCookies added in v0.3.3

func RotateBoundCookies(ctx context.Context, state aistudio.StorageState, extension aistudio.AuthExtension, proxy string) ([]string, error)

RotateBoundCookies 按 Chromium RegistrationFetcher 的刷新流程以设备绑定密钥刷新 google.com 的 DBSC 会话,返回各次响应的 Set-Cookie;绑定 Cookie 仍有效时按 Chrome 主动刷新以 IDLE 优先级发出,已缺少或到期时按挂起请求触发的刷新以 HIGHEST 优先级发出

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"`
	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
}

CDPBrowser 是经远程调试地址读取的浏览器 Cookie

func ReadCDPBrowser added in v0.2.14

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

ReadCDPBrowser 经 Chromium 远程调试地址读取浏览器全部未分区 Cookie

type CookieAccount added in v0.2.17

type CookieAccount struct {
	AuthUser int
	Email    string
	// Restricted 是该会话打开 AI Studio 时被转到 Google 受限页的原因,此时邮箱为空
	Restricted 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 中各会话的对话页,返回各序号登录的账户,被转到受限页的会话记下原因后继续,序号不存在(受限页之后以 GetLoggingContext 返回 401 判断)或账户与前面重复时结束

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
	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