Cable-Desktop/libtextsecure/test/fake_api.js
lilia f764445c86 Remove erroneous license file and headers
We only use GPLV3 around here.

// FREEBIE
2015-09-07 14:58:42 -07:00

30 خطوط
1,020 B
JavaScript

/*
* vim: ts=4:sw=4:expandtab
*/
var getKeysForNumberMap = {};
TextSecureServer.getKeysForNumber = function(number, deviceId) {
var res = getKeysForNumberMap[number];
if (res !== undefined) {
delete getKeysForNumberMap[number];
return Promise.resolve(res);
} else
throw new Error("getKeysForNumber of unknown/used number");
};
var messagesSentMap = {};
TextSecureServer.sendMessages = function(destination, messageArray) {
for (i in messageArray) {
var msg = messageArray[i];
if ((msg.type != 1 && msg.type != 3) ||
msg.destinationDeviceId === undefined ||
msg.destinationRegistrationId === undefined ||
msg.body === undefined ||
msg.timestamp == undefined ||
msg.relay !== undefined ||
msg.destination !== undefined)
throw new Error("Invalid message");
messagesSentMap[destination + "." + messageArray[i].destinationDeviceId] = msg;
}
};