Search in sources :

Example 1 with SecureUserStore

use of io.realm.android.SecureUserStore in project realm-java by realm.

the class MainActivity method buildSyncConf.

// build SyncConfiguration with a user store to store encrypted Token.
private void buildSyncConf() {
    try {
        SyncManager.setUserStore(new SecureUserStore(MainActivity.this));
        // the rest of Sync logic ...
        SyncUser user = createTestUser(0);
        String url = "realm://objectserver.realm.io/default";
        SyncConfiguration secureConfig = new SyncConfiguration.Builder(user, url).build();
        Realm realm = Realm.getInstance(secureConfig);
    // ... 
    } catch (KeyStoreException e) {
        e.printStackTrace();
    }
}
Also used : SyncUser(io.realm.SyncUser) SecureUserStore(io.realm.android.SecureUserStore) KeyStoreException(java.security.KeyStoreException) Realm(io.realm.Realm) SyncConfiguration(io.realm.SyncConfiguration)

Aggregations

Realm (io.realm.Realm)1 SyncConfiguration (io.realm.SyncConfiguration)1 SyncUser (io.realm.SyncUser)1 SecureUserStore (io.realm.android.SecureUserStore)1 KeyStoreException (java.security.KeyStoreException)1