Codota Logo
MXSession.getCrypto
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
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

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now