+ test disable auditor

This commit is contained in:
swrup 2026-02-25 20:12:13 +01:00
parent 05cfa7a5b1
commit f3c6424ec9
8 changed files with 90 additions and 73 deletions

View file

@ -115,43 +115,23 @@ let insert_signkey_revocation =
fun (module Conn : CONN) exchange_pub master_sig ->
Conn.exec req (exchange_pub, master_sig)
let get_auditor_timestamp =
let find_auditor =
let req =
Caqti_type.(eddsa_pub ->? time)
"SELECT last_change FROM auditors WHERE auditor_pub=$1"
Caqti_type.(eddsa_pub ->? auditor)
"SELECT auditor_pub, auditor_name, auditor_url, last_change, is_active \
FROM auditors WHERE auditor_pub=$1"
in
fun (module Conn : CONN) auditor_pub -> Conn.find_opt req auditor_pub
let insert_auditor =
let req =
Caqti_type.(t4 eddsa_pub string string time ->. unit)
"INSERT INTO auditors (auditor_pub, auditor_name, auditor_url, \
is_active, last_change) VALUES ($1, $2, $3, true, $4)"
in
fun (module Conn : CONN)
AuditorSetupMessage.
{ auditor_url; auditor_name; auditor_pub; master_sig= _; validity_start }
-> Conn.exec req (auditor_pub, auditor_name, auditor_url, validity_start)
let update_auditor =
let req =
Caqti_type.(t5 eddsa_pub string string bool time ->. unit)
"UPDATE auditors SET auditor_url=$2, auditor_name=$3, is_active=$4, \
last_change=$5 WHERE auditor_pub=$1"
Caqti_type.(auditor ->. unit)
"INSERT INTO auditors (auditor_pub, auditor_name, auditor_url, \
last_change, is_active) VALUES ($1, $2, $3, $4, $5) ON CONFLICT \
(auditor_pub) DO UPDATE SET auditor_name=$2, auditor_url=$3, \
last_change=$4, is_active=$5"
in
fun (module Conn : CONN)
AuditorSetupMessage.
{ auditor_url; auditor_name; auditor_pub; master_sig= _; validity_start }
-> Conn.exec req (auditor_pub, auditor_url, auditor_name, true, validity_start)
let disable_auditor =
let req =
Caqti_type.(t5 eddsa_pub string string bool time ->. unit)
"UPDATE auditors SET auditor_url=$2, auditor_name=$3, is_active=$4, \
last_change=$5 WHERE auditor_pub=$1"
in
fun (module Conn : CONN) ~auditor_pub ~change_date ->
Conn.exec req (auditor_pub, "", "", false, change_date)
fun (module Conn : CONN) auditor -> Conn.exec req auditor
let insert_auditor_denom_sig =
let req =
@ -167,6 +147,7 @@ let insert_auditor_denom_sig =
Conn.exec req (auditor_pub, h_denom_pub, auditor_sig)
(* todo auditors
map to Auditor.t record
maybe check that url and name are unique/same for each auditor_pub
and do the ht logic out of pg.ml? *)
(* this does not return auditors that are not auditing any denom *)