summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2014-05-05 00:54:45 +0200
committerLinus Nordberg <linus@nordberg.se>2014-05-05 00:54:45 +0200
commitbf6fc033b757ae4b572ab6ff7fff332236525791 (patch)
tree9d6c1adcbe6167e92607d59dc8b72f7c3709042d /src
parent2fa51dcc2ef903e4247470f366f4463b05036838 (diff)
Add support for get-sth.
Diffstat (limited to 'src')
-rw-r--r--src/v1.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/v1.erl b/src/v1.erl
index 8948d1d..73f7c28 100644
--- a/src/v1.erl
+++ b/src/v1.erl
@@ -28,7 +28,17 @@ add_pre_chain(SessionID, _Env, _Input) ->
niy(SessionID).
get_sth(SessionID, _Env, _Input) ->
- niy(SessionID).
+ #sth{
+ treesize = Treesize,
+ timestamp = Timestamp,
+ roothash = Roothash,
+ signature = Signature} = plop:sth(),
+ R = [{treesize, Treesize},
+ {timestamp, Timestamp},
+ {sha256_root_hash, base64:encode(Roothash)},
+ {tree_head_signature, base64:encode(Signature)}],
+ mod_esi:deliver(SessionID, binary_to_list(jiffy:encode({R}))).
+
get_sth_consistency(SessionID, _Env, _Input) ->
niy(SessionID).
get_proof_by_hash(SessionID, _Env, _Input) ->