This commit is contained in:
swrup 2026-03-03 10:31:57 +01:00
parent 650264f21e
commit e16b939b91
9 changed files with 12 additions and 26 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