2025-10-01 17:26:50 +02:00
|
|
|
(* https://docs.taler.net/core/api-common.html#tsref-type-ErrorDetail *)
|
2025-10-03 18:14:17 +02:00
|
|
|
module Error_detail = struct
|
2025-10-01 17:26:50 +02:00
|
|
|
(* TODO GANA error codes
|
2025-10-01 19:34:42 +02:00
|
|
|
https://git.gnunet.org/gana.git/tree/gnu-taler-error-codes/registry.rec *)
|
2025-10-03 18:35:21 +02:00
|
|
|
type t = {
|
|
|
|
|
code: int
|
|
|
|
|
; hint: string option
|
|
|
|
|
}
|
2025-10-01 17:26:50 +02:00
|
|
|
end
|
2025-10-01 20:22:32 +02:00
|
|
|
|
2025-10-03 18:35:21 +02:00
|
|
|
(* TODO number
|
|
|
|
|
- number is "float", but we probably want int everywhere instead
|
|
|
|
|
- numeric values capped at 2^53 -1 inclusive because json
|
|
|
|
|
- have a type for seconds/microseconds/..? *)
|
2025-10-01 20:22:32 +02:00
|
|
|
module Timestamp = struct
|
|
|
|
|
(* Seconds since epoch, or the special
|
|
|
|
|
value "never" to represent an event that will
|
|
|
|
|
never happen. *)
|
2025-10-03 18:35:21 +02:00
|
|
|
type t =
|
|
|
|
|
| Seconds of float
|
|
|
|
|
| Never
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
module Relative_time = struct
|
|
|
|
|
(* Duration in microseconds or "forever"
|
|
|
|
|
to represent an infinite duration. Numeric
|
|
|
|
|
values are capped at 2^53 - 1 inclusive. *)
|
|
|
|
|
type t =
|
|
|
|
|
| Microseconds of float
|
|
|
|
|
| Forever
|
2025-10-01 20:22:32 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
module Amount = struct
|
|
|
|
|
(* Amounts of currency are always expressed in terms of a base value, a fractional value and the denomination of the currency.
|
|
|
|
|
Amounts of currency are serialized as a string of the format <Currency>:<DecimalAmount>. Taler treats monetary amounts as fixed-precision numbers, with 8 decimal places. Unlike floating point numbers, this allows accurate representation of monetary amounts.
|
|
|
|
|
|
|
|
|
|
The following constrains apply for a valid amount:
|
|
|
|
|
- <Currency> part must be at most 11 characters long and may only consist of ASCII letters (a-zA-Z).
|
|
|
|
|
- integer part of <DecimalAmount> may be at most 2^52.
|
|
|
|
|
- fractional part of <DecimalAmount> may contain at most 8 decimal digits.
|
|
|
|
|
|
|
|
|
|
An amount that is prefixed with a + or - character is also used in certain contexts. When no sign is present, the amount is assumed to be positive. *)
|
|
|
|
|
type t = {
|
|
|
|
|
currency: [ `Eur ]
|
|
|
|
|
; value: int
|
|
|
|
|
; fraction: int
|
|
|
|
|
; sign: [ `Plus | `Minus | `None ]
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
module Eddsa = struct
|
|
|
|
|
(* EdDSA and ECDHE public keys always point on Curve25519
|
|
|
|
|
and represented using the standard 256 bits Ed25519 compact format,
|
|
|
|
|
converted to Crockford Base32. *)
|
|
|
|
|
type pub = string
|
|
|
|
|
type priv = string
|
|
|
|
|
|
|
|
|
|
(* EdDSA signatures are transmitted as 64-bytes base32
|
|
|
|
|
binary-encoded objects with just the R and S values (base32_ binary-only). *)
|
|
|
|
|
type signature = string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
module Rsa = struct
|
|
|
|
|
(* RSA public key converted to Crockford Base32. *)
|
|
|
|
|
type pub = string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
module Hash_code = struct
|
|
|
|
|
(* 32-byte value representing a point on Curve25519. *)
|
|
|
|
|
type cs25519Point = string
|
|
|
|
|
end
|