This section is empty.


This section is empty.


This section is empty.


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

      func (r *Response) ForRequest(id uint16)

        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 New

          func New(cipher license.Cipher, loader contract.Provider, auth service.Authorizer) *Service

            New creates a new key generation provider.

            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

              func (s *Service) DecryptKey(key string) (security.Key, error)

                DecryptKey decrypts a key and returns it

                func (*Service) EncryptKey

                func (s *Service) EncryptKey(key security.Key) (string, error)

                  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.

                      func (*Service) OnRequest

                      func (s *Service) OnRequest(c service.Conn, payload []byte) (service.Response, bool)

                        OnRequest processes a keygen request.