diff options
Diffstat (limited to 'src/storage.erl')
-rw-r--r-- | src/storage.erl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/storage.erl b/src/storage.erl index efe4768..489bf91 100644 --- a/src/storage.erl +++ b/src/storage.erl @@ -19,7 +19,10 @@ request(post, ?APPURL_PLOP_STORAGE, "sendentry", Input) -> ok = db:add_entry_sync(TreeLeafHash, LogEntry), ok = storagedb:add(TreeLeafHash), - success({[{result, <<"ok">>}]}) + {KeyName, Sig} = http_auth:sign_stored(plop:spt_from_entry(LogEntry)), + success({[{result, <<"ok">>}, + {"sig", KeyName ++ ":" ++ base64:encode_to_string(Sig)} + ]}) end; request(post, ?APPURL_PLOP_STORAGE, "entrycommitted", Input) -> case (catch mochijson2:decode(Input)) of @@ -30,6 +33,12 @@ request(post, ?APPURL_PLOP_STORAGE, "entrycommitted", Input) -> LeafHash = base64:decode(proplists:get_value(<<"treeleafhash">>, PropList)), db:add_entryhash(LeafHash, EntryHash), db:commit_entryhash(), + case proplists:get_value(<<"timestamp_signature">>, PropList) of + undefined -> + none; + TimestampSignature -> + plop:add_spt(LeafHash, base64:decode(TimestampSignature)) + end, success({[{result, <<"ok">>}]}) end; request(get, ?APPURL_PLOP_STORAGE, "fetchnewentries", _Input) -> |