{"action":"created","comment":{"url":"https://api.github.com/repos/realm/realm-cocoa/pulls/comments/108245234","pull_request_review_id":29264695,"id":108245234,"diff_hunk":"@@ -318,6 +319,67 @@ - (void)testDeleteObjects {\n     }\n }\n \n+#pragma mark - Encryption\n+\n+/// If client B encrypts its synced Realm, client A should be able to access that Realm with a different encryption key.\n+- (void)testEncryptedSyncedRealm {\n+    NSURL *url = REALM_URL();\n+    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:ACCOUNT_NAME()\n+                                                                                            register:self.isParent]\n+                                               server:[RLMObjectServerTests authServerURL]];\n+\n+    NSData *key = RLMGenerateKey();\n+    RLMRealm *realm = [self openRealmForURL:url user:user encryptionKey:key\n+                                 stopPolicy:RLMSyncStopPolicyAfterChangesUploaded immediatelyBlock:nil];\n+    if (self.isParent) {\n+        CHECK_COUNT(0, SyncObject, realm);\n+        RLMRunChildAndWait();\n+        [self waitForDownloadsForUser:user realms:@[realm] realmURLs:@[url] expectedCounts:@[@3]];\n+    } else {\n+        // Add objects.\n+        [self addSyncObjectsToRealm:realm descriptions:@[@\"child-1\", @\"child-2\", @\"child-3\"]];\n+        [self waitForUploadsForUser:user url:url];\n+        CHECK_COUNT(3, SyncObject, realm);\n+    }\n+}\n+\n+/// If an encrypted synced Realm is re-opened with the wrong key, throw an exception.\n+- (void)testEncryptedSyncedRealmWrongKey {\n+    NSURL *url = REALM_URL();\n+    RLMSyncUser *user = [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:ACCOUNT_NAME()\n+                                                                                            register:self.isParent]\n+                                               server:[RLMObjectServerTests authServerURL]];\n+\n+    if (self.isParent) {\n+        NSString *path;\n+        @autoreleasepool {\n+            RLMRealm *realm = [self openRealmForURL:url user:user encryptionKey:RLMGenerateKey()\n+                                         stopPolicy:RLMSyncStopPolicyImmediately immediatelyBlock:nil];\n+            path = realm.configuration.pathOnDisk;\n+            CHECK_COUNT(0, SyncObject, realm);\n+            RLMRunChildAndWait();\n+            [self waitForDownloadsForUser:user realms:@[realm] realmURLs:@[url] expectedCounts:@[@3]];\n+        }\n+        RLMRealmConfiguration *c = [RLMRealmConfiguration defaultConfiguration];","path":"Realm/ObjectServerTests/RLMObjectServerTests.m","position":53,"original_position":53,"commit_id":"83b5a8d350321522cd4e5f4e7d0c1bb8e98c09a2","original_commit_id":"83b5a8d350321522cd4e5f4e7d0c1bb8e98c09a2","user":{"login":"tgoyne","id":408944,"avatar_url":"https://avatars2.githubusercontent.com/u/408944?v=3","gravatar_id":"","url":"https://api.github.com/users/tgoyne","html_url":"https://github.com/tgoyne","followers_url":"https://api.github.com/users/tgoyne/followers","following_url":"https://api.github.com/users/tgoyne/following{/other_user}","gists_url":"https://api.github.com/users/tgoyne/gists{/gist_id}","starred_url":"https://api.github.com/users/tgoyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgoyne/subscriptions","organizations_url":"https://api.github.com/users/tgoyne/orgs","repos_url":"https://api.github.com/users/tgoyne/repos","events_url":"https://api.github.com/users/tgoyne/events{/privacy}","received_events_url":"https://api.github.com/users/tgoyne/received_events","type":"User","site_admin":false},"body":"This test should also test re-opening it as a synced Realm with the wrong encryption key.","created_at":"2017-03-27T18:31:23Z","updated_at":"2017-03-27T18:31:23Z","html_url":"https://github.com/realm/realm-cocoa/pull/4782#discussion_r108245234","pull_request_url":"https://api.github.com/repos/realm/realm-cocoa/pulls/4782","_links":{"self":{"href":"https://api.github.com/repos/realm/realm-cocoa/pulls/comments/108245234"},"html":{"href":"https://github.com/realm/realm-cocoa/pull/4782#discussion_r108245234"},"pull_request":{"href":"https://api.github.com/repos/realm/realm-cocoa/pulls/4782"}}},"pull_request":{"url":"https://api.github.com/repos/realm/realm-cocoa/pulls/4782","id":112805163,"html_url":"https://github.com/realm/realm-cocoa/pull/4782","diff_url":"https://github.com/realm/realm-cocoa/pull/4782.diff","patch_url":"https://github.com/realm/realm-cocoa/pull/4782.patch","issue_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4782","number":4782,"state":"open","locked":false,"title":"Support encrypted synchronized Realms","user":{"login":"jpsim","id":474794,"avatar_url":"https://avatars3.githubusercontent.com/u/474794?v=3","gravatar_id":"","url":"https://api.github.com/users/jpsim","html_url":"https://github.com/jpsim","followers_url":"https://api.github.com/users/jpsim/followers","following_url":"https://api.github.com/users/jpsim/following{/other_user}","gists_url":"https://api.github.com/users/jpsim/gists{/gist_id}","starred_url":"https://api.github.com/users/jpsim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpsim/subscriptions","organizations_url":"https://api.github.com/users/jpsim/orgs","repos_url":"https://api.github.com/users/jpsim/repos","events_url":"https://api.github.com/users/jpsim/events{/privacy}","received_events_url":"https://api.github.com/users/jpsim/received_events","type":"User","site_admin":false},"body":"Still missing changelog entries for this and\nother changes that happen to have been pulled in due to the\ncore, sync and object store updates","created_at":"2017-03-27T18:10:30Z","updated_at":"2017-03-27T18:31:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"28046e2a0c98ffae10b09028bb97f128f90ef6ec","assignee":{"login":"jpsim","id":474794,"avatar_url":"https://avatars3.githubusercontent.com/u/474794?v=3","gravatar_id":"","url":"https://api.github.com/users/jpsim","html_url":"https://github.com/jpsim","followers_url":"https://api.github.com/users/jpsim/followers","following_url":"https://api.github.com/users/jpsim/following{/other_user}","gists_url":"https://api.github.com/users/jpsim/gists{/gist_id}","starred_url":"https://api.github.com/users/jpsim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpsim/subscriptions","organizations_url":"https://api.github.com/users/jpsim/orgs","repos_url":"https://api.github.com/users/jpsim/repos","events_url":"https://api.github.com/users/jpsim/events{/privacy}","received_events_url":"https://api.github.com/users/jpsim/received_events","type":"User","site_admin":false},"assignees":[{"login":"jpsim","id":474794,"avatar_url":"https://avatars3.githubusercontent.com/u/474794?v=3","gravatar_id":"","url":"https://api.github.com/users/jpsim","html_url":"https://github.com/jpsim","followers_url":"https://api.github.com/users/jpsim/followers","following_url":"https://api.github.com/users/jpsim/following{/other_user}","gists_url":"https://api.github.com/users/jpsim/gists{/gist_id}","starred_url":"https://api.github.com/users/jpsim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpsim/subscriptions","organizations_url":"https://api.github.com/users/jpsim/orgs","repos_url":"https://api.github.com/users/jpsim/repos","events_url":"https://api.github.com/users/jpsim/events{/privacy}","received_events_url":"https://api.github.com/users/jpsim/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/realm/realm-cocoa/pulls/4782/commits","review_comments_url":"https://api.github.com/repos/realm/realm-cocoa/pulls/4782/comments","review_comment_url":"https://api.github.com/repos/realm/realm-cocoa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4782/comments","statuses_url":"https://api.github.com/repos/realm/realm-cocoa/statuses/83b5a8d350321522cd4e5f4e7d0c1bb8e98c09a2","head":{"label":"realm:jp-sync-encryption","ref":"jp-sync-encryption","sha":"83b5a8d350321522cd4e5f4e7d0c1bb8e98c09a2","user":{"login":"realm","id":7575099,"avatar_url":"https://avatars3.githubusercontent.com/u/7575099?v=3","gravatar_id":"","url":"https://api.github.com/users/realm","html_url":"https://github.com/realm","followers_url":"https://api.github.com/users/realm/followers","following_url":"https://api.github.com/users/realm/following{/other_user}","gists_url":"https://api.github.com/users/realm/gists{/gist_id}","starred_url":"https://api.github.com/users/realm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realm/subscriptions","organizations_url":"https://api.github.com/users/realm/orgs","repos_url":"https://api.github.com/users/realm/repos","events_url":"https://api.github.com/users/realm/events{/privacy}","received_events_url":"https://api.github.com/users/realm/received_events","type":"Organization","site_admin":false},"repo":{"id":4044891,"name":"realm-cocoa","full_name":"realm/realm-cocoa","owner":{"login":"realm","id":7575099,"avatar_url":"https://avatars3.githubusercontent.com/u/7575099?v=3","gravatar_id":"","url":"https://api.github.com/users/realm","html_url":"https://github.com/realm","followers_url":"https://api.github.com/users/realm/followers","following_url":"https://api.github.com/users/realm/following{/other_user}","gists_url":"https://api.github.com/users/realm/gists{/gist_id}","starred_url":"https://api.github.com/users/realm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realm/subscriptions","organizations_url":"https://api.github.com/users/realm/orgs","repos_url":"https://api.github.com/users/realm/repos","events_url":"https://api.github.com/users/realm/events{/privacy}","received_events_url":"https://api.github.com/users/realm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/realm/realm-cocoa","description":"Realm is a mobile database: a replacement for Core Data & SQLite","fork":false,"url":"https://api.github.com/repos/realm/realm-cocoa","forks_url":"https://api.github.com/repos/realm/realm-cocoa/forks","keys_url":"https://api.github.com/repos/realm/realm-cocoa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/realm/realm-cocoa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/realm/realm-cocoa/teams","hooks_url":"https://api.github.com/repos/realm/realm-cocoa/hooks","issue_events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/events{/number}","events_url":"https://api.github.com/repos/realm/realm-cocoa/events","assignees_url":"https://api.github.com/repos/realm/realm-cocoa/assignees{/user}","branches_url":"https://api.github.com/repos/realm/realm-cocoa/branches{/branch}","tags_url":"https://api.github.com/repos/realm/realm-cocoa/tags","blobs_url":"https://api.github.com/repos/realm/realm-cocoa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/realm/realm-cocoa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/realm/realm-cocoa/git/refs{/sha}","trees_url":"https://api.github.com/repos/realm/realm-cocoa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/realm/realm-cocoa/statuses/{sha}","languages_url":"https://api.github.com/repos/realm/realm-cocoa/languages","stargazers_url":"https://api.github.com/repos/realm/realm-cocoa/stargazers","contributors_url":"https://api.github.com/repos/realm/realm-cocoa/contributors","subscribers_url":"https://api.github.com/repos/realm/realm-cocoa/subscribers","subscription_url":"https://api.github.com/repos/realm/realm-cocoa/subscription","commits_url":"https://api.github.com/repos/realm/realm-cocoa/commits{/sha}","git_commits_url":"https://api.github.com/repos/realm/realm-cocoa/git/commits{/sha}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/comments{/number}","issue_comment_url":"https://api.github.com/repos/realm/realm-cocoa/issues/comments{/number}","contents_url":"https://api.github.com/repos/realm/realm-cocoa/contents/{+path}","compare_url":"https://api.github.com/repos/realm/realm-cocoa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/realm/realm-cocoa/merges","archive_url":"https://api.github.com/repos/realm/realm-cocoa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/realm/realm-cocoa/downloads","issues_url":"https://api.github.com/repos/realm/realm-cocoa/issues{/number}","pulls_url":"https://api.github.com/repos/realm/realm-cocoa/pulls{/number}","milestones_url":"https://api.github.com/repos/realm/realm-cocoa/milestones{/number}","notifications_url":"https://api.github.com/repos/realm/realm-cocoa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/realm/realm-cocoa/labels{/name}","releases_url":"https://api.github.com/repos/realm/realm-cocoa/releases{/id}","deployments_url":"https://api.github.com/repos/realm/realm-cocoa/deployments","created_at":"2012-04-16T20:06:56Z","updated_at":"2017-03-27T17:41:52Z","pushed_at":"2017-03-27T18:20:21Z","git_url":"git://github.com/realm/realm-cocoa.git","ssh_url":"git@github.com:realm/realm-cocoa.git","clone_url":"https://github.com/realm/realm-cocoa.git","svn_url":"https://github.com/realm/realm-cocoa","homepage":"https://realm.io","size":50109,"stargazers_count":10333,"watchers_count":10333,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1303,"mirror_url":null,"open_issues_count":250,"forks":1303,"open_issues":250,"watchers":10333,"default_branch":"master"}},"base":{"label":"realm:master","ref":"master","sha":"e40eae3488aebf1ecce776f65f00bf9d77c330ec","user":{"login":"realm","id":7575099,"avatar_url":"https://avatars3.githubusercontent.com/u/7575099?v=3","gravatar_id":"","url":"https://api.github.com/users/realm","html_url":"https://github.com/realm","followers_url":"https://api.github.com/users/realm/followers","following_url":"https://api.github.com/users/realm/following{/other_user}","gists_url":"https://api.github.com/users/realm/gists{/gist_id}","starred_url":"https://api.github.com/users/realm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realm/subscriptions","organizations_url":"https://api.github.com/users/realm/orgs","repos_url":"https://api.github.com/users/realm/repos","events_url":"https://api.github.com/users/realm/events{/privacy}","received_events_url":"https://api.github.com/users/realm/received_events","type":"Organization","site_admin":false},"repo":{"id":4044891,"name":"realm-cocoa","full_name":"realm/realm-cocoa","owner":{"login":"realm","id":7575099,"avatar_url":"https://avatars3.githubusercontent.com/u/7575099?v=3","gravatar_id":"","url":"https://api.github.com/users/realm","html_url":"https://github.com/realm","followers_url":"https://api.github.com/users/realm/followers","following_url":"https://api.github.com/users/realm/following{/other_user}","gists_url":"https://api.github.com/users/realm/gists{/gist_id}","starred_url":"https://api.github.com/users/realm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realm/subscriptions","organizations_url":"https://api.github.com/users/realm/orgs","repos_url":"https://api.github.com/users/realm/repos","events_url":"https://api.github.com/users/realm/events{/privacy}","received_events_url":"https://api.github.com/users/realm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/realm/realm-cocoa","description":"Realm is a mobile database: a replacement for Core Data & SQLite","fork":false,"url":"https://api.github.com/repos/realm/realm-cocoa","forks_url":"https://api.github.com/repos/realm/realm-cocoa/forks","keys_url":"https://api.github.com/repos/realm/realm-cocoa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/realm/realm-cocoa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/realm/realm-cocoa/teams","hooks_url":"https://api.github.com/repos/realm/realm-cocoa/hooks","issue_events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/events{/number}","events_url":"https://api.github.com/repos/realm/realm-cocoa/events","assignees_url":"https://api.github.com/repos/realm/realm-cocoa/assignees{/user}","branches_url":"https://api.github.com/repos/realm/realm-cocoa/branches{/branch}","tags_url":"https://api.github.com/repos/realm/realm-cocoa/tags","blobs_url":"https://api.github.com/repos/realm/realm-cocoa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/realm/realm-cocoa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/realm/realm-cocoa/git/refs{/sha}","trees_url":"https://api.github.com/repos/realm/realm-cocoa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/realm/realm-cocoa/statuses/{sha}","languages_url":"https://api.github.com/repos/realm/realm-cocoa/languages","stargazers_url":"https://api.github.com/repos/realm/realm-cocoa/stargazers","contributors_url":"https://api.github.com/repos/realm/realm-cocoa/contributors","subscribers_url":"https://api.github.com/repos/realm/realm-cocoa/subscribers","subscription_url":"https://api.github.com/repos/realm/realm-cocoa/subscription","commits_url":"https://api.github.com/repos/realm/realm-cocoa/commits{/sha}","git_commits_url":"https://api.github.com/repos/realm/realm-cocoa/git/commits{/sha}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/comments{/number}","issue_comment_url":"https://api.github.com/repos/realm/realm-cocoa/issues/comments{/number}","contents_url":"https://api.github.com/repos/realm/realm-cocoa/contents/{+path}","compare_url":"https://api.github.com/repos/realm/realm-cocoa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/realm/realm-cocoa/merges","archive_url":"https://api.github.com/repos/realm/realm-cocoa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/realm/realm-cocoa/downloads","issues_url":"https://api.github.com/repos/realm/realm-cocoa/issues{/number}","pulls_url":"https://api.github.com/repos/realm/realm-cocoa/pulls{/number}","milestones_url":"https://api.github.com/repos/realm/realm-cocoa/milestones{/number}","notifications_url":"https://api.github.com/repos/realm/realm-cocoa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/realm/realm-cocoa/labels{/name}","releases_url":"https://api.github.com/repos/realm/realm-cocoa/releases{/id}","deployments_url":"https://api.github.com/repos/realm/realm-cocoa/deployments","created_at":"2012-04-16T20:06:56Z","updated_at":"2017-03-27T17:41:52Z","pushed_at":"2017-03-27T18:20:21Z","git_url":"git://github.com/realm/realm-cocoa.git","ssh_url":"git@github.com:realm/realm-cocoa.git","clone_url":"https://github.com/realm/realm-cocoa.git","svn_url":"https://github.com/realm/realm-cocoa","homepage":"https://realm.io","size":50109,"stargazers_count":10333,"watchers_count":10333,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1303,"mirror_url":null,"open_issues_count":250,"forks":1303,"open_issues":250,"watchers":10333,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/realm/realm-cocoa/pulls/4782"},"html":{"href":"https://github.com/realm/realm-cocoa/pull/4782"},"issue":{"href":"https://api.github.com/repos/realm/realm-cocoa/issues/4782"},"comments":{"href":"https://api.github.com/repos/realm/realm-cocoa/issues/4782/comments"},"review_comments":{"href":"https://api.github.com/repos/realm/realm-cocoa/pulls/4782/comments"},"review_comment":{"href":"https://api.github.com/repos/realm/realm-cocoa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/realm/realm-cocoa/pulls/4782/commits"},"statuses":{"href":"https://api.github.com/repos/realm/realm-cocoa/statuses/83b5a8d350321522cd4e5f4e7d0c1bb8e98c09a2"}}}}
{"actor":{"display_login":"tgoyne"}}