summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plop.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plop.erl b/src/plop.erl
index f99d45d..bbfb687 100644
--- a/src/plop.erl
+++ b/src/plop.erl
@@ -26,7 +26,7 @@
%% API.
-export([start_link/2, stop/0]).
-export([get_logid/0, serialise/1]).
--export([add/1, sth/0, get/2, consistency/2]).
+-export([add/1, sth/0, get/2, consistency/2, inclusion/2]).
%% API for tests.
-export([read_keyfile_rsa/2, read_keyfiles_ec/2]).
-export([testing_get_pubkey/0]).
@@ -112,6 +112,8 @@ get(Start, End) ->
gen_server:call(?MODULE, {get, {Start, End}}).
consistency(TreeSizeFirst, TreeSizeSecond) ->
gen_server:call(?MODULE, {consistency, {TreeSizeFirst, TreeSizeSecond}}).
+inclusion(Hash, TreeSize) ->
+ gen_server:call(?MODULE, {inclusion, {Hash, TreeSize}}).
get_logid() ->
gen_server:call(?MODULE, {get, logid}).
testing_get_pubkey() ->
@@ -148,6 +150,14 @@ handle_call({get, logid}, _From,
handle_call({consistency, {First, Second}}, _From, Plop) ->
{reply, ht:consistency(First - 1, Second - 1), Plop};
+handle_call({inclusion, {Hash, TreeSize}}, _From, Plop) ->
+ Proof = case db:find(Hash) of
+ [] -> [];
+ {plop, Index, _Hash, _MTL, _SPT} ->
+ ht:path(Index, TreeSize - 1)
+ end,
+ {reply, Proof, Plop};
+
handle_call({test, pubkey}, _From,
Plop = #state{pubkey = PK}) ->
{reply, PK, Plop}.