summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/whatsmeow/upload.go
diff options
context:
space:
mode:
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[:]