Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Keys Backup feature #401

Merged
merged 9 commits into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Features:
Improvements:
- Any Account data element, even if the type is not known is persisted.
- The crypto store is now implemented using a Realm database. The existing file store will be migrated at first usage (#398)
- Upgrade olm-sdk.aar from version 2.3.0 to version 3.0.0
- Implement the backup of the room keys in the KeysBackup class (vector-im/riot-android#2642)

Bugfix:
- Room members who left are listed with the actual members (vector-im/riot-android#2744)
Expand All @@ -16,6 +18,7 @@ Bugfix:
API Change:
- new API in CallSoundsManager to allow client to play the specified Ringtone (vector-im/riot-android#827)
- IMXStore.storeAccountData() has been renamed to IMXStore.storeRoomAccountData()
- MXCrypto: importRoomKeys methods now return number of imported keys and number of total keys in the Callback.

Translations:
-
Expand Down
Binary file modified matrix-sdk/libs/olm-sdk.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private MXSession createAccountAndSync(Context context,
CountDownLatch lock = new CountDownLatch(1);

// get the registration session id
loginRestClient.register(registrationParams, new TestApiCallback<Credentials>(lock) {
loginRestClient.register(registrationParams, new TestApiCallback<Credentials>(lock, false) {
@Override
public void onMatrixError(MatrixError e) {
// detect if a parameter is expected
Expand Down Expand Up @@ -281,7 +281,6 @@ public void onSuccess(Credentials credentials) {
IMXStore store = new MXFileStore(hs, false, context);

MXDataHandler dataHandler = new MXDataHandler(store, credentials);
// TODO Use sessionTestParam parameter when other PR will be merged
dataHandler.setLazyLoadingEnabled(sessionTestParams.getWithLazyLoading());

MXSession mxSession = new MXSession.Builder(hs, dataHandler, context)
Expand Down Expand Up @@ -356,7 +355,7 @@ public void onSuccess(Credentials credentials) {
* @throws InterruptedException
*/
public void await(CountDownLatch latch) throws InterruptedException {
Assert.assertTrue(latch.await(TestConstants.AWAIT_TIME_OUT_MILLIS, TimeUnit.MILLISECONDS));
Assert.assertTrue(latch.await(TestConstants.getTimeOutMillis(), TimeUnit.MILLISECONDS));
}

/**
Expand All @@ -373,8 +372,8 @@ public void clearAllSessions(List<MXSession> sessions) {
}

/**
* Clone a session
* // TODO Use this method where it should be (after merge of keys backup)
* Clone a session.
* It simulate that the user launches again the application with the same Credentials, contrary to login which will create a new DeviceId
*
* @param from the session to clone
* @return the duplicated session
Expand All @@ -383,10 +382,11 @@ public void clearAllSessions(List<MXSession> sessions) {
public MXSession createNewSession(@NonNull MXSession from, SessionTestParams sessionTestParams) throws InterruptedException {
final Context context = InstrumentationRegistry.getContext();

Credentials aliceCredentials = from.getCredentials();
HomeServerConnectionConfig hs = createHomeServerConfig(aliceCredentials);
Credentials credentials = from.getCredentials();
HomeServerConnectionConfig hs = createHomeServerConfig(credentials);
MXFileStore store = new MXFileStore(hs, false, context);
MXDataHandler dataHandler = new MXDataHandler(store, aliceCredentials);
MXDataHandler dataHandler = new MXDataHandler(store, credentials);
dataHandler.setLazyLoadingEnabled(sessionTestParams.getWithLazyLoading());
store.setDataHandler(dataHandler);
MXSession session2 = new MXSession.Builder(hs, dataHandler, context)
.withLegacyCryptoStore(sessionTestParams.getWithLegacyCryptoStore())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2018 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.matrix.androidsdk.common

import android.content.Context
import org.matrix.androidsdk.MXSession

data class CryptoTestData(val firstSession: MXSession,
val roomId: String,
val secondSession: MXSession? = null,
val thirdSession: MXSession? = null) {

fun clear(context: Context) {
firstSession.clear(context)
secondSession?.clear(context)
secondSession?.clear(context)
}
}
Loading