summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/whatsmeow/upload.go
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/upload.go
parent9459495484d6e06a3d46de64fccd8d06f7ccc72c (diff)
downloadmatterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.gz
matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.bz2
matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.zip
Update dependencies and remove old matterclient lib (#2067)HEADmaster
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/upload.go')
-rw-r--r--vendor/go.mau.fi/whatsmeow/upload.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/upload.go b/vendor/go.mau.fi/whatsmeow/upload.go
index c72025f0..8bdc1543 100644
--- a/vendor/go.mau.fi/whatsmeow/upload.go
+++ b/vendor/go.mau.fi/whatsmeow/upload.go
@@ -10,7 +10,6 @@ import (
"bytes"
"context"
"crypto/hmac"
- "crypto/rand"
"crypto/sha256"
"encoding/base64"
"encoding/json"
@@ -20,6 +19,7 @@ import (
"go.mau.fi/whatsmeow/socket"
"go.mau.fi/whatsmeow/util/cbcutil"
+ "go.mau.fi/whatsmeow/util/randbytes"
)
// UploadResponse contains the data from the attachment upload, which can be put into a message to send the attachment.
@@ -62,11 +62,7 @@ type UploadResponse struct {
// The same applies to the other message types like DocumentMessage, just replace the struct type and Message field name.
func (cli *Client) Upload(ctx context.Context, plaintext []byte, appInfo MediaType) (resp UploadResponse, err error) {
resp.FileLength = uint64(len(plaintext))
- resp.MediaKey = make([]byte, 32)
- _, err = rand.Read(resp.MediaKey)
- if err != nil {
- return
- }
+ resp.MediaKey = randbytes.Make(32)
plaintextSHA256 := sha256.Sum256(plaintext)
resp.FileSHA256 = plaintextSHA256[:]