From 1ad53bea32744fe0ee3ca349c9b5c712c980f398 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sun, 4 May 2014 23:57:18 +0200 Subject: Follow s/spt_on_wire/spt/g in plop. Also, add NIY placeholders for all URLs. --- src/v1.erl | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/v1.erl b/src/v1.erl index 99cf55b..8948d1d 100644 --- a/src/v1.erl +++ b/src/v1.erl @@ -1,5 +1,7 @@ -module(v1). --export([add_chain/3]). +-export([add_chain/3, add_pre_chain/3, get_sth/3, + get_sth_consistency/3, get_proof_by_hash/3, get_entries/3, + get_roots/3, get_entry_and_proof/3]). -export([hello/3]). -include("/home/linus/usr/src/ct/plop/include/plop.hrl"). -define(PROTOCOL_VERSION, 1). @@ -12,17 +14,32 @@ add_chain(SessionID, _Env, Input) -> Entry = #plop_entry{type = x509, data = list_to_binary(Chain)}, SPT = plop:add(#timestamped_entry{entry = Entry}), - Timestamp = SPT#spt_on_wire.timestamp, R = [{sct_version, ?PROTOCOL_VERSION}, - {id, base64:encode(plop:get_logid())}, - {timestamp, Timestamp}, + {id, base64:encode(SPT#spt.logid)}, + {timestamp, SPT#spt.timestamp}, {extensions, []}, - {signature, base64:encode(list_to_binary(plop:serialise(SPT)))}], + {signature, base64:encode(SPT#spt.signature)}], binary_to_list(jiffy:encode({R})); _ -> html("add-chain: missing input: chain; see RFC 6962", Input) end, mod_esi:deliver(SessionID, Res). +add_pre_chain(SessionID, _Env, _Input) -> + niy(SessionID). + +get_sth(SessionID, _Env, _Input) -> + niy(SessionID). +get_sth_consistency(SessionID, _Env, _Input) -> + niy(SessionID). +get_proof_by_hash(SessionID, _Env, _Input) -> + niy(SessionID). +get_entries(SessionID, _Env, _Input) -> + niy(SessionID). +get_roots(SessionID, _Env, _Input) -> + niy(SessionID). +get_entry_and_proof(SessionID, _Env, _Input) -> + niy(SessionID). + %% For testing. FIXME: Remove. hello(SessionID, Env, Input) -> Query = httpd:parse_query(Input), @@ -43,3 +60,6 @@ html(Text, Input) -> "~s~n" ++ "~p~n" ++ "~n", [Text, Input]). + +niy(S) -> + mod_esi:deliver(S, html("NIY - Not Yet Implemented|", [])). -- cgit v1.1