Commit Graph

4 Commits

Author SHA1 Message Date
Matthew Nickson
669f8700b2
Switched to nanoid for key generation
To try and prevent any security issues, use an external package to
generate key instead of doing it ourselves. Note: we have to use nanoid
version 3 as nanoid version 4 requires ESM. Currently, nanoid v3 is
still supported.

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
2023-02-26 19:36:50 +00:00
Matthew Nickson
42a69c16ca
Switched to crypto.randomBytes fpr key generation
Keys are now 32 bytes long encoded in a URL safe base64 string

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
2023-02-26 16:47:34 +00:00
Matthew Nickson
e7feca1cd6
Added API key authentication handler
API key authentication is now possible by making use of the X-API-Key
header. API authentication will only be enabled when a user adds their
first API key, up until this point, they can still use their username
and password to authenticate with API endpoints. After the user adds
their first API key, they may only use API keys in future to
authenticate with the API.

In this commit, the prometheus /metrics endpoint has been changed over
to the new authentication system.

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
2023-02-15 00:39:29 +00:00
Matthew Nickson
ee2eb5109b
Added basic web interface for API keys
Web interfaces for manging API keys have been added however translation
keys are still required.

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
2023-02-14 19:49:04 +00:00