congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
MXSession.getCrypto
Code IndexAdd Tabnine to your IDE (free)

How to use
getCrypto
method
in
org.matrix.androidsdk.MXSession

Best Java code snippets using org.matrix.androidsdk.MXSession.getCrypto (Showing top 20 results out of 315)

origin: matrix-org/matrix-android-sdk

@Override
public void initWithMatrixSession(MXSession matrixSession, String roomId) {
  mCrypto = matrixSession.getCrypto();
  mRoomId = roomId;
}
origin: matrix-org/matrix-android-sdk

@Override
public void initWithMatrixSession(MXSession matrixSession, String roomId) {
  mSession = matrixSession;
  mCrypto = matrixSession.getCrypto();
  mRoomId = roomId;
  mDeviceId = matrixSession.getCredentials().deviceId;
  // Default rotation periods
  // TODO: Make it configurable via parameters
  mSessionRotationPeriodMsgs = 100;
  mSessionRotationPeriodMs = 7 * 24 * 3600 * 1000;
}
origin: matrix-org/matrix-android-sdk

@Override
public void initWithMatrixSession(MXSession matrixSession) {
  mSession = matrixSession;
  mOlmDevice = matrixSession.getCrypto().getOlmDevice();
}
origin: matrix-org/matrix-android-sdk

/**
 * Init the object fields
 *
 * @param matrixSession the matrix session
 */
@Override
public void initWithMatrixSession(MXSession matrixSession) {
  mSession = matrixSession;
  mOlmDevice = matrixSession.getCrypto().getOlmDevice();
  mPendingEvents = new HashMap<>();
}
origin: matrix-org/matrix-android-sdk

/**
 * Helper for the real decryptEvent and for _retryDecryption. If
 * requestKeysOnFail is true, we'll send an m.room_key_request when we fail
 * to decrypt the event due to missing megolm keys.
 *
 * @param event the event
 */
private void requestKeysForEvent(Event event) {
  String sender = event.getSender();
  EncryptedEventContent wireContent = JsonUtils.toEncryptedEventContent(event.getWireContent());
  List<Map<String, String>> recipients = new ArrayList<>();
  Map<String, String> selfMap = new HashMap<>();
  selfMap.put("userId", mSession.getMyUserId());
  selfMap.put("deviceId", "*");
  recipients.add(selfMap);
  if (!TextUtils.equals(sender, mSession.getMyUserId())) {
    Map<String, String> senderMap = new HashMap<>();
    senderMap.put("userId", sender);
    senderMap.put("deviceId", wireContent.device_id);
    recipients.add(senderMap);
  }
  Map<String, String> requestBody = new HashMap<>();
  requestBody.put("room_id", event.roomId);
  requestBody.put("algorithm", wireContent.algorithm);
  requestBody.put("sender_key", wireContent.sender_key);
  requestBody.put("session_id", wireContent.session_id);
  mSession.getCrypto().requestRoomKey(requestBody, recipients);
}
origin: matrix-org/matrix-android-sdk

@Override
public void onSuccess(MXUsersDevicesMap<MXDeviceInfo> devicesMap) {
  final String deviceId = request.mDeviceId;
  final MXDeviceInfo deviceInfo = mSession.getCrypto().mCryptoStore.getUserDevice(deviceId, userId);
    devicesByUser.put(userId, new ArrayList<>(Arrays.asList(deviceInfo)));
    mSession.getCrypto().ensureOlmSessionsForDevices(devicesByUser, new ApiCallback<MXUsersDevicesMap<MXOlmSessionResult>>() {
      @Override
      public void onSuccess(MXUsersDevicesMap<MXOlmSessionResult> map) {
origin: matrix-org/matrix-android-sdk

  @Override
  public void onSuccess(List<RoomMember> members) {
    if (members.size() != 2) {
      // Safety check
      callback.onUnexpectedError(new Exception("Wrong number of members"));
      return;
    }
    String userId1 = members.get(0).getUserId();
    String userId2 = members.get(1).getUserId();
    // force the refresh to ensure that the devices list is up-to-date
    mSession.getCrypto().checkUnknownDevices(Arrays.asList(userId1, userId2), new SimpleApiCallback<Void>(callback) {
      @Override
      public void onSuccess(Void anything) {
        final IMXCall call = getCallWithCallId(null, true);
        call.setRooms(room, room);
        call.setIsVideo(isVideo);
        dispatchOnOutgoingCall(call);
        if (null != callback) {
          mUIThreadHandler.post(new Runnable() {
            @Override
            public void run() {
              callback.onSuccess(call);
            }
          });
        }
      }
    });
  }
});
origin: matrix-org/matrix-android-sdk

final Event fEvent = event;
final MXEventDecryptionResult fResut = result;
mSession.getCrypto().getUIHandler().post(new Runnable() {
  @Override
  public void run() {
origin: matrix-org/matrix-android-sdk

mSession.getCrypto().getKeysBackup().maybeBackupKeys();
content.put("session_id", roomKeyContent.session_id);
content.put("sender_key", senderKey);
mSession.getCrypto().cancelRoomKeyRequest(content);
origin: matrix-org/matrix-android-sdk

@Test
public void test01_testCryptoNoDeviceId() throws Exception {
  Log.e(LOG_TAG, "test01_testCryptoNoDeviceId");
  Context context = InstrumentationRegistry.getContext();
  final Map<String, Object> results = new HashMap<>();
  MXSession bobSession = mTestHelper.createAccount(TestConstants.USER_BOB, mCryptoTestHelper.getDefaultSessionParams());
  Assert.assertNull(bobSession.getCrypto());
  bobSession.getCredentials().deviceId = null;
  CountDownLatch lock1 = new CountDownLatch(1);
  bobSession.enableCrypto(true, new TestApiCallback<Void>(lock1) {
    @Override
    public void onSuccess(Void info) {
      results.put("enableCrypto", "enableCrypto");
      super.onSuccess(info);
    }
  });
  mTestHelper.await(lock1);
  Assert.assertTrue(results.containsKey("enableCrypto"));
  Assert.assertNotNull(bobSession.getCrypto());
  Assert.assertNotNull(bobSession.getCredentials().deviceId);
  bobSession.clear(context);
}
origin: matrix-org/matrix-android-sdk

final MXSession bobSession = cryptoTestData.getSecondSession();
aliceSession.getCrypto().setWarnOnUnknownDevices(false);
aliceSession.getCrypto().getDeviceList().downloadKeys(Arrays.asList(bobSession.getMyUserId()), false,
    new TestApiCallback<MXUsersDevicesMap<MXDeviceInfo>>(lock1) {
      @Override
aliceSession.getCrypto().getDeviceList().downloadKeys(Arrays.asList(bobSession.getMyUserId()), false,
    new TestApiCallback<MXUsersDevicesMap<MXDeviceInfo>>(lock2) {
      @Override
origin: matrix-org/matrix-android-sdk

final MXSession bobSession = cryptoTestData.getSecondSession();
bobSession.getCrypto().setWarnOnUnknownDevices(false);
aliceSession.getCrypto().setWarnOnUnknownDevices(false);
aliceSession.getCrypto().getDeviceList()
    .downloadKeys(Arrays.asList(bobSession.getMyUserId(), "@pppppppppppp:matrix.org"), false,
        new TestApiCallback<MXUsersDevicesMap<MXDeviceInfo>>(lock1) {
origin: matrix-org/matrix-android-sdk

List<String> deviceInfos = unknownDevices.getUserDeviceIds(bobSession.getMyUserId());
Assert.assertEquals(1, deviceInfos.size());
Assert.assertEquals(deviceInfos.get(0), bobSession.getCrypto().getMyDevice().deviceId);
aliceSession.getCrypto().setDevicesKnown(Arrays.asList(bobSession.getCrypto().getMyDevice()), new TestApiCallback<Void>(lock2) {
  @Override
  public void onSuccess(Void info) {
Assert.assertTrue(results.containsKey("onLiveEvent"));
Assert.assertEquals(MXDeviceList.TRACKING_STATUS_UP_TO_DATE, bobSession.getCrypto().getDeviceTrackingStatus(bobSession.getMyUserId()));
Assert.assertEquals(MXDeviceList.TRACKING_STATUS_UP_TO_DATE, bobSession.getCrypto().getDeviceTrackingStatus(aliceSession.getMyUserId()));
Assert.assertEquals(MXDeviceList.TRACKING_STATUS_UP_TO_DATE, aliceSession.getCrypto().getDeviceTrackingStatus(bobSession.getMyUserId()));
Assert.assertEquals(MXDeviceList.TRACKING_STATUS_UP_TO_DATE, aliceSession.getCrypto().getDeviceTrackingStatus(aliceSession.getMyUserId()));
origin: matrix-org/matrix-android-sdk

final MXSession bobSession = cryptoTestData.getSecondSession();
bobSession.getCrypto().setWarnOnUnknownDevices(false);
aliceSession.getCrypto().setWarnOnUnknownDevices(false);
String newSessionKey = aliceSession.getCrypto().getOlmDevice().getSessionKey(sessionId);
origin: matrix-org/matrix-android-sdk

final MXSession bobSession = cryptoTestData.getSecondSession();
bobSession.getCrypto().setWarnOnUnknownDevices(false);
aliceSession.getCrypto().setWarnOnUnknownDevices(false);
origin: matrix-org/matrix-android-sdk

Assert.assertTrue(results.containsKey("onCryptoSyncComplete"));
Assert.assertNotNull(bobSession2.getCrypto());
origin: matrix-org/matrix-android-sdk

Assert.assertNull(bobSession.getCrypto().getCryptoStore().getRoomAlgorithm(room.getRoomId()));
Assert.assertEquals(CryptoConstantsKt.MXCRYPTO_ALGORITHM_MEGOLM, bobSession.getCrypto().getCryptoStore().getRoomAlgorithm(room.getRoomId()));
origin: matrix-org/matrix-android-sdk

final MXSession bobSession = cryptoTestData.getSecondSession();
bobSession.getCrypto().setWarnOnUnknownDevices(false);
aliceSession.getCrypto().setWarnOnUnknownDevices(false);
origin: matrix-org/matrix-android-sdk

final MXSession bobSession = cryptoTestData.getSecondSession();
aliceSession.getCrypto().setWarnOnUnknownDevices(false);
origin: matrix-org/matrix-android-sdk

final String aliceRoomId = cryptoTestData.getRoomId();
aliceSession.getCrypto().setWarnOnUnknownDevices(false);
org.matrix.androidsdkMXSessiongetCrypto

Popular methods of MXSession

  • getDataHandler
    Get the data handler.
  • getMyUserId
    Get the session's current userid.
  • startEventStream
    Start the event stream (events thread that listens for events) with an event listener.
  • <init>
  • clear
    Clear the session data. if the callback is null, the clear is synchronous.
  • createRoom
    Create a new room with given properties.
  • enableCrypto
    Enable / disable the crypto.
  • getCredentials
    Get the user credentials.
  • getCryptoRestClient
  • getRoomsApiClient
    Get the API client for requests to the rooms API.
  • isCryptoEnabled
  • stopEventStream
    Gracefully stop the event stream.
  • isCryptoEnabled,
  • stopEventStream,
  • addDirectChatRoomToAccountData,
  • checkCrypto,
  • checkIfAlive,
  • clearApplicationCaches,
  • convertFilterToFilterId,
  • createDirectMessageRoom,
  • createRoomDirectMessage

Popular in Java

  • Updating database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • notifyDataSetChanged (ArrayAdapter)
  • getContentResolver (Context)
  • Menu (java.awt)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Collectors (java.util.stream)
  • JCheckBox (javax.swing)
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now