diff options
author | 2024-03-11 23:24:46 +0100 | |
---|---|---|
committer | 2024-03-11 16:31:43 -0700 | |
commit | 5bcb37901c60463b27e1211e0f68295f213b19e6 (patch) | |
tree | 316779ffe272d0db89d30c18d25cd2c28fc6f9a9 | |
parent | 9c8a7dfffe2f4596dcbde2c923a7539914bb252f (diff) | |
download | v2-5bcb37901c60463b27e1211e0f68295f213b19e6.tar.gz v2-5bcb37901c60463b27e1211e0f68295f213b19e6.tar.zst v2-5bcb37901c60463b27e1211e0f68295f213b19e6.zip |
Use crypto.GenerateRandomBytes instead of doing it by hand
This makes the code a bit shorter, and properly handle
cryptographic error conditions.
-rw-r--r-- | internal/config/options.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/internal/config/options.go b/internal/config/options.go index dc3d7063..483192f9 100644 --- a/internal/config/options.go +++ b/internal/config/options.go @@ -4,12 +4,12 @@ package config // import "miniflux.app/v2/internal/config" import ( - "crypto/rand" "fmt" "sort" "strings" "time" + "miniflux.app/v2/internal/crypto" "miniflux.app/v2/internal/version" ) @@ -171,9 +171,6 @@ type Options struct { // NewOptions returns Options with default values. func NewOptions() *Options { - randomKey := make([]byte, 16) - rand.Read(randomKey) - return &Options{ HTTPS: defaultHTTPS, logFile: defaultLogFile, @@ -242,7 +239,7 @@ func NewOptions() *Options { metricsPassword: defaultMetricsPassword, watchdog: defaultWatchdog, invidiousInstance: defaultInvidiousInstance, - proxyPrivateKey: randomKey, + proxyPrivateKey: crypto.GenerateRandomBytes(16), webAuthn: defaultWebAuthn, } } |