mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 21:24:01 +03:00
Check secret length in mtg
This commit is contained in:
@@ -87,6 +87,9 @@ func NewConfig(debug, verbose bool, // nolint: gocyclo
|
|||||||
statsIP net.IP, statsPort uint16,
|
statsIP net.IP, statsPort uint16,
|
||||||
timeoutRead, timeoutWrite time.Duration,
|
timeoutRead, timeoutWrite time.Duration,
|
||||||
secret string) (*Config, error) {
|
secret string) (*Config, error) {
|
||||||
|
if len(secret) != 32 {
|
||||||
|
return nil, errors.New("Telegram demands secret of length 32")
|
||||||
|
}
|
||||||
secretBytes, err := hex.DecodeString(secret)
|
secretBytes, err := hex.DecodeString(secret)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Annotate(err, "Cannot create config")
|
return nil, errors.Annotate(err, "Cannot create config")
|
||||||
|
|||||||
Reference in New Issue
Block a user