keygen

package
v0.0.0-...-996fa4a Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

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

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.

Jump to

Keyboard shortcuts

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