Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigTokenSource(ctx context.Context, config *oauth2.Config, token *oauth2.Token) oauth2.TokenSource
- func ConfirmCommandAdvertisement(confirmCmd string) chat1.UserBotCommandInput
- func ConfirmNoMatchMsg(retryCmd string) string
- func ConfirmPendingOAuth(ctx context.Context, storage PendingOAuthStorage, requester, code string, ...) (bool, error)
- func ConfirmUsageMsg(confirmCmd string) string
- func EmojiToNumber(s string) int
- func ErrToOK(err *error) string
- func EscapeCodeBlock(s string) string
- func GetAWSConfig(ctx context.Context, region string) (aws.Config, error)
- func GetFeedbackCommandAdvertisement(prefix string) chat1.UserBotCommandInput
- func GetLatestCloudwatchLogs(region string, logGroupName string) ([]string, error)
- func GetOAuthClient(ctx context.Context, tokenIdentifier string, callbackMsg chat1.MsgSummary, ...) (*http.Client, error)
- func GoWithRecover(debugOutput *DebugOutput, f func())
- func GoWithRecoverErrGroup(eg *errgroup.Group, debugOutput *DebugOutput, f func() error)
- func HandleConfirmCmd(ctx context.Context, debug *DebugOutput, kbc *kbchat.API, storage OAuthStorage, ...) (handled bool, err error)
- func HandleNewTeam(stats *StatsRegistry, log *DebugOutput, kbc *kbchat.API, ...) error
- func HashConfirmCode(code string) string
- func IdentifierFromMsg(msg chat1.MsgSummary) string
- func IsAtLeastWriter(kbc *kbchat.API, senderUsername string, channel chat1.ChatChannel) (bool, error)
- func IsDeletedConvError(err error) bool
- func IsDirectPrivateMessage(botUsername, senderUsername string, channel chat1.ChatChannel) bool
- func IsEphemeralKeyError(err error) bool
- func IsIgnoredSendError(err error) bool
- func IsMessageTooLongError(err error) bool
- func IsOAuthAccountRestricted(err error) bool
- func LimitRequestBody(w http.ResponseWriter, r *http.Request, limit int64)
- func LogOAuthError(debug *DebugOutput, context string, err error)
- func MakeConfirmCode() (code, codeHash string, err error)
- func MakeLoginToken(secret, purpose, message string) string
- func MakeOAuthHTML(botName string, title, msg string, logoURL string) []byte
- func MakeRequestID() (string, error)
- func MarshalPendingToken(token *oauth2.Token) (string, error)
- func MatchConfirmCode(ctx context.Context, storage PendingOAuthStorage, requester, code string) (string, error)
- func MsgpackDecode(dst any, src []byte) error
- func MsgpackEncode(src any) ([]byte, error)
- func NumberToEmoji(v int) string
- func OAuthStartURL(config *oauth2.Config, state string) string
- func PanicRecover(debugOutput *DebugOutput)
- func ParseConfirmCmd(body, confirmCmd string) (code string, isConfirm bool)
- func PersistTokenSource(ctx context.Context, token *oauth2.Token, src oauth2.TokenSource, ...) oauth2.TokenSource
- func RandBytes(length int) ([]byte, error)
- func RandHexString(length int) string
- func RunBot(s *Server, run func() error) int
- func SecureHandler(next http.HandlerFunc) http.HandlerFunc
- func SecureHeaders(w http.ResponseWriter)
- func SendByConvNameOrID(kbc *kbchat.API, debugOutput *DebugOutput, name, msg string, args ...any) (err error)
- func ShouldRetryAuth(err error) bool
- func SplitTokens(cmd string) (tokens []string, userErrorMessage string, err error)
- func URLEncoder() *base64.Encoding
- func UnmarshalPendingToken(dat string) (*oauth2.Token, error)
- func VerifyLoginToken(secret, purpose, message, token string) bool
- type AWSOptions
- type BaseOAuthDB
- type ChatDebugOutputConfig
- type DB
- type DebugOutput
- func (d *DebugOutput) ChatDebug(convID chat1.ConvIDStr, msg string, args ...any)
- func (d *DebugOutput) ChatEcho(convID chat1.ConvIDStr, msg string, args ...any)
- func (d *DebugOutput) ChatErrorf(convID chat1.ConvIDStr, msg string, args ...any)
- func (d *DebugOutput) Config() *ChatDebugOutputConfig
- func (d *DebugOutput) Debug(format string, args ...any)
- func (d *DebugOutput) Errorf(msg string, args ...any)
- func (d *DebugOutput) Report(msg string, args ...any)
- func (d *DebugOutput) SendMessageByConvIDOrFile(convID chat1.ConvIDStr, title, msg string, args ...any) error
- func (d *DebugOutput) Trace(err *error, format string, args ...any) func()
- type DummyEmailer
- type DummyStatsBackend
- type Emailer
- type GetOAuthOpts
- type HTTPSrv
- type Handler
- type OAuthDB
- type OAuthFlow
- type OAuthFlowStorage
- type OAuthHTTPSrv
- type OAuthRequest
- type OAuthRequiredError
- type OAuthStateDB
- func (d *OAuthStateDB) CompleteState(ctx context.Context, state string) (bool, error)
- func (d *OAuthStateDB) GetPendingCodes(ctx context.Context, requester string) (res []PendingOAuthCode, err error)
- func (d *OAuthStateDB) GetPendingToken(ctx context.Context, state string) (*oauth2.Token, error)
- func (d *OAuthStateDB) IncrementConfirmAttempts(ctx context.Context, requester string) error
- func (d *OAuthStateDB) ReissueConfirmCode(ctx context.Context, state, codeHash string) (bool, error)
- func (d *OAuthStateDB) SetPendingToken(ctx context.Context, state, codeHash, pendingToken string) (bool, error)
- type OAuthStorage
- type Options
- type PendingOAuthCode
- type PendingOAuthStorage
- type SESEmailer
- type Server
- func (s *Server) AnnounceAndAdvertise(advert kbchat.Advertisement, running string) (err error)
- func (s *Server) GoWithRecover(eg *errgroup.Group, f func() error)
- func (s *Server) HandleSignals(shutdowners ...Shutdowner) (err error)
- func (s *Server) Listen(handler Handler) (err error)
- func (s *Server) Name() string
- func (s *Server) ReportFatalError(err error)
- func (s *Server) Shutdown() (err error)
- func (s *Server) Start(errReportConv string) (kbc *kbchat.API, err error)
- type ShortID
- type ShowtrendsBackend
- type Shutdowner
- type StatsBackend
- type StatsBackendType
- type StatsRegistry
- func (r *StatsRegistry) Count(name string)
- func (r *StatsRegistry) CountMult(name string, count int)
- func (r *StatsRegistry) ResetPrefix() *StatsRegistry
- func (r *StatsRegistry) SetPrefix(prefix string) *StatsRegistry
- func (r *StatsRegistry) Shutdown() (err error)
- func (r *StatsRegistry) Value(name string, value float64)
- func (r *StatsRegistry) ValueInt(name string, value int)
Constants ¶
const ( OAuthStateTTL = 15 * time.Minute OAuthStateTTLSeconds = int64(OAuthStateTTL / time.Second) )
An OAuth link has to be started, authorized at the provider, and confirmed from Keybase within OAuthStateTTL of being requested.
const ConfirmSaveFailedMsg = "Something went wrong saving your authorization. Send the same code again to retry."
const DefaultMaxOpenConns = 25
const LoginTokenMaxAge = 7 * 24 * time.Hour
const MaxConfirmAttempts = 5
MaxConfirmAttempts is how many wrong confirmation codes a requester may send before their pending links stop accepting codes.
Variables ¶
var Images = map[string]string{
"logo": "iVBORw0KGgoAAAANSUhEUgAAAPAAAADwCAYAAAA+VemSAAAAAXNSR0IArs4c6QAAQABJREFUeAHtXQecFFXSr56ZzbvknJNIEBVJYgQDKopgTgjGU8ynd8epd4rpOwx3ZswKKKKggqigYEAElLAEWTKSlxw2h0n9/at3Z52d7Znp19Mz0zN0/X6zO9P9Xr161a+63qtXVY/IAosDFgcsDlgcsDhgccDigMUBiwMWBywOWBywOGBxwOKAxQGLAxYHLA5YHLA4YHHA4oDFAYsDFgcsDlgcsDhgccDigMUBiwMWB0JzoFu3bo27d+9+67hx42yhS1p3j1UOSMdqxxOh3927Hz9Tlmm4JEkr7Ha6Ny9vw+JEoNuiMXYcsAQ4drwWagmad4wseyf4VZIliT4iso1dv379Xr/r1tdjmAOWAJvw4ffo0aOn1+tZDtLS65InFUuS/JTN5nh57dq1zrr3rSvHEgestZXJnvagQYPSoXk/AVkqwsvEyjmYVj8HAV/Ts2fPC01GvkVOjDlgj3F7VnNhOJCRkf6SLMuXhCnGtxtD0Ec2adK0T4sWLZYeOHDgqIY6VpEk44A1hTbRA+3Zs9swj0eepYOkoqys7Ja5ubllOupaVRKYA9YU2iQPD0arlhDe9/WRI31uCa8+ziV6LUuATfAEMWXGTEieDFKa6CHHZrP9V089q07ic8CR+F1I/B706NHtbzBMnaezJz+uW7durc66VrUE54AlwNUPsFevXg3dbne99PT0MqfTWRirLRp4W/UBCc9AA+scStLrOita1ZKAA8ekEYuF1ev1XoTPJZi+DsRzbIlPmv/zhPcTG4QK8SkI+BTiXgHqFfj+2+32Xfi+fs2aNUKW4IEDB2YcPXpkBfB3w0cPHGjRomXr+fPnu/VUtuokPgeOKQE+6aSTWkO7/guP7VYIYIrRjw9CvB845+P/JOzRzp0+fbonVBtwlXwdU+e7QpUJfU96dcOGDfeFLmPdTWYOHBNGLA4GgHfTE5WVlVsguHdGQ3h5kABv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oRYyKLNJ6W/9pqwDSzK7LTQJzIH2L7C/gYi4Og1oiZ4H8L7r+WjpA9F6kdaFh5e5oDu3btfC88soXkxx5iyud86qNsczzDRqbjyyiuJz+bSDJKdMu/8jiQ+QkWid3JHS3/RXNeggqbQwNwXWKQ/gRbWltG9uvNut5vGjh2r6ZQAg/hloUlSDnzzzTdiwgs+OI4foggvLM5zOmXQmHiwxh6PRoO1iVMWcPqhzF4rmmcGfD4SW6QHDhwYDK113eJASA6wIrjvvvuoqKgoZLnAm2mXjCecwLAiJ5Munn21VCt5RWDZaP02jQbmDla7ZQpNo7nee++9R6tXr+avFlgcEOYAAmto165dQvXs7QaQrUXP7TYI7/yrJQGfS6FmwhY2lQAztVjX/hP/ysNS7leANfDDDz9MnIrWAosDIhzgdLkTJkwQqaKUTRlwU3GKjYYuu1raJ1zZwAqap6oGthkWFQxa92MqfalawVatWrXEod1ZaveGDh2ah7QvG9XuWdcsDqhxALO3LkgYcZLavf0HDu4vUUmIbSPbwfbPrx45Z2h8ps1qtFrXLA5YHLA4YHHA4oDFAYsDFgcsDlgcsDhgccDigMUBiwMWBywOWBywOGBxwOKAxQGLAxYHLA5YHLA4YHHA4oDFAYsDFgcsDlgcsDhgccDigMUBiwPHIAf+H0J48lJRvsN6AAAAAElFTkSuQmCC",
}
Functions ¶
func ConfigTokenSource ¶
func ConfigTokenSource(ctx context.Context, config *oauth2.Config, token *oauth2.Token) oauth2.TokenSource
ConfigTokenSource is config.TokenSource, except tokens with a zero Expiry and a refresh token are treated as expired. oauth2.Token.Valid treats a zero Expiry as never-expired, which would skip refresh forever.
func ConfirmCommandAdvertisement ¶
func ConfirmCommandAdvertisement(confirmCmd string) chat1.UserBotCommandInput
ConfirmCommandAdvertisement advertises confirmCmd (without the leading "!"). Restricted bots only receive advertised commands, so it must be listed.
func ConfirmNoMatchMsg ¶
func ConfirmPendingOAuth ¶
func ConfirmPendingOAuth( ctx context.Context, storage PendingOAuthStorage, requester, code string, save func(ctx context.Context, state string, token *oauth2.Token) error, ) (bool, error)
ConfirmPendingOAuth checks code against the requester's pending links. On a match it passes the token to save and only then marks the link used, so if save fails the requester can send the same code again. It returns false if nothing was confirmed: no match, the link expired, or a concurrent confirmation of the same link won.
func ConfirmUsageMsg ¶
func EmojiToNumber ¶
func EscapeCodeBlock ¶
EscapeCodeBlock makes s safe to place between triple backticks.
func GetFeedbackCommandAdvertisement ¶
func GetFeedbackCommandAdvertisement(prefix string) chat1.UserBotCommandInput
func GetLatestCloudwatchLogs ¶
func GetOAuthClient ¶
func GetOAuthClient( ctx context.Context, tokenIdentifier string, callbackMsg chat1.MsgSummary, kbc *kbchat.API, config *oauth2.Config, storage OAuthStorage, opts GetOAuthOpts, ) (*http.Client, error)
func GoWithRecover ¶
func GoWithRecover(debugOutput *DebugOutput, f func())
func GoWithRecoverErrGroup ¶
func GoWithRecoverErrGroup(eg *errgroup.Group, debugOutput *DebugOutput, f func() error)
func HandleConfirmCmd ¶
func HandleConfirmCmd( ctx context.Context, debug *DebugOutput, kbc *kbchat.API, storage OAuthStorage, msg chat1.MsgSummary, confirmCmd string, callback func(ctx context.Context, msg chat1.MsgSummary, identifier string) error, ) (handled bool, err error)
HandleConfirmCmd reports whether msg is "<confirmCmd> <code>" and handles it if so: when the code matches one of the sender's pending links, the token is stored and callback is run with the message that originally required auth. Failures are reported to the user here, so err only comes from callback.
func HandleNewTeam ¶
func HandleNewTeam(stats *StatsRegistry, log *DebugOutput, kbc *kbchat.API, conv chat1.ConvSummary, welcomeMsg string) error
func HashConfirmCode ¶
HashConfirmCode normalizes a user-entered code (case, dashes, spaces) and returns its hex SHA-256.
func IdentifierFromMsg ¶
func IdentifierFromMsg(msg chat1.MsgSummary) string
identifierFromMsg returns either the team's name or sender's username, which is used to identify the oauth token. This is so we can have a separate oauth token per team (perhaps with a workplace account) and use a personal account for other events.
func IsAtLeastWriter ¶
func IsDeletedConvError ¶
func IsDirectPrivateMessage ¶
func IsDirectPrivateMessage(botUsername, senderUsername string, channel chat1.ChatChannel) bool
IsDirectPrivateMessage reports whether the conversation is a 1:1 between senderUsername and the bot (or a self-DM of the sender). The check compares whole usernames: a substring match would let "alice,gcalbotfan" pass for a DM with "gcalbot". Conversations with reader suffixes ("#") are not DMs.
func IsEphemeralKeyError ¶
func IsIgnoredSendError ¶
func IsMessageTooLongError ¶
func IsOAuthAccountRestricted ¶
IsOAuthAccountRestricted reports whether Google Workspace has blocked this OAuth client for the user (token refresh returns access_not_configured / Account Restricted). This is per-account admin policy, not a missing API on the Cloud project.
func LimitRequestBody ¶
func LimitRequestBody(w http.ResponseWriter, r *http.Request, limit int64)
LimitRequestBody caps how much of the request body a handler will read. Call it before reading r.Body; reads past limit fail with an error.
func LogOAuthError ¶
func LogOAuthError(debug *DebugOutput, context string, err error)
LogOAuthError logs an OAuth error, scrubbing any raw token-endpoint response body. ErrorCode and ErrorDescription from structured OAuth errors are retained.
func MakeConfirmCode ¶
MakeConfirmCode returns a random code formatted for display (e.g. "K7QM-2XRP") and the hash to store for it.
func MakeLoginToken ¶
MakeLoginToken returns a time-stamped HMAC-SHA256 token bound to purpose and message.
func MakeOAuthHTML ¶
MakeOAuthHTML renders a simple OAuth status page. botName, title, and logoURL are HTML-escaped; msg is inserted verbatim and must be trusted HTML.
func MakeRequestID ¶
func MatchConfirmCode ¶
func MatchConfirmCode(ctx context.Context, storage PendingOAuthStorage, requester, code string) (string, error)
MatchConfirmCode returns the state of the requester's pending link matching code, or "" if none matches. A miss counts as a failed attempt against every pending link of the requester, so the code can't be brute forced.
func MsgpackDecode ¶
func MsgpackEncode ¶
func NumberToEmoji ¶
func OAuthStartURL ¶
OAuthStartURL is the bot's start page for state. It lives under the provider callback URL, so the start page, the callback and the state cookie share the path the browser actually sees.
func PanicRecover ¶
func PanicRecover(debugOutput *DebugOutput)
func ParseConfirmCmd ¶
ParseConfirmCmd reports whether body is confirmCmd (e.g. "!github confirm"), and returns the code argument, which is empty if missing. A code typed with spaces ("K7QM 2XRP") is returned as typed; HashConfirmCode ignores them.
func PersistTokenSource ¶
func PersistTokenSource(ctx context.Context, token *oauth2.Token, src oauth2.TokenSource, put func(context.Context, *oauth2.Token) error) oauth2.TokenSource
PersistTokenSource wraps src and writes the token whenever AccessToken, RefreshToken, or Expiry changes (including refresh-token rotation).
func RandHexString ¶
func RunBot ¶
RunBot runs a bot to completion and reports any fatal error to stdout and, when Start has configured chat error reporting, to the error conversation.
func SecureHandler ¶
func SecureHandler(next http.HandlerFunc) http.HandlerFunc
SecureHandler wraps an HTML page handler so every response gets SecureHeaders. Wrap the route instead of calling SecureHeaders in each handler.
func SecureHeaders ¶
func SecureHeaders(w http.ResponseWriter)
SecureHeaders sets anti-framing, referrer and sniffing headers on a response. Use it on every HTML page a bot serves.
func SendByConvNameOrID ¶
func ShouldRetryAuth ¶
ShouldRetryAuth reports whether err means the user's OAuth credentials are permanently unusable and should be deleted: invalid_grant, invalid_token, a missing refresh token, or a Google Workspace Account Restricted refresh failure. Transient token-fetch failures (network, 5xx) and a bare access_not_configured (API not enabled on the Cloud project) are not.
func SplitTokens ¶
func URLEncoder ¶
func VerifyLoginToken ¶
VerifyLoginToken checks the token's HMAC and age against LoginTokenMaxAge.
Types ¶
type AWSOptions ¶
func (*AWSOptions) IsEmpty ¶
func (o *AWSOptions) IsEmpty() bool
type BaseOAuthDB ¶
type BaseOAuthDB struct {
*OAuthStateDB
}
func NewBaseOAuthDB ¶
func NewBaseOAuthDB(db *sql.DB) *BaseOAuthDB
func (*BaseOAuthDB) GetState ¶
func (d *BaseOAuthDB) GetState(ctx context.Context, state string) (*OAuthRequest, error)
GetState returns nil if state doesn't exist or has expired.
func (*BaseOAuthDB) PutState ¶
func (d *BaseOAuthDB) PutState(ctx context.Context, state string, oauthState *OAuthRequest) error
type ChatDebugOutputConfig ¶
func NewChatDebugOutputConfig ¶
func NewChatDebugOutputConfig(kbc *kbchat.API, errReportConv string) *ChatDebugOutputConfig
type DebugOutput ¶
type DebugOutput struct {
// contains filtered or unexported fields
}
func NewDebugOutput ¶
func NewDebugOutput(name string, config *ChatDebugOutputConfig) *DebugOutput
func (*DebugOutput) ChatDebug ¶
func (d *DebugOutput) ChatDebug(convID chat1.ConvIDStr, msg string, args ...any)
func (*DebugOutput) ChatEcho ¶
func (d *DebugOutput) ChatEcho(convID chat1.ConvIDStr, msg string, args ...any)
func (*DebugOutput) ChatErrorf ¶
func (d *DebugOutput) ChatErrorf(convID chat1.ConvIDStr, msg string, args ...any)
func (*DebugOutput) Config ¶
func (d *DebugOutput) Config() *ChatDebugOutputConfig
func (*DebugOutput) Debug ¶
func (d *DebugOutput) Debug(format string, args ...any)
func (*DebugOutput) Errorf ¶
func (d *DebugOutput) Errorf(msg string, args ...any)
func (*DebugOutput) Report ¶
func (d *DebugOutput) Report(msg string, args ...any)
func (*DebugOutput) SendMessageByConvIDOrFile ¶
func (d *DebugOutput) SendMessageByConvIDOrFile(convID chat1.ConvIDStr, title, msg string, args ...any) error
SendMessageByConvIDOrFile sends a chat message, falling back to a file attachment when the message exceeds Keybase's maximum length.
type DummyEmailer ¶
type DummyEmailer struct{}
func (DummyEmailer) Send ¶
func (d DummyEmailer) Send(_, subject, _ string) error
type DummyStatsBackend ¶
type DummyStatsBackend struct {
*DebugOutput
}
func NewDummyStatsBackend ¶
func NewDummyStatsBackend(debugConfig *ChatDebugOutputConfig) *DummyStatsBackend
func (*DummyStatsBackend) Count ¶
func (d *DummyStatsBackend) Count(name string) error
func (*DummyStatsBackend) CountMult ¶
func (d *DummyStatsBackend) CountMult(name string, count int) error
func (*DummyStatsBackend) Shutdown ¶
func (d *DummyStatsBackend) Shutdown() error
type GetOAuthOpts ¶
type HTTPSrv ¶
type HTTPSrv struct {
*DebugOutput
Stats *StatsRegistry
// contains filtered or unexported fields
}
func NewHTTPSrv ¶
func NewHTTPSrv(stats *StatsRegistry, debugConfig *ChatDebugOutputConfig) *HTTPSrv
type Handler ¶
type Handler interface {
HandleCommand(context.Context, chat1.MsgSummary) error
HandleNewConv(context.Context, chat1.ConvSummary) error
}
type OAuthDB ¶
type OAuthDB struct {
*BaseOAuthDB
}
func NewOAuthDB ¶
func (*OAuthDB) DeleteToken ¶
type OAuthFlow ¶
type OAuthFlow struct {
*DebugOutput
// contains filtered or unexported fields
}
OAuthFlow serves the browser side of linking an account:
- HandleStart (<callback>/start) names the Keybase account being linked, binds the browser to the state with a cookie, and links to the provider.
- HandleCallback exchanges the code, holds the token as pending, and shows a confirmation code. Reloading it in the same browser shows a new code.
- The requester sends "<confirmCmd> <code>" from Keybase, which the bot passes to ConfirmPendingOAuth (or ConfirmOAuth) to save the token.
Step 3 is what keeps a forwarded link from attaching someone else's account to the requester: whoever authorized at the provider has to hand the code back to them.
func NewOAuthFlow ¶
func NewOAuthFlow( debug *DebugOutput, oauth *oauth2.Config, storage OAuthFlowStorage, confirmCmd, botUsername, htmlTitle, htmlLogoSrc, callbackPath string, authCodeOpts ...oauth2.AuthCodeOption, ) *OAuthFlow
NewOAuthFlow returns the handlers for a flow whose provider callback (oauth.RedirectURL) is served at callbackPath on this server. Start links are built from RedirectURL (see OAuthStartURL), so the start handler must be registered at callbackPath + "/start".
func (*OAuthFlow) HandleCallback ¶
func (f *OAuthFlow) HandleCallback(w http.ResponseWriter, r *http.Request)
func (*OAuthFlow) HandleStart ¶
func (f *OAuthFlow) HandleStart(w http.ResponseWriter, r *http.Request)
type OAuthFlowStorage ¶
type OAuthFlowStorage interface {
// GetState returns nil if state doesn't exist or has expired.
GetState(ctx context.Context, state string) (*OAuthRequest, error)
SetPendingToken(ctx context.Context, state, codeHash, pendingToken string) (bool, error)
ReissueConfirmCode(ctx context.Context, state, codeHash string) (bool, error)
}
OAuthFlowStorage is what OAuthFlow needs from a bot's oauth_state table. OAuthStateDB provides everything but GetState.
type OAuthHTTPSrv ¶
type OAuthHTTPSrv struct {
*HTTPSrv
// contains filtered or unexported fields
}
OAuthHTTPSrv serves the OAuthFlow (see it for the steps) for bots that get tokens through GetOAuthClient. The bot passes its messages to HandleConfirmCmd.
func NewOAuthHTTPSrv ¶
func NewOAuthHTTPSrv( stats *StatsRegistry, kbc *kbchat.API, debugConfig *ChatDebugOutputConfig, oauth *oauth2.Config, storage OAuthStorage, confirmCmd string, htmlTitle string, htmlLogoB64 string, urlPrefix string, authCodeOpts ...oauth2.AuthCodeOption, ) *OAuthHTTPSrv
NewOAuthHTTPSrv registers the OAuth handlers under urlPrefix. confirmCmd is the chat command (e.g. "!github confirm") the bot handles with HandleConfirmCmd.
type OAuthRequest ¶
type OAuthRequest struct {
IsComplete bool
// IsPending is set once the provider redirected back and the token is
// waiting for the requester's confirmation.
IsPending bool
TokenIdentifier string
// Requester is the Keybase user who asked for the link. TokenIdentifier
// may be a team name instead.
Requester string
ConvID chat1.ConvIDStr
MsgID chat1.MessageID
}
type OAuthRequiredError ¶
type OAuthRequiredError struct{}
func (OAuthRequiredError) Error ¶
func (e OAuthRequiredError) Error() string
type OAuthStateDB ¶
type OAuthStateDB struct {
*DB
}
OAuthStateDB implements the confirmation steps of the OAuth flow on an oauth_state table with state, requester, is_complete, ctime, pending_token, confirm_code_hash and confirm_attempts columns. Each bot adds GetState and PutState for its own columns.
func NewOAuthStateDB ¶
func NewOAuthStateDB(db *DB) *OAuthStateDB
func (*OAuthStateDB) CompleteState ¶
CompleteState marks state used and drops its pending token. It returns false if the state was already complete, so a link is confirmed only once.
func (*OAuthStateDB) GetPendingCodes ¶
func (d *OAuthStateDB) GetPendingCodes(ctx context.Context, requester string) (res []PendingOAuthCode, err error)
func (*OAuthStateDB) GetPendingToken ¶
GetPendingToken returns nil if state isn't pending.
func (*OAuthStateDB) IncrementConfirmAttempts ¶
func (d *OAuthStateDB) IncrementConfirmAttempts(ctx context.Context, requester string) error
IncrementConfirmAttempts counts a wrong code against every pending state of the requester.
func (*OAuthStateDB) ReissueConfirmCode ¶
func (d *OAuthStateDB) ReissueConfirmCode(ctx context.Context, state, codeHash string) (bool, error)
ReissueConfirmCode replaces the confirmation code of a pending state, for a reload of the callback page in the browser that authorized. The attempt count is kept. It returns false if the state isn't pending.
func (*OAuthStateDB) SetPendingToken ¶
func (d *OAuthStateDB) SetPendingToken(ctx context.Context, state, codeHash, pendingToken string) (bool, error)
SetPendingToken stores the token from the provider until the requester confirms it. It returns false if the state was already used or expired.
type OAuthStorage ¶
type OAuthStorage interface {
GetToken(ctx context.Context, identifier string) (*oauth2.Token, error)
PutToken(ctx context.Context, identifier string, token *oauth2.Token) error
DeleteToken(ctx context.Context, identifier string) error
PutState(ctx context.Context, state string, req *OAuthRequest) error
OAuthFlowStorage
PendingOAuthStorage
}
type Options ¶
type Options struct {
// Location of the keybase binary
KeybaseLocation string
// Home directory for keybase service
Home string
// Conversation name or ID to announce when the bot begins
Announcement string
// Conversation name or ID to report bot errors to
ErrReportConv string
// Parsed database configs
DSN *mysql.Config
MultiDSN *mysql.Config
// Allow the bot to read it's own messages (default: false)
ReadSelf bool
AWSOpts *AWSOptions
// Keybase usernames allowed to run hidden admin commands (from BOT_ADMINS)
BotAdmins []string
// Optional, used for debugging to identify the bot.
DebugTag string
ShowtrendsAddr string
}
func NewOptions ¶
func NewOptions() *Options
type PendingOAuthCode ¶
PendingOAuthCode is the confirmation code hash of an OAuth link that finished at the provider and is waiting for the requester to confirm it.
type PendingOAuthStorage ¶
type PendingOAuthStorage interface {
// GetPendingCodes returns the requester's unexpired links that are
// awaiting confirmation and have fewer than MaxConfirmAttempts failures.
GetPendingCodes(ctx context.Context, requester string) ([]PendingOAuthCode, error)
GetPendingToken(ctx context.Context, state string) (*oauth2.Token, error)
IncrementConfirmAttempts(ctx context.Context, requester string) error
CompleteState(ctx context.Context, state string) (bool, error)
}
PendingOAuthStorage is implemented by OAuthStateDB.
type SESEmailer ¶
type SESEmailer struct {
*DebugOutput
// contains filtered or unexported fields
}
func NewSESEmailer ¶
func NewSESEmailer(sender, region string, debugConfig *ChatDebugOutputConfig) *SESEmailer
func (*SESEmailer) Send ¶
func (e *SESEmailer) Send(address, subject, message string) error
type Server ¶
type Server struct {
*DebugOutput
sync.Mutex
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer( name, announcement string, awsOpts *AWSOptions, multiDBDSN *mysql.Config, readSelf bool, botAdmins []string, runOptions kbchat.RunOptions, ) *Server
func (*Server) AnnounceAndAdvertise ¶
func (s *Server) AnnounceAndAdvertise(advert kbchat.Advertisement, running string) (err error)
func (*Server) HandleSignals ¶
func (s *Server) HandleSignals(shutdowners ...Shutdowner) (err error)
func (*Server) ReportFatalError ¶
type ShowtrendsBackend ¶
type ShowtrendsBackend struct {
// contains filtered or unexported fields
}
func NewShowtrendsBackend ¶
func NewShowtrendsBackend(addr string) *ShowtrendsBackend
func (*ShowtrendsBackend) Count ¶
func (b *ShowtrendsBackend) Count(name string) error
func (*ShowtrendsBackend) CountMult ¶
func (b *ShowtrendsBackend) CountMult(name string, count int) error
func (*ShowtrendsBackend) Shutdown ¶
func (b *ShowtrendsBackend) Shutdown() error
type Shutdowner ¶
type Shutdowner interface {
Shutdown() error
}
type StatsBackend ¶
type StatsBackend interface {
Count(name string) error
CountMult(name string, count int) error
Value(name string, value float64) error
Shutdown() error
}
func NewStatsBackend ¶
func NewStatsBackend(btype StatsBackendType, config any) (StatsBackend, error)
type StatsBackendType ¶
type StatsBackendType int
const (
DummyStatsBackendType StatsBackendType = iota
)
type StatsRegistry ¶
type StatsRegistry struct {
*DebugOutput
// contains filtered or unexported fields
}
func NewStatsRegistry ¶
func NewStatsRegistry(debugConfig *ChatDebugOutputConfig, showtrendsAddr string) (reg *StatsRegistry, err error)
func NewStatsRegistryWithBackend ¶
func NewStatsRegistryWithBackend(debugConfig *ChatDebugOutputConfig, backend StatsBackend) *StatsRegistry
func (*StatsRegistry) Count ¶
func (r *StatsRegistry) Count(name string)
func (*StatsRegistry) CountMult ¶
func (r *StatsRegistry) CountMult(name string, count int)
func (*StatsRegistry) ResetPrefix ¶
func (r *StatsRegistry) ResetPrefix() *StatsRegistry
func (*StatsRegistry) SetPrefix ¶
func (r *StatsRegistry) SetPrefix(prefix string) *StatsRegistry
func (*StatsRegistry) Shutdown ¶
func (r *StatsRegistry) Shutdown() (err error)
func (*StatsRegistry) Value ¶
func (r *StatsRegistry) Value(name string, value float64)
func (*StatsRegistry) ValueInt ¶
func (r *StatsRegistry) ValueInt(name string, value int)