terminalauth

package
v1.0.27 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package terminalauth scans a workbench's raw ttyd terminal output for the Claude CLI's OAuth sign-in link, the same one deploy/workbench/bridge/internal/authlogin.Parser looks for on the chat bridge's transport — but the interactive terminal (internal/transport/vaults_api's WorkbenchTerminalShellHandler, proxying ttyd's own binary WebSocket protocol) is a separate transport with no visibility into the bridge's parser, so it needs its own tap.

Unlike authlogin.Parser, which is used once per short-lived `claude setup-token` run, a Parser here lives for the duration of an interactive terminal WebSocket connection — potentially hours — so its buffer is capped (see maxBufferSize) rather than kept whole, and it can report more than one link over its lifetime (a user may run `claude setup-token` again later in the same terminal session).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser incrementally scans a terminal WS connection's raw ttyd OUTPUT payload bytes (ANSI/OSC escapes included, not stripped — the pattern only needs its own character run, not the surrounding escape structure) and reports the Claude CLI OAuth sign-in link each time a new one appears complete in the stream.

One Parser is used per active terminal WS connection; not safe for concurrent use.

func NewParser

func NewParser() *Parser

NewParser returns a Parser for one terminal WS connection.

func (*Parser) Feed

func (p *Parser) Feed(chunk []byte) (string, bool)

Feed appends chunk (an OUTPUT frame's payload, with the leading command byte already stripped by the caller) to the parser's rolling buffer and reports (url, true) the first time a complete, new sign-in link is found — "new" meaning different from the last link this Parser reported, so the CLI redrawing the same link several times as it repaints the terminal doesn't produce repeated signals. Returns ("", false) when no new complete link is present yet.

Jump to

Keyboard shortcuts

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