Documentation
¶
Index ¶
- Constants
- func Getenv(variable string) string
- func GetenvMandatory(variable string) string
- func GetenvOptional(variable string, defaultValue string) string
- func NewHTTPServer() *fiber.App
- type Controller
- type EventContext
- type EventHandler
- type Identity
- type InstallHook
- type Resource
- type SignatureScheme
Constants ¶
const ( TransportMQTT = "MQTT" TransportHTTP = "HTTP" )
Variables ¶
This section is empty.
Functions ¶
func Getenv ¶
Getenv attempts to get the value of an environment variable from a file path. If the value is not a file path, it will use the value.
func GetenvMandatory ¶
GetenvMandatory loads a mandatory environment variable and returns its value or terminates the process if the variable is unset.
func GetenvOptional ¶
GetenvOptional loads an optional environment variable and returns its value or the provided default value if the varaible is not set.
func NewHTTPServer ¶
func NewHTTPServer() *fiber.App
Types ¶
type Controller ¶
type Controller struct { APIGroup string APIVersions []string `json:"apiVersions"` DB *sqlx.DB Identity *Identity HTTPServer *fiber.App Version string }
Controller is the heart of the application that aggregates all functionality.
func New ¶
func New() *Controller
New creates a new controller for the specified API group and version.
func (*Controller) ConnectDB ¶
func (c *Controller) ConnectDB()
func (*Controller) Install ¶
func (ctrl *Controller) Install(install InstallHook)
func (*Controller) Start ¶
func (c *Controller) Start()
type EventContext ¶
type EventHandler ¶
type EventHandler func(*EventContext)
type Identity ¶
type Identity struct { PublicKeyPEM string `json:"publicKeyPEM"` PrivateKey crypto.PrivateKey `json:"-"` SignatureScheme SignatureScheme `json:"signatureScheme"` }
func NewIdentity ¶
NewIdentity loads the keypair and the curve information.
type InstallHook ¶
type InstallHook func(c *Controller) string
type SignatureScheme ¶
type SignatureScheme struct { // Algorithm can be either one of EdDSA, ECDSA or RSA. Algorithm string `json:"algorithm"` // Curve is the OpenSSL curve identifier. You can get // a list by running: openssl ecparam -list_curves Curve string `json:"curve,omitempty"` // Hash can be either SHA-256, SHA-384 or SHA-512. Hash string `json:"hash"` }
SignatureScheme is a datatype roughly based on this section of RFC7518: https://datatracker.ietf.org/doc/html/rfc7518#section-3.1
var ( // SchemeES256 is the equivalent of ES256 mentioned in RFC7518. SchemeES256 SignatureScheme = SignatureScheme{"ECDSA", "secp256r1", "SHA-256"} // SchemeES384 is the equivalent of ES384 mentioned in RFC7518. SchemeES384 SignatureScheme = SignatureScheme{"ECDSA", "secp384r1", "SHA-384"} // SchemeES512 is the equivalent of ES512 mentioned in RFC7518. SchemeES512 SignatureScheme = SignatureScheme{"ECDSA", "secp521r1", "SHA-512"} )
func NewSignatureScheme ¶
func NewSignatureScheme(curve string) SignatureScheme
func (SignatureScheme) String ¶
func (s SignatureScheme) String() string