Make configuration enums in lowercase. Wrap create hashes by try-catch. Add initial part of the documentation.

This commit is contained in:
Anatoly Sablin
2019-11-15 23:39:45 +03:00
parent 9e4cabb69b
commit f9daf4d58a
8 changed files with 83 additions and 20 deletions

View File

@@ -84,7 +84,7 @@ public class HashLookupHandler extends LookupHandler implements ApiHandler {
}
private void noneAlgorithm(HttpServerExchange exchange, HashLookupRequest request, ClientHashLookupRequest input) throws Exception {
if (!hashManager.getConfig().getAlgorithms().contains(HashingConfig.Algorithm.NONE)) {
if (!hashManager.getConfig().getAlgorithms().contains(HashingConfig.Algorithm.none)) {
throw new InvalidParamException();
}
@@ -110,7 +110,7 @@ public class HashLookupHandler extends LookupHandler implements ApiHandler {
}
private void sha256Algorithm(HttpServerExchange exchange, HashLookupRequest request, ClientHashLookupRequest input) {
if (!hashManager.getConfig().getAlgorithms().contains(HashingConfig.Algorithm.SHA256)) {
if (!hashManager.getConfig().getAlgorithms().contains(HashingConfig.Algorithm.sha256)) {
throw new InvalidParamException();
}