Refactoring and cleanup.

This commit is contained in:
Marko Zivanovic
2014-11-30 21:38:43 +01:00
parent 058ed381a1
commit f7ebe883d5
3 changed files with 6 additions and 7 deletions
@@ -30,7 +30,6 @@ import org.springframework.context.annotation.Configuration;
/**
*
* @author Marko Zivanovic <marko@zivanovic.in.rs>
*/
@Configuration
@EnableAutoConfiguration
@@ -78,7 +78,7 @@ public class SasController {
response = processValidationErrors(br);
} else {
try {
String secret = ShamirSecretSharing.joinToUtf8String(makeSecretShares(params));
String secret = ShamirSecretSharing.joinToUtf8String(decodeSecretShares(params));
response = SasResponse.ok().withData(new JoinResponse(secret));
} catch (RuntimeException ex) {
response = SasResponse.badRequest().withInvalidParameterValueError("shares", params.getShares(),
@@ -102,7 +102,7 @@ public class SasController {
return r;
}
private List<SecretShare> makeSecretShares(JoinParameters params) {
private List<SecretShare> decodeSecretShares(JoinParameters params) {
List<SecretShare> shares = new ArrayList<>(params.getShares().size());
params.getShares().stream().forEach(share -> {
shares.add(Utils.decodeFromBinary(Base64.getDecoder().decode(share)));
+4 -4
View File
@@ -24,17 +24,17 @@
angular.module('sasServices', []).
factory('SasService', ['$resource', function ($resource) {
return $resource("/sas", {}, {
return $resource("https://share-a-secret-api.herokuapp.com/sas", {}, {
split: {
url: "/sas/split",
url: "https://share-a-secret-api.herokuapp.com/sas/split",
method: "POST"
},
join: {
url: "/sas/join",
url: "https://share-a-secret-api.herokuapp.com/sas/join",
method: "POST"
},
version: {
url: "/sas/version",
url: "https://share-a-secret-api.herokuapp.com/sas/version",
method: "GET"
}
});