mirror of
https://github.com/miniflux/v2.git
synced 2024-09-27 21:02:41 +02:00
Use crypto.GenerateRandomBytes instead of doing it by hand
This makes the code a bit shorter, and properly handle cryptographic error conditions.
This commit is contained in:
parent
9c8a7dfffe
commit
5bcb37901c
@ -4,12 +4,12 @@
|
|||||||
package config // import "miniflux.app/v2/internal/config"
|
package config // import "miniflux.app/v2/internal/config"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"miniflux.app/v2/internal/crypto"
|
||||||
"miniflux.app/v2/internal/version"
|
"miniflux.app/v2/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -171,9 +171,6 @@ type Options struct {
|
|||||||
|
|
||||||
// NewOptions returns Options with default values.
|
// NewOptions returns Options with default values.
|
||||||
func NewOptions() *Options {
|
func NewOptions() *Options {
|
||||||
randomKey := make([]byte, 16)
|
|
||||||
rand.Read(randomKey)
|
|
||||||
|
|
||||||
return &Options{
|
return &Options{
|
||||||
HTTPS: defaultHTTPS,
|
HTTPS: defaultHTTPS,
|
||||||
logFile: defaultLogFile,
|
logFile: defaultLogFile,
|
||||||
@ -242,7 +239,7 @@ func NewOptions() *Options {
|
|||||||
metricsPassword: defaultMetricsPassword,
|
metricsPassword: defaultMetricsPassword,
|
||||||
watchdog: defaultWatchdog,
|
watchdog: defaultWatchdog,
|
||||||
invidiousInstance: defaultInvidiousInstance,
|
invidiousInstance: defaultInvidiousInstance,
|
||||||
proxyPrivateKey: randomKey,
|
proxyPrivateKey: crypto.GenerateRandomBytes(16),
|
||||||
webAuthn: defaultWebAuthn,
|
webAuthn: defaultWebAuthn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user