serialize message as base64

pull/6/head
sachaaaaa 7 years ago
parent 1e14022e2f
commit 8ada6ce8ad

@ -29,7 +29,7 @@ function initialize({ url }) {
body = JSON.stringify({
pub_key: options.pub_key,
message: String.fromCharCode.apply(null, options.data),
message: options.data,
ttl: options.ttl,
})

@ -308,9 +308,11 @@ OutgoingMessage.prototype = {
},
sendToNumber(number) {
if (true /* skipEncryption */)
{
const options = {
pub_key: number,
data: this.getPlaintext(),
data: StringView.bytesToBase64(this.getPlaintext()),
ttl: 2 * 24 * 60 * 60
};
return this.lokiserver.sendMessage(options).then(
@ -320,7 +322,9 @@ OutgoingMessage.prototype = {
},
(error) => console.log('Loki sendMessage failed')
);
/*
}
else
{
return this.getStaleDeviceIdsForNumber(number).then(updateDevices =>
this.getKeysForNumber(number, updateDevices)
.then(this.reloadDevicesAndSend(number, true))
@ -342,6 +346,7 @@ OutgoingMessage.prototype = {
);
}
})
);*/
);
}
},
};

@ -134,7 +134,6 @@ function prepareURL(pathSegments, moreKeys) {
serverUrl: config.get('serverUrl'),
cdnUrl: config.get('cdnUrl'),
certificateAuthority: config.get('certificateAuthority'),
skipEncryption: config.get('skipEncryption'),
environment: config.environment,
node_version: process.versions.node,
hostname: os.hostname(),

Loading…
Cancel
Save