Documentation
¶
Index ¶
- Constants
- Variables
- func Digest(value string) string
- func Random() string
- type Client
- func (c *Client) AuthorizationURL(state, nonce, verifier string) string
- func (c *Client) Close()
- func (c *Client) Exchange(ctx context.Context, code, nonce, verifier string) (Credentials, error)
- func (c *Client) Refresh(ctx context.Context, current Credentials) (Credentials, error)
- func (c *Client) Revoke(ctx context.Context, current Credentials) error
- type Config
- type Credentials
Constants ¶
View Source
const Issuer = "https://auth.openai.com"
View Source
const Profile = "chatgpt_plan"
View Source
const Resource = "https://api.openai.com/v1"
Variables ¶
View Source
var ErrAuthorization = errors.New("ChatGPT authorization could not be verified; start sign-in again")
View Source
var ErrPermission = errors.New("ChatGPT plan usage was not authorized; enable plan usage and reconnect")
View Source
var ErrRefresh = errors.New("ChatGPT session expired or revoked; reconnect this account")
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AuthorizationURL ¶
func (*Client) Refresh ¶
func (c *Client) Refresh(ctx context.Context, current Credentials) (Credentials, error)
type Config ¶
type Credentials ¶
type Credentials struct {
ClientID string `json:"client_id"`
Subject string `json:"subject"`
Email string `json:"email"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
IDToken string `json:"id_token"`
Scopes string `json:"scopes"`
Expiry time.Time `json:"expiry"`
}
func (Credentials) GoString ¶
func (c Credentials) GoString() string
func (Credentials) LogValue ¶
func (c Credentials) LogValue() slog.Value
func (Credentials) String ¶
func (c Credentials) String() string
func (Credentials) Valid ¶
func (c Credentials) Valid(clientID string) bool
Click to show internal directories.
Click to hide internal directories.