summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2014-09-15 14:56:03 +0200
committerLinus Nordberg <linus@nordberg.se>2014-09-15 14:56:03 +0200
commit53ffb78d8e89d8428ea3728e0cec31d54f7b1c4c (patch)
tree1fa6e4f8770494419fe258a58d5fc974f122ab5d
parentedba600ece2e0192e70a9cbe4861e9bcf10f3865 (diff)
Encode get-sth-consistency and get-proof-by-hash properly.
-rw-r--r--src/v1.erl10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/v1.erl b/src/v1.erl
index 2ca7726..dca1402 100644
--- a/src/v1.erl
+++ b/src/v1.erl
@@ -61,8 +61,9 @@
false ->
binary_to_list(
jiffy:encode(
- [base64:encode(X) ||
- X <- plop:consistency(First, Second)]))
+ {[{consistency,
+ [base64:encode(X) ||
+ X <- plop:consistency(First, Second)]}]}))
end;
_ -> html("get-sth-consistency: bad input:", Input)
end,
@@ -81,10 +82,11 @@
html("get-proof-by-hash: bad input:",
[HashInput, TreeSizeInput]);
false ->
+ {Index, Path} = plop:inclusion(Hash, TreeSize),
binary_to_list(
jiffy:encode(
- [base64:encode(X) ||
- X <- plop:inclusion(Hash, TreeSize)]))
+ {[{leaf_index, Index},
+ {audit_path, [base64:encode(X) || X <- Path]}]}))
end;
_ -> html("get-sth-proof-by-hash: bad input:", Input)
end,