summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/whatsmeow/store
diff options
context:
space:
mode:
authorWim <wim@42.be>2023-08-05 20:43:19 +0200
committerGitHub <noreply@github.com>2023-08-05 20:43:19 +0200
commit56e7bd01ca09ad52b0c4f48f146a20a4f1b78696 (patch)
treeb1355645342667209263cbd355dc0b4254f1e8fe /vendor/go.mau.fi/whatsmeow/store
parent9459495484d6e06a3d46de64fccd8d06f7ccc72c (diff)
downloadmatterbridge-msglm-master.tar.gz
matterbridge-msglm-master.tar.bz2
matterbridge-msglm-master.zip
Update dependencies and remove old matterclient lib (#2067)HEADmaster
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/store')
-rw-r--r--vendor/go.mau.fi/whatsmeow/store/clientpayload.go2
-rw-r--r--vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go15
-rw-r--r--vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go12
-rw-r--r--vendor/go.mau.fi/whatsmeow/store/store.go1
4 files changed, 21 insertions, 9 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/store/clientpayload.go b/vendor/go.mau.fi/whatsmeow/store/clientpayload.go
index 9e8b1778..5ef7d2e6 100644
--- a/vendor/go.mau.fi/whatsmeow/store/clientpayload.go
+++ b/vendor/go.mau.fi/whatsmeow/store/clientpayload.go
@@ -74,7 +74,7 @@ func (vc WAVersionContainer) ProtoAppVersion() *waProto.ClientPayload_UserAgent_
}
// waVersion is the WhatsApp web client version
-var waVersion = WAVersionContainer{2, 2310, 5}
+var waVersion = WAVersionContainer{2, 2332, 15}
// waVersionHash is the md5 hash of a dot-separated waVersion
var waVersionHash [16]byte
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
diff --git a/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go b/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go
index f9f5a287..a6acdfc0 100644
--- a/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go
+++ b/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go
@@ -284,7 +284,8 @@ const (
SET key_data=excluded.key_data, timestamp=excluded.timestamp, fingerprint=excluded.fingerprint
WHERE excluded.timestamp > whatsmeow_app_state_sync_keys.timestamp
`
- getAppStateSyncKeyQuery = `SELECT key_data, timestamp, fingerprint FROM whatsmeow_app_state_sync_keys WHERE jid=$1 AND key_id=$2`
+ getAppStateSyncKeyQuery = `SELECT key_data, timestamp, fingerprint FROM whatsmeow_app_state_sync_keys WHERE jid=$1 AND key_id=$2`
+ getLatestAppStateSyncKeyIDQuery = `SELECT key_id FROM whatsmeow_app_state_sync_keys WHERE jid=$1 ORDER BY timestamp DESC LIMIT 1`
)
func (s *SQLStore) PutAppStateSyncKey(id []byte, key store.AppStateSyncKey) error {
@@ -301,6 +302,15 @@ func (s *SQLStore) GetAppStateSyncKey(id []byte) (*store.AppStateSyncKey, error)
return &key, err
}
+func (s *SQLStore) GetLatestAppStateSyncKeyID() ([]byte, error) {
+ var keyID []byte
+ err := s.db.QueryRow(getLatestAppStateSyncKeyIDQuery, s.JID).Scan(&keyID)
+ if errors.Is(err, sql.ErrNoRows) {
+ return nil, nil
+ }
+ return keyID, err
+}
+
const (
putAppStateVersionQuery = `
INSERT INTO whatsmeow_app_state_version (jid, name, version, hash) VALUES ($1, $2, $3, $4)
diff --git a/vendor/go.mau.fi/whatsmeow/store/store.go b/vendor/go.mau.fi/whatsmeow/store/store.go
index 36a6dce9..49c2176e 100644
--- a/vendor/go.mau.fi/whatsmeow/store/store.go
+++ b/vendor/go.mau.fi/whatsmeow/store/store.go
@@ -55,6 +55,7 @@ type AppStateSyncKey struct {
type AppStateSyncKeyStore interface {
PutAppStateSyncKey(id []byte, key AppStateSyncKey) error
GetAppStateSyncKey(id []byte) (*AppStateSyncKey, error)
+ GetLatestAppStateSyncKeyID() ([]byte, error)
}
type AppStateMutationMAC struct {