|
|
|
@ -116,10 +116,21 @@ function MessageSender(url, username, password, cdn_url) {
|
|
|
|
|
|
|
|
|
|
MessageSender.prototype = {
|
|
|
|
|
constructor: MessageSender,
|
|
|
|
|
|
|
|
|
|
// makeAttachmentPointer :: Attachment -> Promise AttachmentPointerProto
|
|
|
|
|
makeAttachmentPointer: function(attachment) {
|
|
|
|
|
if (typeof attachment !== 'object' || attachment == null) {
|
|
|
|
|
return Promise.resolve(undefined);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(attachment.data instanceof ArrayBuffer) &&
|
|
|
|
|
!ArrayBuffer.isView(attachment.data)) {
|
|
|
|
|
return Promise.reject(new TypeError(
|
|
|
|
|
'`attachment.data` must be an `ArrayBuffer` or `ArrayBufferView`; got: ' +
|
|
|
|
|
typeof attachment.data
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var proto = new textsecure.protobuf.AttachmentPointer();
|
|
|
|
|
proto.key = libsignal.crypto.getRandomBytes(64);
|
|
|
|
|
|
|
|
|
|