Documentation ¶
Overview ¶
Package auth provides functions to generate and check Centrifugo tokens and signs.
Index ¶
- Constants
- func CheckApiSign(secret string, data []byte, providedSign string) bool
- func CheckChannelSign(secret, client, channel, channelData, providedSign string) bool
- func CheckClientToken(secret, user, timestamp, info, providedToken string) bool
- func GenerateApiSign(secret string, data []byte) string
- func GenerateChannelSign(secret, client, channel, channelData string) string
- func GenerateClientToken(secret, user, timestamp, info string) string
Constants ¶
const (
HMACLength = 64
)
Centrifugo uses sha256 as digest algorithm for HMAC tokens and signs so all correct tokens must be of fixed length set by HMACLength.
Variables ¶
This section is empty.
Functions ¶
func CheckApiSign ¶
CheckApiSign validates correctness of provided (in HTTP API request) sign comparing it with generated one
func CheckChannelSign ¶
CheckChannelSign validates a correctness of provided (in subscribe client command) sign comparing it with generated one
func CheckClientToken ¶
CheckClientToken validates correctness of provided (by client connection) token comparing it with generated one
func GenerateApiSign ¶
GenerateApiSign generates sign which is used to sign HTTP API requests
func GenerateChannelSign ¶
GenerateChannelSign generates sign which is used to prove permission of client to subscribe on private channel
func GenerateClientToken ¶
GenerateClientToken generates client token based on project secret key and provided connection parameters such as user ID, timestamp and info JSON string.
Types ¶
This section is empty.