From 56e7bd01ca09ad52b0c4f48f146a20a4f1b78696 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 5 Aug 2023 20:43:19 +0200 Subject: Update dependencies and remove old matterclient lib (#2067) --- vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go') diff --git a/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go b/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go index 7f8c6c8f..4fbcec34 100644 --- a/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go +++ b/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go @@ -7,7 +7,6 @@ package sqlstore import ( - "crypto/rand" "database/sql" "errors" "fmt" @@ -18,6 +17,7 @@ import ( "go.mau.fi/whatsmeow/types" "go.mau.fi/whatsmeow/util/keys" waLog "go.mau.fi/whatsmeow/util/log" + "go.mau.fi/whatsmeow/util/randbytes" ) // Container is a wrapper for a SQL database that can contain multiple whatsmeow sessions. @@ -65,7 +65,12 @@ func New(dialect, address string, log waLog.Logger) (*Container, error) { // if err != nil { // panic(err) // } -// container, err := sqlstore.NewWithDB(db, "sqlite3", nil) +// container := sqlstore.NewWithDB(db, "sqlite3", nil) +// +// This method does not call Upgrade automatically like New does, so you must call it yourself: +// +// container := sqlstore.NewWithDB(...) +// err := container.Upgrade() func NewWithDB(db *sql.DB, dialect string, log waLog.Logger) *Container { if log == nil { log = waLog.Noop @@ -205,11 +210,7 @@ func (c *Container) NewDevice() *store.Device { NoiseKey: keys.NewKeyPair(), IdentityKey: keys.NewKeyPair(), RegistrationID: mathRand.Uint32(), - AdvSecretKey: make([]byte, 32), - } - _, err := rand.Read(device.AdvSecretKey) - if err != nil { - panic(err) + AdvSecretKey: randbytes.Make(32), } device.SignedPreKey = device.IdentityKey.CreateSignedPreKey(1) return device -- cgit v1.2.3