auth

package module
v0.0.0-...-63a50ba Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: MIT Imports: 13 Imported by: 0

README

auth-go

Documentation

Index

Constants

View Source
const (
	KJoinChannel        = 1
	KPublishAudioStream = 2
	KPublishVideoStream = 3
	KPublishDataStream  = 4

	KPublishAudiocdn           = 5
	KPublishVideoCdn           = 6
	KRequestPublishAudioStream = 7
	KRequestPublishVideoStream = 8
	KRequestPublishDataStream  = 9
	KInvitePublishAudioStream  = 10
	KInvitePublishVideoStream  = 11
	KInvitePublishDataStream   = 12

	KAdministrateChannel = 101
)
View Source
const (
	Role_Attendee   = 3
	Role_Publisher  = 0
	Role_Subscriber = 1
	Role_Admin      = 4
)
View Source
const APP_ID_LENGTH = 32
View Source
const VERSION_LENGTH = 3

Variables

View Source
var RolePrivileges = map[uint16](map[uint16]uint32){
	Role_Attendee:   attendeePrivileges,
	Role_Publisher:  publisherPrivileges,
	Role_Subscriber: subscriberPrivileges,
	Role_Admin:      adminPrivileges,
}

Functions

func CheckToken

func CheckToken(appID, appCertificate, channelName, uid string, role uint32, token string) error

func GenSwiftVisionToken

func GenSwiftVisionToken(appID, appCertificate, channelName, uid string, role uint32) (string, error)

Types

type AccessToken

type AccessToken struct {
	AppID          string
	AppCertificate string
	ChannelName    string
	UidStr         string
	Ts             uint32
	Salt           uint32
	Message        map[uint16]uint32
	Signature      string
	CrcChannelName uint32
	CrcUid         uint32
	MsgRawContent  string
}

func CreateAccessToken

func CreateAccessToken(appID, appCertificate, channelName string, uid uint32) AccessToken

func CreateAccessToken2

func CreateAccessToken2(appID, appCertificate, channelName string, uid string) AccessToken

func (*AccessToken) AddPrivilege

func (token *AccessToken) AddPrivilege(privilege Privileges, expireTimestamp uint32)

func (*AccessToken) Build

func (token *AccessToken) Build() (string, error)

func (*AccessToken) FromString

func (token *AccessToken) FromString(originToken string) bool

type Privileges

type Privileges uint16

type Role

type Role uint16

Jump to

Keyboard shortcuts

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