Documentation
¶
Overview ¶
Package openrouterauth connects a local codeaf profile to OpenRouter without asking the person to make and copy an API key by hand.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flow ¶
type Flow struct {
// contains filtered or unexported fields
}
Flow is one browser connection in progress. The loopback listener is already standing when Begin returns, so URL may be opened immediately and Wait may safely run on another goroutine.
func Begin ¶
Begin starts an S256 PKCE connection on an arbitrary loopback port.
OpenRouter explicitly accepts localhost callbacks on any port, so there is no fixed socket to contend for and no public redirect service in the middle. The callback path is random as well: the verifier protects the exchanged code, and the unguessable path keeps an unrelated local request from ending the person's attempt early.
func (*Flow) Cancel ¶
func (f *Flow) Cancel()
Cancel releases the loopback listener and makes a waiting call return.
type Options ¶
type Options struct {
AuthURL string
ExchangeURL string
HTTPClient *http.Client
Random io.Reader
Listen func(network, address string) (net.Listener, error)
}
Options holds the replaceable edges of an OpenRouter connection. Its zero value is the shipped service; tests replace the endpoints, entropy and listener without sending a browser or a credential outside the process.