Tabnine Logo
MXSession.getCryptoRestClient
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: matrix-org/matrix-android-sdk

  /**
   * Send a RoomKeyRequest to a list of recipients
   *
   * @param message       the message
   * @param recipients    the recipients.
   * @param transactionId the transaction id
   * @param callback      the asynchronous callback.
   */
  private void sendMessageToDevices(final Map<String, Object> message,
                   List<Map<String, String>> recipients,
                   String transactionId,
                   final ApiCallback<Void> callback) {
    MXUsersDevicesMap<Map<String, Object>> contentMap = new MXUsersDevicesMap<>();

    for (Map<String, String> recipient : recipients) {
      contentMap.setObject(message, recipient.get("userId"), recipient.get("deviceId"));
    }

    mSession.getCryptoRestClient().sendToDevice(Event.EVENT_TYPE_ROOM_KEY_REQUEST, contentMap, transactionId, callback);
  }
}
origin: matrix-org/matrix-android-sdk

mSession.getCryptoRestClient().uploadKeys(null, oneTimeJson, mMyDevice.deviceId, new SimpleApiCallback<KeysUploadResponse>(callback) {
  @Override
  public void onSuccess(final KeysUploadResponse info) {
origin: matrix-org/matrix-android-sdk

} else {
  mSession.getCryptoRestClient().uploadKeys(null, null, mMyDevice.deviceId, new ApiCallback<KeysUploadResponse>() {
    private void onFailed(String errorMessage) {
      if (null != errorMessage) {
origin: matrix-org/matrix-android-sdk

/**
 * Upload my user's device keys.
 * This method must called on getEncryptingThreadHandler() thread.
 * The callback will called on UI thread.
 *
 * @param callback the asynchronous callback
 */
private void uploadDeviceKeys(ApiCallback<KeysUploadResponse> callback) {
  // Prepare the device keys data to send
  // Sign it
  mMyDevice.signatures = signObject(JsonUtils.getCanonicalizedJsonString(mMyDevice.signalableJSONDictionary()));
  // For now, we set the device id explicitly, as we may not be using the
  // same one as used in login.
  mSession.getCryptoRestClient().uploadKeys(mMyDevice.JSONDictionary(), null, mMyDevice.deviceId, callback);
}
origin: matrix-org/matrix-android-sdk

mSession.getCryptoRestClient().claimOneTimeKeysForUsersDevices(usersDevicesToClaim, new ApiCallback<MXUsersDevicesMap<MXKey>>() {
  @Override
  public void onSuccess(final MXUsersDevicesMap<MXKey> oneTimeKeys) {
origin: matrix-org/matrix-android-sdk

mxSession.getCryptoRestClient()
    .downloadKeysForUsers(filteredUsers, mxSession.getDataHandler().getStore().getEventStreamToken(), new ApiCallback<KeysQueryResponse>() {
      @Override
origin: matrix-org/matrix-android-sdk

@Test
public void test02_testOneTimeKeys() throws Exception {
  Context context = InstrumentationRegistry.getContext();
  final SessionTestParams testParams = new SessionTestParams(true);
  final MXSession bobSession = mTestHelper.createAccount(TestConstants.USER_BOB, testParams);
  final Map<String, Object> results = new HashMap<>();
  final Map<String, Object> otks = new HashMap<>();
  otks.put("curve25519:AAAABQ", "ueuHES/Q0P1MZ4J3IUpC8iQTkgQNX66ZpxVLUaTDuB8");
  otks.put("curve25519:AAAABA", "PmyaaB68Any+za9CuZXzFsQZW31s/TW6XbAB9akEpQs");
  CountDownLatch lock1 = new CountDownLatch(1);
  bobSession.getCryptoRestClient().uploadKeys(null, otks, "dev1", new TestApiCallback<KeysUploadResponse>(lock1) {
    @Override
    public void onSuccess(KeysUploadResponse keysUploadResponse) {
      results.put("keysUploadResponse", keysUploadResponse);
      super.onSuccess(keysUploadResponse);
    }
  });
  mTestHelper.await(lock1);
  KeysUploadResponse keysUploadResponse = (KeysUploadResponse) results.get("keysUploadResponse");
  Assert.assertNotNull(keysUploadResponse);
  Assert.assertNotNull(keysUploadResponse.oneTimeKeyCounts);
  Assert.assertEquals(1, keysUploadResponse.oneTimeKeyCounts.size());
  Assert.assertEquals(2, keysUploadResponse.oneTimeKeyCountsForAlgorithm("curve25519"));
  Assert.assertEquals(0, keysUploadResponse.oneTimeKeyCountsForAlgorithm("deded"));
  bobSession.clear(context);
}
origin: matrix-org/matrix-android-sdk

bobSession.getCryptoRestClient().uploadKeys(null, otks, "dev1", new TestApiCallback<KeysUploadResponse>(lock1) {
  @Override
  public void onSuccess(KeysUploadResponse keysUploadResponse) {
aliceSession.getCryptoRestClient().claimOneTimeKeysForUsersDevices(usersDevicesKeyTypesMap, new TestApiCallback<MXUsersDevicesMap<MXKey>>(lock2) {
  @Override
  public void onSuccess(MXUsersDevicesMap<MXKey> usersDevicesMap) {
origin: matrix-org/matrix-android-sdk

bobSession.getCryptoRestClient().uploadKeys(bobDevice.JSONDictionary(), null, "dev1", new TestApiCallback<KeysUploadResponse>(lock0) {
  @Override
  public void onSuccess(KeysUploadResponse keysUploadResponse) {
bobSession.getCryptoRestClient().downloadKeysForUsers(Arrays.asList(bobSession.getMyUserId()), null, new TestApiCallback<KeysQueryResponse>(lock1) {
  @Override
  public void onSuccess(KeysQueryResponse keysQueryResponse) {
org.matrix.androidsdkMXSessiongetCryptoRestClient

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.
  • getCrypto
  • 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

  • Start an intent from android
  • onCreateOptionsMenu (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • getExternalFilesDir (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • ImageIO (javax.imageio)
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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