auth

package
v0.0.0-...-b165c23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package auth provides functions to generate and check Centrifugo auth signs.

Index

Constants

View Source
const (
	HMACLength = 64
)

HMACLength used to validate length of token string we received. Centrifugo uses sha256 as digest algorithm for HMAC tokens and signs so all correct tokens must be of fixed length set by this const.

Variables

This section is empty.

Functions

func CheckChannelSign

func CheckChannelSign(secret, client, channel, channelData, providedSign string) bool

CheckChannelSign validates a correctness of provided (in subscribe client command) sign comparing it with generated one.

func CheckClientSign

func CheckClientSign(secret, user, exp, info, opts, providedToken string) bool

CheckClientSign validates correctness of sign provided by client connection comparing it with generated correct one.

func GenerateChannelSign

func GenerateChannelSign(secret, client, channel, channelData string) string

GenerateChannelSign generates sign which is used to prove permission of client to subscribe on private channel.

func GenerateClientSign

func GenerateClientSign(secret, user, exp, info, opts string) string

GenerateClientSign generates client connection sign based on secret key and provided connection parameters such as user ID, exp, info and opts.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL