Merge pull request #2423 from xaep/master

Make sure auth key selection dialog lists only keys with auth subkey available.
This commit is contained in:
Vincent Breitmoser 2018-12-14 11:01:08 +01:00 committed by GitHub
commit 82025ea8bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -164,6 +164,11 @@ public class KeyRepository extends AbstractDao {
return mapAllRows(query, SubKey.UNIFIED_KEY_INFO_MAPPER);
}
public List<UnifiedKeyInfo> getAllUnifiedKeyInfoWithAuthKeySecret() {
SqlDelightQuery query = SubKey.FACTORY.selectAllUnifiedKeyInfoWithAuthKeySecret();
return mapAllRows(query, SubKey.UNIFIED_KEY_INFO_MAPPER);
}
public List<UserId> getUserIds(long... masterKeyIds) {
SqlDelightQuery query = UserPacket.FACTORY.selectUserIdsByMasterKeyId(masterKeyIds);
return mapAllRows(query, UserPacket.USER_ID_MAPPER);

View File

@ -104,7 +104,7 @@ public class RemoteSelectAuthenticationKeyActivity extends FragmentActivity {
if (keyInfoLiveData == null) {
keyInfoLiveData = new GenericLiveData<>(context, () -> {
KeyRepository keyRepository = KeyRepository.create(context);
return keyRepository.getAllUnifiedKeyInfoWithSecret();
return keyRepository.getAllUnifiedKeyInfoWithAuthKeySecret();
});
}
return keyInfoLiveData;

View File

@ -92,6 +92,11 @@ SELECT * FROM unifiedKeyView
WHERE has_any_secret_int = 1
ORDER BY creation DESC;
selectAllUnifiedKeyInfoWithAuthKeySecret:
SELECT * FROM unifiedKeyView
WHERE has_any_secret_int = 1 AND has_auth_key_int IS NOT NULL
ORDER BY creation DESC;
selectMasterKeyIdBySubkey:
SELECT master_key_id
FROM keys