Documentation ¶
Index ¶
- type Request
- type Response
- type Service
- func (s *Service) CreateKey(rawMasterKey, channel string, access uint8, expires time.Time) (string, *errors.Error)
- func (s *Service) DecryptKey(key string) (security.Key, error)
- func (s *Service) EncryptKey(key security.Key) (string, error)
- func (s *Service) ExtendKey(channelKey, channelName, connectionID string, access uint8, expires time.Time) (*security.Channel, *errors.Error)
- func (s *Service) HTTP() http.HandlerFunc
- func (s *Service) OnRequest(c service.Conn, payload []byte) (service.Response, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct { Key string `json:"key"` // The master key to use. Channel string `json:"channel"` // The channel to create a key for. Type string `json:"type"` // The permission set. TTL int32 `json:"ttl"` // The TTL of the key. }
Request represents a key generation request.
type Response ¶
type Response struct { Request uint16 `json:"req,omitempty"` Status int `json:"status"` Key string `json:"key"` Channel string `json:"channel"` }
Response represents a key generation response
func (*Response) ForRequest ¶
ForRequest sets the request ID in the response for matching
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service represents a key generation service.
func (*Service) CreateKey ¶
func (s *Service) CreateKey(rawMasterKey, channel string, access uint8, expires time.Time) (string, *errors.Error)
CreateKey generates a key with the specified access and expiration time.
func (*Service) DecryptKey ¶
DecryptKey decrypts a key and returns it
func (*Service) EncryptKey ¶
EncryptKey encrypts the security key
func (*Service) ExtendKey ¶
func (s *Service) ExtendKey(channelKey, channelName, connectionID string, access uint8, expires time.Time) (*security.Channel, *errors.Error)
ExtendKey creates a private channel and an appropriate key.
func (*Service) HTTP ¶
func (s *Service) HTTP() http.HandlerFunc
HTTP creates a new HTTP handler which can be used to serve HTTP keygen page.
Click to show internal directories.
Click to hide internal directories.