List full keybase id or strong key id matches on top

This commit is contained in:
Thialfihar 2014-05-14 14:08:33 +02:00
parent f4a8e71c33
commit d50e798c13

View File

@ -55,10 +55,19 @@ public class KeybaseKeyServer extends KeyServer {
// only list them if they have a key // only list them if they have a key
if (JWalk.optObject(match, "components", "key_fingerprint") != null) { if (JWalk.optObject(match, "components", "key_fingerprint") != null) {
String keybaseId = JWalk.getString(match, "components", "username", "val");
String fingerprint = JWalk.getString(match, "components", "key_fingerprint", "val");
fingerprint = fingerprint.replace(" ", "").toUpperCase();
if (keybaseId.equals(query) || fingerprint.startsWith(query.toUpperCase())) {
results.add(makeEntry(match));
} else {
results.add(makeEntry(match)); results.add(makeEntry(match));
} }
} }
}
} catch (Exception e) { } catch (Exception e) {
Log.e(Constants.TAG, "keybase result parsing error", e);
throw new QueryException("Unexpected structure in keybase search result: " + e.getMessage()); throw new QueryException("Unexpected structure in keybase search result: " + e.getMessage());
} }