diff --git a/js/models/conversations.js b/js/models/conversations.js
index aa1412608..ddc73093e 100644
--- a/js/models/conversations.js
+++ b/js/models/conversations.js
@@ -620,7 +620,7 @@
response: 'declined',
direction: 'incoming',
});
- await window.libloki.removeContactPreKeyBundle(this.id);
+ await window.libloki.storage.removeContactPreKeyBundle(this.id);
},
// We have accepted an incoming friend request
async onAcceptFriendRequest() {
@@ -630,7 +630,7 @@
response: 'accepted',
direction: 'incoming',
});
- window.libloki.sendFriendRequestAccepted(this.id);
+ window.libloki.api.sendFriendRequestAccepted(this.id);
}
},
// Our outgoing friend request has been accepted
@@ -1548,7 +1548,7 @@
await this.setSessionResetStatus(SessionResetEnum.request_received);
// send empty message, this will trigger the new session to propagate
// to the reset initiator.
- await window.libloki.sendEmptyMessage(this.id);
+ await window.libloki.api.sendEmptyMessage(this.id);
},
isSessionResetReceived() {
@@ -1582,7 +1582,7 @@
async onNewSessionAdopted() {
if (this.get('sessionResetStatus') === SessionResetEnum.initiated) {
// send empty message to confirm that we have adopted the new session
- await window.libloki.sendEmptyMessage(this.id);
+ await window.libloki.api.sendEmptyMessage(this.id);
}
await this.createAndStoreEndSessionMessage({ type: 'incoming', endSessionType: 'done' });
await this.setSessionResetStatus(SessionResetEnum.none);
diff --git a/js/models/messages.js b/js/models/messages.js
index e3f568e7f..6f919391d 100644
--- a/js/models/messages.js
+++ b/js/models/messages.js
@@ -1407,7 +1407,7 @@
autoAccept = true;
message.set({ friendStatus: 'accepted' });
await conversation.onFriendRequestAccepted();
- window.libloki.sendFriendRequestAccepted(message.get('source'));
+ window.libloki.api.sendFriendRequestAccepted(message.get('source'));
} else if (!conversation.isFriend()) {
await conversation.onFriendRequestReceived();
}
diff --git a/libloki/test/index.html b/libloki/test/index.html
index 9bd8fde01..e690b0bb8 100644
--- a/libloki/test/index.html
+++ b/libloki/test/index.html
@@ -24,8 +24,10 @@
-
+
+
+
diff --git a/libloki/test/libloki-protocol_test.js b/libloki/test/libloki-protocol_test.js
index 9f73298a8..53c9d923a 100644
--- a/libloki/test/libloki-protocol_test.js
+++ b/libloki/test/libloki-protocol_test.js
@@ -18,7 +18,7 @@ describe('FallBackSessionCipher', () => {
pubKeyString,
1
);
- fallbackCipher = new libloki.FallBackSessionCipher(address);
+ fallbackCipher = new libloki.crypto.FallBackSessionCipher(address);
});
it('should encrypt fallback cipher messages as friend requests', async () => {
@@ -53,7 +53,7 @@ describe('LibLoki Protocol', () => {
const pubKey = libsignal.crypto.getRandomBytes(32);
const pubKeyString = StringView.arrayBufferToHex(pubKey);
const preKeyIdBefore = textsecure.storage.get('maxPreKeyId', 1);
- const newBundle = await libloki.getPreKeyBundleForContact(pubKeyString);
+ const newBundle = await libloki.storage.getPreKeyBundleForContact(pubKeyString);
const preKeyIdAfter = textsecure.storage.get('maxPreKeyId', 1);
assert.strictEqual(preKeyIdAfter, preKeyIdBefore + 1);
@@ -74,8 +74,8 @@ describe('LibLoki Protocol', () => {
it('should return the same prekey bundle after creating a contact', async () => {
const pubKey = libsignal.crypto.getRandomBytes(32);
const pubKeyString = StringView.arrayBufferToHex(pubKey);
- const bundle1 = await libloki.getPreKeyBundleForContact(pubKeyString);
- const bundle2 = await libloki.getPreKeyBundleForContact(pubKeyString);
+ const bundle1 = await libloki.storage.getPreKeyBundleForContact(pubKeyString);
+ const bundle2 = await libloki.storage.getPreKeyBundleForContact(pubKeyString);
assert.isDefined(bundle1);
assert.isDefined(bundle2);
assert.deepEqual(bundle1, bundle2);
@@ -85,7 +85,7 @@ describe('LibLoki Protocol', () => {
const pubKey = libsignal.crypto.getRandomBytes(32);
const pubKeyString = StringView.arrayBufferToHex(pubKey);
const preKeyIdBefore = textsecure.storage.get('maxPreKeyId', 1);
- const newBundle = await libloki.getPreKeyBundleForContact(pubKeyString);
+ const newBundle = await libloki.storage.getPreKeyBundleForContact(pubKeyString);
const preKeyIdAfter = textsecure.storage.get('maxPreKeyId', 1);
assert.strictEqual(preKeyIdAfter, preKeyIdBefore + 1);
diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js
index 04eaa43f6..ac61def0f 100644
--- a/libtextsecure/message_receiver.js
+++ b/libtextsecure/message_receiver.js
@@ -605,7 +605,7 @@ MessageReceiver.prototype.extend({
textsecure.storage.protocol
);
- const fallBackSessionCipher = new libloki.FallBackSessionCipher(
+ const fallBackSessionCipher = new libloki.crypto.FallBackSessionCipher(
address
);
@@ -1238,7 +1238,7 @@ MessageReceiver.prototype.extend({
);
}
- await libloki.saveContactPreKeyBundle({
+ await libloki.storage.saveContactPreKeyBundle({
pubKey,
preKeyId,
signedKeyId,
diff --git a/libtextsecure/outgoing_message.js b/libtextsecure/outgoing_message.js
index 9e702a906..9ab24570c 100644
--- a/libtextsecure/outgoing_message.js
+++ b/libtextsecure/outgoing_message.js
@@ -121,7 +121,7 @@ OutgoingMessage.prototype = {
}
return builder.processPreKey(device).then(async () => {
// TODO: only remove the keys that were used above!
- await window.libloki.removeContactPreKeyBundle(number);
+ await window.libloki.storage.removeContactPreKeyBundle(number);
return true;
}
).catch(error => {
@@ -288,7 +288,7 @@ OutgoingMessage.prototype = {
const address = new libsignal.SignalProtocolAddress(number, deviceId);
const ourKey = textsecure.storage.user.getNumber();
const options = {};
- const fallBackCipher = new libloki.FallBackSessionCipher(address);
+ const fallBackCipher = new libloki.crypto.FallBackSessionCipher(address);
// Check if we need to attach the preKeys
let sessionCipher;
@@ -297,7 +297,7 @@ OutgoingMessage.prototype = {
const isEndSession = flags === textsecure.protobuf.DataMessage.Flags.END_SESSION;
if (isFriendRequest || isEndSession) {
// Encrypt them with the fallback
- const pkb = await libloki.getPreKeyBundleForContact(number);
+ const pkb = await libloki.storage.getPreKeyBundleForContact(number);
const preKeyBundleMessage = new textsecure.protobuf.PreKeyBundleMessage(pkb);
this.message.preKeyBundleMessage = preKeyBundleMessage;
window.log.info('attaching prekeys to outgoing message');