Hi,
I'm trying to use axolotl to open an encrypted message and I believe I'm missing something. I have created a class that implements store interface with all the mandatory methods. The axolotl is used like this:
function LiteAxolotlStore() {
this.db = new JsonDB('/tmp/whatsapp', true, true);
this.identityKeyStore = new LiteIdentityKeyStore(this.db);
// This is axol instance with mandatory methods
this.axol = axolotl(this.identityKeyStore);
}
This class is called by another one later like this:
function AxolotlLayer() {
this.store = new LiteAxolotlStore();
}
Then I use it to unencrypt and incoming pkmsg like this:
AxolotlLayer.prototype.handlePreKeyWhisperMessage = function(node, callback) {
var context = this;
var from = node.attribute('from');
var data = node.child('enc').data();
this.store.axol.decryptPreKeyWhisperMessage(from, data).then(function(plaintext, err) {
if (err) {
console.error("AXOLOTL: Decryption error!");
console.error(err);
} else {
console.log("AXOLOTL: Decryption completed!");
console.log(plaintext);
if (node.child('enc').attribute('v') == 2) {
plaintext = context.unpadV2Plaintext(plaintext);
}
// Execute callback to send the message
callback(plaintext);
}
});
};
The problem is: nothing happens when I call decryptPreKeyWhisperMessage. It does not write anything to log, neither show any error messages. Can you tell me what am I missing? How can I debug decryptPreKeyWhisperMessage?
Hi,
I'm trying to use axolotl to open an encrypted message and I believe I'm missing something. I have created a class that implements store interface with all the mandatory methods. The axolotl is used like this:
function LiteAxolotlStore() { this.db = new JsonDB('/tmp/whatsapp', true, true); this.identityKeyStore = new LiteIdentityKeyStore(this.db); // This is axol instance with mandatory methods this.axol = axolotl(this.identityKeyStore); }This class is called by another one later like this:
function AxolotlLayer() { this.store = new LiteAxolotlStore(); }Then I use it to unencrypt and incoming pkmsg like this:
AxolotlLayer.prototype.handlePreKeyWhisperMessage = function(node, callback) { var context = this; var from = node.attribute('from'); var data = node.child('enc').data(); this.store.axol.decryptPreKeyWhisperMessage(from, data).then(function(plaintext, err) { if (err) { console.error("AXOLOTL: Decryption error!"); console.error(err); } else { console.log("AXOLOTL: Decryption completed!"); console.log(plaintext); if (node.child('enc').attribute('v') == 2) { plaintext = context.unpadV2Plaintext(plaintext); } // Execute callback to send the message callback(plaintext); } }); };The problem is: nothing happens when I call decryptPreKeyWhisperMessage. It does not write anything to log, neither show any error messages. Can you tell me what am I missing? How can I debug decryptPreKeyWhisperMessage?