forked from lug/matterbridge
Update dependencies and remove old matterclient lib (#2067)
This commit is contained in:
8
vendor/go.mau.fi/whatsmeow/upload.go
vendored
8
vendor/go.mau.fi/whatsmeow/upload.go
vendored
@@ -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[:]
|
||||
|
||||
Reference in New Issue
Block a user