Update dependencies and build to go1.22 (#2113)
* Update dependencies and build to go1.22 * Fix api changes wrt to dependencies * Update golangci config
This commit is contained in:
@@ -9,9 +9,8 @@ package keys
|
||||
|
||||
import (
|
||||
"go.mau.fi/libsignal/ecc"
|
||||
"go.mau.fi/util/random"
|
||||
"golang.org/x/crypto/curve25519"
|
||||
|
||||
"go.mau.fi/whatsmeow/util/randbytes"
|
||||
)
|
||||
|
||||
type KeyPair struct {
|
||||
@@ -31,7 +30,7 @@ func NewKeyPairFromPrivateKey(priv [32]byte) *KeyPair {
|
||||
}
|
||||
|
||||
func NewKeyPair() *KeyPair {
|
||||
priv := *(*[32]byte)(randbytes.Make(32))
|
||||
priv := *(*[32]byte)(random.Bytes(32))
|
||||
|
||||
priv[0] &= 248
|
||||
priv[31] &= 127
|
||||
|
||||
38
vendor/go.mau.fi/whatsmeow/util/log/zerolog.go
vendored
Normal file
38
vendor/go.mau.fi/whatsmeow/util/log/zerolog.go
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2024 Tulir Asokan
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
package waLog
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
type zeroLogger struct {
|
||||
mod string
|
||||
zerolog.Logger
|
||||
}
|
||||
|
||||
// Zerolog wraps a [zerolog.Logger] to implement the [Logger] interface.
|
||||
//
|
||||
// Subloggers will be created by setting the `sublogger` field in the log context.
|
||||
func Zerolog(log zerolog.Logger) Logger {
|
||||
return &zeroLogger{Logger: log}
|
||||
}
|
||||
|
||||
func (z *zeroLogger) Warnf(msg string, args ...any) { z.Warn().Msgf(msg, args...) }
|
||||
func (z *zeroLogger) Errorf(msg string, args ...any) { z.Error().Msgf(msg, args...) }
|
||||
func (z *zeroLogger) Infof(msg string, args ...any) { z.Info().Msgf(msg, args...) }
|
||||
func (z *zeroLogger) Debugf(msg string, args ...any) { z.Debug().Msgf(msg, args...) }
|
||||
func (z *zeroLogger) Sub(module string) Logger {
|
||||
if z.mod != "" {
|
||||
module = fmt.Sprintf("%s/%s", z.mod, module)
|
||||
}
|
||||
return &zeroLogger{mod: module, Logger: z.Logger.With().Str("sublogger", module).Logger()}
|
||||
}
|
||||
|
||||
var _ Logger = &zeroLogger{}
|
||||
@@ -1,15 +0,0 @@
|
||||
package randbytes
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func Make(length int) []byte {
|
||||
random := make([]byte, length)
|
||||
_, err := rand.Read(random)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("failed to get random bytes: %w", err))
|
||||
}
|
||||
return random
|
||||
}
|
||||
Reference in New Issue
Block a user