diff options
author | Wim <wim@42.be> | 2023-08-05 20:43:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-05 20:43:19 +0200 |
commit | 56e7bd01ca09ad52b0c4f48f146a20a4f1b78696 (patch) | |
tree | b1355645342667209263cbd355dc0b4254f1e8fe /vendor/go.mau.fi/whatsmeow/upload.go | |
parent | 9459495484d6e06a3d46de64fccd8d06f7ccc72c (diff) | |
download | matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.gz matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.bz2 matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.zip |
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/upload.go')
-rw-r--r-- | vendor/go.mau.fi/whatsmeow/upload.go | 8 |
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[:] |