Allow applications to enable stamp generation and stamp enforcement

This commit is contained in:
Mark Qvist 2026-11-05 16:08:07 +01:00
parent e9d82e698d
commit eb826cde90
No known key found for this signature in database

View file

@ -214,7 +214,8 @@ class Reticulum:
return Reticulum.__instance
def __init__(self,configdir=None, loglevel=None, logdest=None, verbosity=None,
require_shared_instance=False, shared_instance_type=None):
require_shared_instance=False, shared_instance_type=None,
enable_stamping=False, enforce_stamps=False):
"""
Initialises and starts a Reticulum instance. This must be
done before any other operations, and Reticulum will not
@ -349,6 +350,17 @@ class Reticulum:
RNS.log(f"Utilising cryptography backend \"{RNS.Cryptography.Provider.backend()}\"", RNS.LOG_DEBUG)
RNS.log(f"Configuration loaded from {self.configpath}", RNS.LOG_VERBOSE)
if enable_stamping:
RNS.log(f"Network stamp generation activated", RNS.LOG_VERBOSE)
RNS.Transport.STAMP_DESTINATIONS = True
RNS.Transport.STAMP_PRS = True
RNS.Transport.STAMP_LRS = True
if enforce_stamps:
RNS.log(f"Network stamp enforcement activated", RNS.LOG_VERBOSE)
RNS.Transport.STAMPS_ENFORCED = True
RNS.Transport.LR_STAMPS_ENFORCED = True
RNS.Identity.load_known_destinations()
if not self.is_connected_to_shared_instance: RNS.Identity._clean_ratchets()
RNS.Transport.start(self)