in src/main/java/org/openvasp/client/service/impl/WhisperServiceImpl.java [200:234]
private Tuple2<String, String> createWhisperMessageFilter(
@NonNull final Topic topic,
@NonNull final EncryptionType encType,
@NonNull final String key) {
final String keyId, filterId;
switch (encType) {
case ASSYMETRIC: {
keyId = whisper.addPrivateKey(key);
filterId = whisper.newMessageFilter(ShhNewMessageFilterRequest.builder()
.privateKeyId(keyId)
.topics(Collections.singletonList(topic.getData()))
.build());
break;
}
case SYMMETRIC: {
keyId = whisper.addSymKey(key);
filterId = whisper.newMessageFilter(ShhNewMessageFilterRequest.builder()
.symKeyId(keyId)
.topics(Collections.singletonList(topic.getData()))
.build());
break;
}
default:
// encType cannot be null, so it is impossible to get there
// But because the Java compiler does not know that, it requires
// initialization of final 'keyId' and 'filterId'.
// The exception is just a workaround for the situation
throw new VaspException("It's impossible to get here");
}
return Tuple2.of(keyId, filterId);
}