Documentation ¶
Index ¶
- Constants
- func RandomName() string
- func ValidRequest(slackSigningSecret, requestBody, timestamp, slackSignature string) bool
- type EventHandler
- type JWTInput
- type Meeting
- type MeetingGenerator
- type MeetingTokenGenerator
- type ServerCfg
- type ServerCfgData
- type ServerCfgStore
- type ServerConfigReader
- type ServerConfigWriter
- type SlackOAuthHandlers
- type SlashCommandHandlers
- type TokenData
- type TokenGenerator
- type TokenReader
- type TokenStore
- type TokenWriter
Constants ¶
const ( // RequestTimestampHeader is the header key value for the slack request timestamp. RequestTimestampHeader = "X-Slack-Request-Timestamp" // RequestSignatureHeader is the header key value for the slack request signature. RequestSignatureHeader = "X-Slack-Signature" // SignatureVersion is the version of signature validation that is preformed. SignatureVersion = "v0" )
const ( // KeyTeamIDSrvCfg is the dynamo key for storing the team id. // This key is the primary index. KeyTeamIDSrvCfg = "team-id" // KeyServer is the dynamo key for storing the configured server. KeyServer = "server-url" )
const ( KeyTeamID = "team-id" // primary key; slack team id KeyAccessToken = "access-token" // oauth access token )
Variables ¶
This section is empty.
Functions ¶
func ValidRequest ¶
ValidRequest returns a boolean indicating that a request is validated as originating from Slack.
Types ¶
type EventHandler ¶ added in v0.1.1
type EventHandler struct { SlackSigningSecret string TokenWriter TokenWriter }
EventHandler is used to handle event callbacks from Slack api.
func (*EventHandler) Handle ¶ added in v0.1.1
func (e *EventHandler) Handle(w http.ResponseWriter, r *http.Request)
Handle handles event callbacks for the integration. adapated from https://github.com/slack-go/slack/blob/master/examples/eventsapi/events.go
type JWTInput ¶ added in v0.1.0
type JWTInput struct { TenantID string TenantName string RoomClaim string UserID string UserName string AvatarURL string }
JWTInput is the input required to generate a meeting JWT for a user.
type Meeting ¶ added in v0.1.0
type Meeting struct { RoomName string URL string Host string AuthenticatedURL func(UserID, UserName, AvatarURL string) (string, error) }
Meeting contains the server specific info for a meeting.
type MeetingGenerator ¶ added in v0.1.0
type MeetingGenerator struct { ServerConfigReader ServerConfigReader MeetingTokenGenerator MeetingTokenGenerator }
MeetingGenerator provides an interface for generating meetings configured correctly for the slack team.
type MeetingTokenGenerator ¶ added in v0.1.0
MeetingTokenGenerator provides an interface for creating video conference authenticated access via JWT.
type ServerCfg ¶ added in v0.1.0
type ServerCfg struct { // Server is the host server for meetings. (e.g. https://meet.jit.si) Server string // TenantScopedURLs indicates whether or nto urls generated for meetings // on the server should be tenant scoped or not. // (e.g. https://meet.jit.si/team/room or https://meet.jit.si/room) TenantScopedURLs bool // AuthenticatedURLSupport indicates whether or not authenticated urls // are supported. AuthenticatedURLSupport bool }
ServerCfg is the server configuration for a team.
type ServerCfgData ¶ added in v0.1.0
ServerCfgData is the server configuration data that is stored for teams.
type ServerCfgStore ¶ added in v0.1.0
type ServerCfgStore struct { // TableName is the name of the dynamo table where configuration is stored. TableName string // DB is the client used to access dynamodb. DB *dynamodb.Client // DefaultServer is the server host to use if none has been configured. DefaultServer string // TenantScopedURLs returns whether or not meeting urls should be // scoped with a tenant (e.g. https://meet.jit.si/tenant/room) TenantScopedURLs func(string) bool // AuthenticatedURLSupport returns whether or not the server supports // authenticated urls. AuthenticatedURLSupport func(string) bool }
ServerCfgStore is used to store server configuration for teams.
func (*ServerCfgStore) Get ¶ added in v0.1.0
func (s *ServerCfgStore) Get(teamID string) (ServerCfg, error)
Get retrieves the server configuration for a team. This will provide the default if no configuration is stored for the team.
func (*ServerCfgStore) Remove ¶ added in v0.1.0
func (s *ServerCfgStore) Remove(teamID string) error
Remove will remove the persistent server configuration for a team. That team will use the defaults if no configuration is stored for the team.
func (*ServerCfgStore) Store ¶ added in v0.1.0
func (s *ServerCfgStore) Store(data *ServerCfgData) error
Store will persist a portion of the server configuration for a team.
type ServerConfigReader ¶ added in v0.1.0
ServerConfigReader provides an interface for reading configure server data from the configuration store.
type ServerConfigWriter ¶ added in v0.1.0
type ServerConfigWriter interface { Store(*ServerCfgData) error Remove(string) error }
ServerConfigWriter provides an interface for writing server configuration data for a team's workspace.
type SlackOAuthHandlers ¶
type SlackOAuthHandlers struct { ClientID string ClientSecret string AppID string TokenWriter TokenWriter }
SlackOAuthHandlers is used for handling Slack OAuth validation.
func (*SlackOAuthHandlers) Auth ¶
func (o *SlackOAuthHandlers) Auth(w http.ResponseWriter, r *http.Request)
Auth validates OAuth access tokens.
type SlashCommandHandlers ¶
type SlashCommandHandlers struct { MeetingGenerator *MeetingGenerator SlackSigningSecret string TokenReader TokenReader TokenWriter TokenWriter SharableURL string ServerConfigWriter ServerConfigWriter }
SlashCommandHandlers provides http handlers for Slack slash commands that integrate with Jitsi Meet.
func (*SlashCommandHandlers) Jitsi ¶
func (s *SlashCommandHandlers) Jitsi(w http.ResponseWriter, r *http.Request)
Jitsi will create a conference and dispatch an invite message to both users. It is a slash command for Slack.
type TokenGenerator ¶
type TokenGenerator struct { Lifetime time.Duration PrivateKey string Issuer string Audience string Kid string }
TokenGenerator generates conference tokens for auth'ed users.
type TokenReader ¶
TokenReader provides an interface for reading access token data from a token store.
type TokenStore ¶
TokenStore stores and retrieves access tokens from aws dynamodb.
func (*TokenStore) GetTokenForTeam ¶ added in v0.1.1
func (t *TokenStore) GetTokenForTeam(teamID string) (*TokenData, error)
GetToken retrieves the access token stored with the provided team id.
func (*TokenStore) Remove ¶ added in v0.1.1
func (t *TokenStore) Remove(teamID string) error
Remove will remove access token data for the user.
func (*TokenStore) Store ¶
func (t *TokenStore) Store(data *TokenData) error
Store will store access token data.