4040MIN_MIN_NR_SHARES = 1 # We allow 1, which really means the secret is not split at all.
4141MAX_MIN_NR_SHARES = 128
4242
43+ # Timeout for shares in seconds. Shares stored on hubs will be deleted if the responder SAE does
44+ # not retrieve them by invoking the Get key with key IDs API call within this timeout.
45+ DEFAULT_SHARE_TIMEOUT_SECS = 60 # 1 minute
46+ MIN_SHARE_TIMEOUT_SECS = 1
47+ MAX_SHARE_TIMEOUT_SECS = 86_400 # 1 day
48+
4349
4450def fatal_error (message : str ):
4551 """
@@ -60,6 +66,7 @@ class Configuration:
6066 stop_request_psrd_threshold : int
6167 get_psrd_block_size : int
6268 min_nr_shares : int
69+ share_timeout_secs : int
6370
6471 def __init__ (
6572 self ,
@@ -68,13 +75,15 @@ def __init__(
6875 stop_request_psrd_threshold ,
6976 get_psrd_block_size ,
7077 min_nr_shares ,
78+ share_timeout_secs ,
7179 nodes ,
7280 ):
7381 self .base_port = base_port
7482 self .start_request_psrd_threshold = start_request_psrd_threshold
7583 self .stop_request_psrd_threshold = stop_request_psrd_threshold
7684 self .get_psrd_block_size = get_psrd_block_size
7785 self .min_nr_shares = min_nr_shares
86+ self .share_timeout_secs = share_timeout_secs
7887 # Sort nodes by type and name, so that clients are always before hubs (the order matters
7988 # for startup and shutdown).
8089 self .nodes = sorted (nodes )
@@ -144,6 +153,12 @@ def _assign_ports_and_urls(self):
144153 "min" : MIN_MIN_NR_SHARES ,
145154 "max" : MAX_MIN_NR_SHARES ,
146155 },
156+ "share_timeout_secs" : {
157+ "type" : "integer" ,
158+ "default" : DEFAULT_SHARE_TIMEOUT_SECS ,
159+ "min" : MIN_SHARE_TIMEOUT_SECS ,
160+ "max" : MAX_SHARE_TIMEOUT_SECS ,
161+ },
147162 "hubs" : {
148163 "type" : "list" ,
149164 "schema" : HUB_SCHEMA ,
@@ -199,5 +214,6 @@ def parse_configuration_file(filename: str) -> Configuration:
199214 parsed_config ["stop_request_psrd_threshold" ],
200215 parsed_config ["get_psrd_block_size" ],
201216 parsed_config ["min_nr_shares" ],
217+ parsed_config ["share_timeout_secs" ],
202218 nodes ,
203219 )
0 commit comments