This commit is contained in:
swrup 2026-03-03 10:31:57 +01:00
parent 650264f21e
commit f7c9f4163c
12 changed files with 17 additions and 31 deletions

View file

@ -1,8 +1,4 @@
(* TODO (* TODO implement operations on amounts *)
have a currency agnostic amount_lib.ml
and specialize amount.ml to Config.currency??
have safe amount arithmetic *)
open Syntax open Syntax
type sign = type sign =

View file

@ -85,9 +85,6 @@ module Bytes64 = struct
~decode:of_octets Caqti_type.octets ~decode:of_octets Caqti_type.octets
end end
(* TODO error response
- use GANA error codes
https://git.gnunet.org/gana.git/tree/gnu-taler-error-codes/registry.rec *)
module ErrorDetail = struct module ErrorDetail = struct
type t = { type t = {
code: int; code: int;

View file

@ -6,7 +6,8 @@ let accept_header_value =
let avail_languages_header_value = let avail_languages_header_value =
Fmt.str "%a" (Fmt.array ~sep:(Fmt.any ", ") Fmt.string) Assets.Language.arr Fmt.str "%a" (Fmt.array ~sep:(Fmt.any ", ") Fmt.string) Assets.Language.arr
(* TODO Cohttp raises on invalid *) (* TODO better headers_lib
Cohttp raises on invalid *)
let select_mimetype headers = let select_mimetype headers =
let opt = Vif.Headers.get headers "accept" in let opt = Vif.Headers.get headers "accept" in
Cohttp.Accept.media_ranges opt Cohttp.Accept.media_ranges opt

View file

@ -1,7 +1,6 @@
open Syntax open Syntax
open Crypto open Crypto
(* TODO better error type *)
type 'a result = ('a, string) Result.t type 'a result = ('a, string) Result.t
module type S = sig module type S = sig
@ -33,8 +32,8 @@ module Make (Conn : Pg.CONN) : S = struct
let conn = (module Conn : Pg.CONN) let conn = (module Conn : Pg.CONN)
(* TODO (* TODO better error
error "key not found", either: can only be "key not found", either:
- we tried to sign with a key that is not ours - we tried to sign with a key that is not ours
- key was revoked - key was revoked
- bad keyring state *) - bad keyring state *)

View file

@ -1,11 +1,6 @@
(* TODO (* TODO
can we avoid amount tuple boilerplate?
clean up caqti error type
transaction transaction
GNU Taler use of db-events? it seems caqti/pgx does not support it *)
GNU Taler use of db-events?
it seems caqti/pgx does not support it *)
module type CONN = Caqti_miou.CONNECTION module type CONN = Caqti_miou.CONNECTION

View file

@ -1,6 +1,3 @@
(* TODO response
use ErrorDetail *)
let encode_error_detail err = let encode_error_detail err =
match Api.(encode ErrorDetail.jsont err) with match Api.(encode ErrorDetail.jsont err) with
| Error e -> Fmt.failwith "json encoding error on `ErrorDetail`: %s." e | Error e -> Fmt.failwith "json encoding error on `ErrorDetail`: %s." e

View file

@ -103,7 +103,7 @@ let split_in_periodes ~start ~end_ =
in in
go acc start end_ go acc start end_
(* TODO do not exceed lookahead (probably more important...) *) (* TODO do not exceed lookahead *)
(* try to not generate keys with validity start in the past *) (* try to not generate keys with validity start in the past *)
let gen_additional_keys_until_lookahead ~now l = let gen_additional_keys_until_lookahead ~now l =
let start = let start =
@ -118,7 +118,6 @@ let gen_additional_keys_until_lookahead ~now l =
let new_keys = List.map (fun (t1, t2) -> gen_key t1 t2) periodes in let new_keys = List.map (fun (t1, t2) -> gen_key t1 t2) periodes in
new_keys new_keys
(* TODO config *)
let sm_key_fpath = let sm_key_fpath =
Result.get_ok Result.get_ok
@@ @@
@ -221,5 +220,5 @@ end
- more checks - more checks
- sign: check timestamps before signing - sign: check timestamps before signing
- schedule tasks - schedule tasks
- !lock - ! use lock
*) *)

View file

@ -1,7 +1,10 @@
let ( let* ) o f = match o with Ok v -> f v | Error _ as e -> e let ( let* ) o f = match o with Ok v -> f v | Error _ as e -> e
let ( let+ ) o f = match o with Ok v -> Ok (f v) | Error _ as e -> e let ( let+ ) o f = match o with Ok v -> Ok (f v) | Error _ as e -> e
(* TODO use polymorphic variant for errors *) (* TODO better errors
use polymorphic variant for errors
use GANA error codes:
https://git.gnunet.org/gana.git/tree/gnu-taler-error-codes/registry.rec *)
let unwrap_err_msg o = match o with Error (`Msg e) -> Error e | Ok v -> Ok v let unwrap_err_msg o = match o with Error (`Msg e) -> Error e | Ok v -> Ok v
let unwrap_err_caqti o = let unwrap_err_caqti o =

View file

@ -50,7 +50,6 @@ module Timestamp : sig
val of_absolute : TimeAbsolute.t -> t val of_absolute : TimeAbsolute.t -> t
val of_ptime : Ptime.t -> t val of_ptime : Ptime.t -> t
(* TODO add pp *)
(* - *) (* - *)
val bin : t Bin.t val bin : t Bin.t
val caqti : t Caqti_type.t val caqti : t Caqti_type.t

View file

@ -10,6 +10,8 @@ auditor_pub="A17JXR3E6J4CXDPYT7S1H25PGJ3ABS26TQ38654QCX0TB59RPMF0"
master_key="./default/master_offline_private_key" master_key="./default/master_offline_private_key"
zero_kudos="KUDOS:0.0" zero_kudos="KUDOS:0.0"
# TODO launch mte.exe and kill it a then end with its PID
offline_tool() { offline_tool() {
dune exec offline -- "$@" > /dev/null dune exec offline -- "$@" > /dev/null
} }

View file

@ -34,8 +34,6 @@ let () =
check Timestamp.jsont {|{"t_s": "never"}|}; check Timestamp.jsont {|{"t_s": "never"}|};
check_bad Timestamp.jsont {|{"t_s": "123456780"}|}; check_bad Timestamp.jsont {|{"t_s": "123456780"}|};
check_bad Timestamp.jsont {|{"t_s": "agagou"}|}; check_bad Timestamp.jsont {|{"t_s": "agagou"}|};
(* TODO CS not implemented *)
check_bad DenominationKey.jsont check_bad DenominationKey.jsont
{|{"cipher": "CS", "age_mask": 18, "cs_pub": "ouhagag"}|}; {|{"cipher": "CS", "age_mask": 18, "cs_pub": "ouhagag"}|};
() ()

View file

@ -12,8 +12,8 @@ let keys content =
else Fmt.error "version incompatible" else Fmt.error "version incompatible"
in in
(* TODO validate ExchangeWireAccount (* TODO json hash
need hash over json *) validate wire *)
let* () = let* () =
let open AggregateTransferFee in let open AggregateTransferFee in
v.wire_fees v.wire_fees
@ -52,7 +52,7 @@ let keys content =
match opt with match opt with
| None -> Fmt.error "exchange_pub is not in signkeys list" | None -> Fmt.error "exchange_pub is not in signkeys list"
| Some _sk -> | Some _sk ->
(* TODO add a --now option? (* todo add a --now option if we want to validate timestamps
let now = Timestamp.of_ptime (Ptime_clock.now ()) in let now = Timestamp.of_ptime (Ptime_clock.now ()) in
if Signkey.is_valid_at ~timestamp:now sk then Ok () if Signkey.is_valid_at ~timestamp:now sk then Ok ()
else Fmt.error "exchange_pub is not valid at the current time" else Fmt.error "exchange_pub is not valid at the current time"