Documentation
¶
Index ¶
- func ClearTokens() error
- func DetectTokenType(token string) string
- func GetBotToken() (string, error)
- func GetBotUserInfo() (userID, userName string)
- func GetTeamInfo() (teamID, teamName string)
- func GetUserInfo() (userID, userName string)
- func GetUserToken() (string, error)
- func IsBotToken(token string) bool
- func IsUserToken(token string) bool
- func ResolveUserID() (userID, userName string, err error)
- func StoreBotToken(token string) error
- func StoreBotUserInfo(userID, userName string) error
- func StoreTeamInfo(teamID, teamName string) error
- func StoreUserInfo(userID, userName string) error
- func StoreUserToken(token string) error
- type TokenInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearTokens ¶
func ClearTokens() error
ClearTokens removes all stored credentials from keyring and file.
func DetectTokenType ¶
DetectTokenType returns "bot" or "user" based on prefix, or "unknown".
func GetBotUserInfo ¶ added in v0.9.3
func GetBotUserInfo() (userID, userName string)
GetBotUserInfo retrieves the stored bot user ID and username.
func GetTeamInfo ¶
func GetTeamInfo() (teamID, teamName string)
GetTeamInfo retrieves the stored team ID and name.
func GetUserInfo ¶
func GetUserInfo() (userID, userName string)
GetUserInfo retrieves the stored human user ID and username.
func GetUserToken ¶
GetUserToken retrieves the stored user token.
func IsBotToken ¶
IsBotToken returns true if the token looks like a bot token.
func IsUserToken ¶
IsUserToken returns true if the token looks like a user token.
func ResolveUserID ¶
ResolveUserID returns the human user's Slack ID, fetching it via auth.test on the user token if not already stored. Only uses the user token (not bot) to ensure the returned ID is the human's, not the bot's.
func StoreBotToken ¶
StoreBotToken saves a bot token (xoxb-) to the OS keyring, falling back to plaintext.
func StoreBotUserInfo ¶ added in v0.9.3
StoreBotUserInfo saves the bot's Slack user ID and username (from bot token auth.test).
func StoreTeamInfo ¶
StoreTeamInfo saves the team ID and name.
func StoreUserInfo ¶
StoreUserInfo saves the human user's Slack ID and username (from user token auth.test).
func StoreUserToken ¶
StoreUserToken saves a user token (xoxp-) to the OS keyring, falling back to plaintext.