use of com.google.nigori.common.NigoriMessages.GetRevisionsResponse in project nigori by ucam-cl-dtg.
the class CryptoNigoriDatastore method getRevisions.
@Override
public List<Revision> getRevisions(Index index) throws NigoriCryptographyException, UnsupportedEncodingException, IOException, UnauthorisedException {
byte[] encIndex = keyManager.encryptDeterministically(index.getBytes());
try {
GetRevisionsResponse getResponse = protocol.getRevisions(MessageLibrary.getRevisionsRequestAsProtobuf(keyManager.getServerName(), keyManager.signer(), encIndex));
if (getResponse == null) {
return null;
}
List<ByteString> revisions = getResponse.getRevisionsList();
List<Revision> answer = new ArrayList<Revision>(revisions.size());
for (ByteString revision : revisions) {
answer.add(new Revision(keyManager.decrypt(revision.toByteArray())));
}
return answer;
} catch (NotFoundException e) {
return null;
}
}
Aggregations