<spanid="api-main"></span><h1>API Reference<aclass="headerlink"href="#api-reference"title="Permalink to this headline">¶</a></h1>
<p>This reference guide lists and explains all classes exposed by the RNS API.</p>
<divclass="section"id="classes">
<h2>Classes<aclass="headerlink"href="#classes"title="Permalink to this headline">¶</a></h2>
<p>Communication over a Reticulum network is achieved using a set of classes exposed by RNS.</p>
<divclass="section"id="reticulum">
<spanid="api-reticulum"></span><h3>Reticulum<aclass="headerlink"href="#reticulum"title="Permalink to this headline">¶</a></h3>
<dlclass="py class">
<dtclass="sig sig-object py"id="RNS.Reticulum">
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Reticulum</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">configdir</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Reticulum"title="Permalink to this definition">¶</a></dt>
<dd><p>This class is used to initialise access to Reticulum within a
program. You must create exactly one instance of this class before
carrying out any other RNS operations, such as creating destinations
or sending traffic. Every independently executed program must create
their own instance of the Reticulum class, but Reticulum will
automatically handle inter-program communication on the same system,
and expose all connected programs to external interfaces as well.</p>
<p>As soon as an instance of this class is created, Reticulum will start
opening and configuring any hardware devices specified in the supplied
configuration.</p>
<p>Currently the first running instance must be kept running while other
local instances are connected, as the first created instance will
act as a master instance that directly communicates with external
hardware such as modems, TNCs and radios. If a master instance is
asked to exit, it will not exit until all client processes have
terminated (unless killed forcibly).</p>
<p>If you are running Reticulum on a system with several different
programs that use RNS starting and terminating at different times,
it will be advantageous to run a master RNS instance as a daemon for
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">should_allow_unencrypted</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Reticulum.should_allow_unencrypted"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns whether unencrypted links are allowed by the
current configuration.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>True if the current running configuration allows downgrading links to plaintext. False if not.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">should_use_implicit_proof</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Reticulum.should_use_implicit_proof"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns whether proofs sent are explicit or implicit.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>True if the current running configuration specifies to use implicit proofs. False if not.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">transport_enabled</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Reticulum.transport_enabled"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns whether Transport is enabled for the running
instance.</p>
<p>When Transport is enabled, Reticulum will
route traffic for other peers, respond to path requests
and pass announces over the network.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>True if Transport is enabled, False if not.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</div>
<divclass="section"id="api-identity">
<spanid="identity"></span><h3>Identity<aclass="headerlink"href="#api-identity"title="Permalink to this headline">¶</a></h3>
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Identity</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">create_keys</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">CURVE</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">'Curve25519'</span></em><aclass="headerlink"href="#RNS.Identity.CURVE"title="Permalink to this definition">¶</a></dt>
<dd><p>The curve used for Elliptic Curve DH key exchanges</p>
<spanclass="sig-name descname"><spanclass="pre">KEYSIZE</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">512</span></em><aclass="headerlink"href="#RNS.Identity.KEYSIZE"title="Permalink to this definition">¶</a></dt>
<dd><p>X25519 key size in bits. A complete key is the concatenation of a 256 bit encryption key, and a 256 bit signing key.</p>
<spanclass="sig-name descname"><spanclass="pre">TRUNCATED_HASHLENGTH</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">80</span></em><aclass="headerlink"href="#RNS.Identity.TRUNCATED_HASHLENGTH"title="Permalink to this definition">¶</a></dt>
<dd><p>Constant specifying the truncated hash length (in bits) used by Reticulum
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">recall</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination_hash</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.recall"title="Permalink to this definition">¶</a></dt>
<dd><p>Recall identity for a destination hash.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>destination_hash</strong>– Destination hash as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>An <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> instance that can be used to create an outgoing <aclass="reference internal"href="#api-destination"><spanclass="std std-ref">RNS.Destination</span></a>, or <em>None</em> if the destination is unknown.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">recall_app_data</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination_hash</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.recall_app_data"title="Permalink to this definition">¶</a></dt>
<dd><p>Recall last heard app_data for a destination hash.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>destination_hash</strong>– Destination hash as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>Bytes</em> containing app_data, or <em>None</em> if the destination is unknown.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">full_hash</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.full_hash"title="Permalink to this definition">¶</a></dt>
<dd><p>Get a SHA-256 hash of passed data.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>data</strong>– Data to be hashed as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>SHA-256 hash as <em>bytes</em></p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">truncated_hash</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.truncated_hash"title="Permalink to this definition">¶</a></dt>
<dd><p>Get a truncated SHA-256 hash of passed data.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>data</strong>– Data to be hashed as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>Truncated SHA-256 hash as <em>bytes</em></p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">get_random_hash</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.get_random_hash"title="Permalink to this definition">¶</a></dt>
<dd><p>Get a random SHA-256 hash.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>data</strong>– Data to be hashed as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>Truncated SHA-256 hash of random data as <em>bytes</em></p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">from_file</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">path</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.from_file"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> instance from a file.
Can be used to load previously created and saved identities into Reticulum.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>path</strong>– The full path to the saved <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> data</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>A <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> instance, or <em>None</em> if the loaded data was invalid.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">from_bytes</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">prv_bytes</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.from_bytes"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> instance from <em>bytes</em> of private key.
Can be used to load previously created and saved identities into Reticulum.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>prv_bytes</strong>– The <em>bytes</em> of private a saved private key. <strong>HAZARD!</strong> Never not use this to generate a new key by feeding random data in prv_bytes.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>A <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> instance, or <em>None</em> if the <em>bytes</em> data was invalid.</p>
<spanclass="sig-name descname"><spanclass="pre">get_private_key</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.get_private_key"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The private key as <em>bytes</em></p>
<spanclass="sig-name descname"><spanclass="pre">get_public_key</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.get_public_key"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The public key as <em>bytes</em></p>
<spanclass="sig-name descname"><spanclass="pre">load_private_key</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">prv_bytes</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.load_private_key"title="Permalink to this definition">¶</a></dt>
<dd><p>Load a private key into the instance.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>prv_bytes</strong>– The private key as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>True if the key was loaded, otherwise False.</p>
<spanclass="sig-name descname"><spanclass="pre">load_public_key</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">pub_bytes</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.load_public_key"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">to_file</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">path</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.to_file"title="Permalink to this definition">¶</a></dt>
<dd><p>Saves the identity to a file. This will write the private key to disk,
and anyone with access to this file will be able to decrypt all
communication for the identity. Be very careful with this method.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>path</strong>– The full path specifying where to save the identity.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>True if the file was saved, otherwise False.</p>
<spanclass="sig-name descname"><spanclass="pre">encrypt</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">plaintext</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.encrypt"title="Permalink to this definition">¶</a></dt>
<dd><p>Encrypts information for the identity.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>plaintext</strong>– The plaintext to be encrypted as <em>bytes</em>.</p>
<spanclass="sig-name descname"><spanclass="pre">decrypt</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">ciphertext_token</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.decrypt"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">sign</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">message</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.sign"title="Permalink to this definition">¶</a></dt>
<dd><p>Signs information by the identity.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>message</strong>– The message to be signed as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>Signature as <em>bytes</em>.</p>
<spanclass="sig-name descname"><spanclass="pre">validate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">signature</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">message</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.validate"title="Permalink to this definition">¶</a></dt>
<dd><p>Validates the signature of a signed message.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>signature</strong>– The signature to be validated as <em>bytes</em>.</p></li>
<li><p><strong>message</strong>– The message to be validated as <em>bytes</em>.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>True if the signature is valid, otherwise False.</p>
<spanid="api-destination"></span><h3>Destination<aclass="headerlink"href="#destination"title="Permalink to this headline">¶</a></h3>
<dlclass="py class">
<dtclass="sig sig-object py"id="RNS.Destination">
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Destination</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">identity</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">direction</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">type</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">app_name</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">*</span></span><spanclass="n"><spanclass="pre">aspects</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination"title="Permalink to this definition">¶</a></dt>
<dd><p>A class used to describe endpoints in a Reticulum Network. Destination
instances are used both to create outgoing and incoming endpoints. The
destination type will decide if encryption, and what type, is used in
communication with the endpoint. A destination can also announce its
presence on the network, which will also distribute necessary keys for
encrypted communication with it.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>identity</strong>– An instance of <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a>. Can hold only public keys for an outgoing destination, or holding private keys for an ingoing.</p></li>
<li><p><strong>direction</strong>–<codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.IN</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.OUT</span></code></p></li>
<li><p><strong>type</strong>–<codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.SINGLE</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.PLAIN</span></code>.</p></li>
<li><p><strong>app_name</strong>– A string specifying the app name.</p></li>
<li><p><strong>*aspects</strong>– Any non-zero number of string arguments.</p></li>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">full_name</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">app_name</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">*</span></span><spanclass="n"><spanclass="pre">aspects</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.full_name"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A string containing the full human-readable name of the destination, for an app_name and a number of aspects.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">app_and_aspects_from_name</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">full_name</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.app_and_aspects_from_name"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A tuple containing the app name and a list of aspects, for a full-name string.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">hash_from_name_and_identity</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">full_name</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">identity</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.hash_from_name_and_identity"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A destination name in adressable hash form, for a full name string and Identity instance.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">hash</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">app_name</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">*</span></span><spanclass="n"><spanclass="pre">aspects</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.hash"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A destination name in adressable hash form, for an app_name and a number of aspects.</p>
<spanclass="sig-name descname"><spanclass="pre">announce</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">app_data</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">path_response</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">False</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.announce"title="Permalink to this definition">¶</a></dt>
<li><p><strong>app_data</strong>–<em>bytes</em> containing the app_data.</p></li>
<li><p><strong>path_response</strong>– Internal flag used by <aclass="reference internal"href="#api-transport"><spanclass="std std-ref">RNS.Transport</span></a>. Ignore.</p></li>
<spanclass="sig-name descname"><spanclass="pre">set_link_established_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.set_link_established_callback"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_packet_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.set_packet_callback"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_proof_requested_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.set_proof_requested_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Registers a function to be called when a proof has been requested for
a packet sent to this destination. Allows control over when and if
proofs should be returned for received packets.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>callback</strong>– A function or method to be called. The callback must return one of True or False. If the callback returns True, a proof will be sent. If it returns False, a proof will not be sent.</p>
<spanclass="sig-name descname"><spanclass="pre">set_proof_strategy</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">proof_strategy</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.set_proof_strategy"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the destinations proof strategy.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>proof_strategy</strong>– One of <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.PROVE_NONE</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.PROVE_ALL</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.PROVE_APP</span></code>. If <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.PROVE_APP</span></code> is set, the <cite>proof_requested_callback</cite> will be called to determine whether a proof should be sent or not.</p>
<spanclass="sig-name descname"><spanclass="pre">create_keys</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.create_keys"title="Permalink to this definition">¶</a></dt>
<dd><p>For a <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> type destination, creates a new symmetric key.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Raises</dt>
<ddclass="field-odd"><p><codeclass="docutils literal notranslate"><spanclass="pre">TypeError</span></code> if called on an incompatible type of destination.</p>
<spanclass="sig-name descname"><spanclass="pre">get_private_key</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.get_private_key"title="Permalink to this definition">¶</a></dt>
<dd><p>For a <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> type destination, returns the symmetric private key.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Raises</dt>
<ddclass="field-odd"><p><codeclass="docutils literal notranslate"><spanclass="pre">TypeError</span></code> if called on an incompatible type of destination.</p>
<spanclass="sig-name descname"><spanclass="pre">load_private_key</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">key</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.load_private_key"title="Permalink to this definition">¶</a></dt>
<dd><p>For a <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> type destination, loads a symmetric private key.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>key</strong>– A <em>bytes-like</em> containing the symmetric key.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><codeclass="docutils literal notranslate"><spanclass="pre">TypeError</span></code> if called on an incompatible type of destination.</p>
<spanclass="sig-name descname"><spanclass="pre">encrypt</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">plaintext</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.encrypt"title="Permalink to this definition">¶</a></dt>
<dd><p>Encrypts information for <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.SINGLE</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> type destination.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>plaintext</strong>– A <em>bytes-like</em> containing the plaintext to be encrypted.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><codeclass="docutils literal notranslate"><spanclass="pre">ValueError</span></code> if destination does not hold a necessary key for encryption.</p>
<spanclass="sig-name descname"><spanclass="pre">decrypt</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">ciphertext</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.decrypt"title="Permalink to this definition">¶</a></dt>
<dd><p>Decrypts information for <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.SINGLE</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> type destination.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>ciphertext</strong>–<em>Bytes</em> containing the ciphertext to be decrypted.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><codeclass="docutils literal notranslate"><spanclass="pre">ValueError</span></code> if destination does not hold a necessary key for decryption.</p>
<spanclass="sig-name descname"><spanclass="pre">sign</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">message</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.sign"title="Permalink to this definition">¶</a></dt>
<dd><p>Signs information for <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.SINGLE</span></code> type destination.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>message</strong>–<em>Bytes</em> containing the message to be signed.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>A <em>bytes-like</em> containing the message signature, or <em>None</em> if the destination could not sign the message.</p>
<spanclass="sig-name descname"><spanclass="pre">set_default_app_data</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">app_data</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.set_default_app_data"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the default app_data for the destination. If set, the default
app_data will be included in every announce sent by the destination,
unless other app_data is specified in the <em>announce</em> method.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>app_data</strong>– A <em>bytes-like</em> containing the default app_data, or a <em>callable</em> returning a <em>bytes-like</em> containing the app_data.</p>
<spanclass="sig-name descname"><spanclass="pre">clear_default_app_data</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.clear_default_app_data"title="Permalink to this definition">¶</a></dt>
<dd><p>Clears default app_data previously set for the destination.</p>
</dd></dl>
</dd></dl>
</div>
<divclass="section"id="packet">
<spanid="api-packet"></span><h3>Packet<aclass="headerlink"href="#packet"title="Permalink to this headline">¶</a></h3>
<dlclass="py class">
<dtclass="sig sig-object py"id="RNS.Packet">
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Packet</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">packet_type</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">context</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">transport_type</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">header_type</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">transport_id</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">attached_interface</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">create_receipt</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Packet"title="Permalink to this definition">¶</a></dt>
<dd><p>The Packet class is used to create packet instances that can be sent
over a Reticulum network. Packets to will automatically be encrypted if
they are adressed to a <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.SINGLE</span></code> destination,
<codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> destination or a <aclass="reference internal"href="#api-link"><spanclass="std std-ref">RNS.Link</span></a>.</p>
<p>For <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> destinations, Reticulum will use the
pre-shared key configured for the destination.</p>
<p>For <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.SINGLE</span></code> destinations and <aclass="reference internal"href="#api-link"><spanclass="std std-ref">RNS.Link</span></a>
destinations, reticulum will use ephemeral keys, and offers <strong>Forward Secrecy</strong>.</p>
<li><p><strong>destination</strong>– A <aclass="reference internal"href="#api-destination"><spanclass="std std-ref">RNS.Destination</span></a> instance to which the packet will be sent.</p></li>
<li><p><strong>data</strong>– The data payload to be included in the packet as <em>bytes</em>.</p></li>
<li><p><strong>create_receipt</strong>– Specifies whether a <aclass="reference internal"href="#api-packetreceipt"><spanclass="std std-ref">RNS.PacketReceipt</span></a> should be created when instantiating the packet.</p></li>
<li><p><strong>type</strong>– Internal use by <aclass="reference internal"href="#api-transport"><spanclass="std std-ref">RNS.Transport</span></a>. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Packet.DATA</span></code>, and should not be specified.</p></li>
<li><p><strong>context</strong>– Internal use by <aclass="reference internal"href="#api-transport"><spanclass="std std-ref">RNS.Transport</span></a>. Ignore.</p></li>
<li><p><strong>transport_type</strong>– Internal use by <aclass="reference internal"href="#api-transport"><spanclass="std std-ref">RNS.Transport</span></a>. Ignore.</p></li>
<li><p><strong>transport_id</strong>– Internal use by <aclass="reference internal"href="#api-transport"><spanclass="std std-ref">RNS.Transport</span></a>. Ignore.</p></li>
<li><p><strong>attached_interface</strong>– Internal use by <aclass="reference internal"href="#api-transport"><spanclass="std std-ref">RNS.Transport</span></a>. Ignore.</p></li>
<spanclass="sig-name descname"><spanclass="pre">ENCRYPTED_MDU</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">383</span></em><aclass="headerlink"href="#RNS.Packet.ENCRYPTED_MDU"title="Permalink to this definition">¶</a></dt>
<dd><p>The maximum size of the payload data in a single encrypted packet</p>
<spanclass="sig-name descname"><spanclass="pre">PLAIN_MDU</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">477</span></em><aclass="headerlink"href="#RNS.Packet.PLAIN_MDU"title="Permalink to this definition">¶</a></dt>
<dd><p>The maximum size of the payload data in a single unencrypted packet</p>
<spanclass="sig-name descname"><spanclass="pre">send</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Packet.send"title="Permalink to this definition">¶</a></dt>
<dd><p>Sends the packet.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A <aclass="reference internal"href="#api-packetreceipt"><spanclass="std std-ref">RNS.PacketReceipt</span></a> instance if <em>create_receipt</em> was set to <em>True</em> when the packet was instantiated, if not returns <em>None</em>. If the packet could not be sent <em>False</em> is returned.</p>
<spanclass="sig-name descname"><spanclass="pre">resend</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Packet.resend"title="Permalink to this definition">¶</a></dt>
<dd><p>Re-sends the packet.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A <aclass="reference internal"href="#api-packetreceipt"><spanclass="std std-ref">RNS.PacketReceipt</span></a> instance if <em>create_receipt</em> was set to <em>True</em> when the packet was instantiated, if not returns <em>None</em>. If the packet could not be sent <em>False</em> is returned.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</div>
<divclass="section"id="packet-receipt">
<spanid="api-packetreceipt"></span><h3>Packet Receipt<aclass="headerlink"href="#packet-receipt"title="Permalink to this headline">¶</a></h3>
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">PacketReceipt</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">packet</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.PacketReceipt"title="Permalink to this definition">¶</a></dt>
<dd><p>The PacketReceipt class is used to receive notifications about
<aclass="reference internal"href="#api-packet"><spanclass="std std-ref">RNS.Packet</span></a> instances sent over the network. Instances
of this class should never be created manually, but always returned
from a the <em>send()</em> method of a <aclass="reference internal"href="#api-packet"><spanclass="std std-ref">RNS.Packet</span></a> instance.</p>
<spanclass="sig-name descname"><spanclass="pre">get_status</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.PacketReceipt.get_status"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The status of the associated <aclass="reference internal"href="#api-packet"><spanclass="std std-ref">RNS.Packet</span></a> instance. Can be one of <codeclass="docutils literal notranslate"><spanclass="pre">RNS.PacketReceipt.SENT</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.PacketReceipt.DELIVERED</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.PacketReceipt.FAILED</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.PacketReceipt.CULLED</span></code>.</p>
<spanclass="sig-name descname"><spanclass="pre">get_rtt</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.PacketReceipt.get_rtt"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_timeout</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">timeout</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.PacketReceipt.set_timeout"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets a timeout in seconds</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>timeout</strong>– The timeout in seconds.</p>
<spanclass="sig-name descname"><spanclass="pre">set_delivery_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.PacketReceipt.set_delivery_callback"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_timeout_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.PacketReceipt.set_timeout_callback"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Link</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">owner</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">peer_pub_bytes</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">peer_sig_pub_bytes</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link"title="Permalink to this definition">¶</a></dt>
<li><p><strong>destination</strong>– A <aclass="reference internal"href="#api-destination"><spanclass="std std-ref">RNS.Destination</span></a> instance which to establish a link to.</p></li>
<li><p><strong>owner</strong>– Internal use by <aclass="reference internal"href="#api-transport"><spanclass="std std-ref">RNS.Transport</span></a>, ignore this argument.</p></li>
<spanclass="sig-name descname"><spanclass="pre">CURVE</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">'Curve25519'</span></em><aclass="headerlink"href="#RNS.Link.CURVE"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">DEFAULT_TIMEOUT</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">15.0</span></em><aclass="headerlink"href="#RNS.Link.DEFAULT_TIMEOUT"title="Permalink to this definition">¶</a></dt>
<dd><p>Default timeout for link establishment in seconds.</p>
<spanclass="sig-name descname"><spanclass="pre">KEEPALIVE</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">360</span></em><aclass="headerlink"href="#RNS.Link.KEEPALIVE"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">identify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">identity</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.identify"title="Permalink to this definition">¶</a></dt>
<dd><p>Identifies the initiator of the link to the remote peer. This can only happen
once the link has been established, and is carried out over the encrypted link.
The identity is only revealed to the remote peer, and initiator anonymity is
thus preserved. This method can be used for authentication.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>identity</strong>– An RNS.Identity instance to identify as.</p>
<spanclass="sig-name descname"><spanclass="pre">no_inbound_for</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.no_inbound_for"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The time in seconds since last inbound packet on the link.</p>
<spanclass="sig-name descname"><spanclass="pre">no_outbound_for</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.no_outbound_for"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The time in seconds since last outbound packet on the link.</p>
<spanclass="sig-name descname"><spanclass="pre">inactive_for</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.inactive_for"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The time in seconds since activity on the link.</p>
<spanclass="sig-name descname"><spanclass="pre">get_remote_identity</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.get_remote_identity"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The identity of the remote peer, if it is known</p>
<spanclass="sig-name descname"><spanclass="pre">teardown</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.teardown"title="Permalink to this definition">¶</a></dt>
<dd><p>Closes the link and purges encryption keys. New keys will
be used if a new link to the same destination is established.</p>
<spanclass="sig-name descname"><spanclass="pre">set_packet_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_packet_callback"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_resource_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_resource_callback"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_resource_started_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_resource_started_callback"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_resource_concluded_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_resource_concluded_callback"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_remote_identified_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_remote_identified_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Registers a function to be called when an initiating peer has
identified over this link.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>callback</strong>– A function or method with the signature <em>callback(identity)</em> to be called.</p>
<spanclass="sig-name descname"><spanclass="pre">set_resource_strategy</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">resource_strategy</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_resource_strategy"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the resource strategy for the link.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>resource_strategy</strong>– One of <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Link.ACCEPT_NONE</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Link.ACCEPT_ALL</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Link.ACCEPT_APP</span></code>. If <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Link.ACCEPT_APP</span></code> is set, the <cite>resource_callback</cite> will be called to determine whether the resource should be accepted or not.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><em>TypeError</em> if the resource strategy is unsupported.</p>
<spanclass="sig-name descname"><spanclass="pre">disable_encryption</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.disable_encryption"title="Permalink to this definition">¶</a></dt>
<dd><p>HAZARDOUS. This will downgrade the link to encryptionless. All
information over the link will be sent in plaintext. Never use
this in production applications. Should only be used for debugging
purposes, and will disappear in a future version.</p>
<p>If encryptionless links are not explicitly allowed in the users
configuration file, Reticulum will terminate itself along with the
client application and throw an error message to the user.</p>
</dd></dl>
</dd></dl>
</div>
<divclass="section"id="resource">
<spanid="api-resource"></span><h3>Resource<aclass="headerlink"href="#resource"title="Permalink to this headline">¶</a></h3>
<li><p><strong>data</strong>– The data to be transferred. Can be <em>bytes</em> or an open <em>file handle</em>. See the <spanclass="xref std std-ref">Filetransfer Example</span> for details.</p></li>
<li><p><strong>link</strong>– The <aclass="reference internal"href="#api-link"><spanclass="std std-ref">RNS.Link</span></a> instance on which to transfer the data.</p></li>
<li><p><strong>advertise</strong>– Whether to automatically advertise the resource. Can be <em>True</em> or <em>False</em>.</p></li>
<li><p><strong>auto_compress</strong>– Whether to auto-compress the resource. Can be <em>True</em> or <em>False</em>.</p></li>
<li><p><strong>callback</strong>– A <em>callable</em> with the signature <em>callback(resource)</em>. Will be called when the resource transfer concludes.</p></li>
<li><p><strong>progress_callback</strong>– A <em>callable</em> with the signature <em>callback(resource)</em>. Will be called whenever the resource transfer progress is updated.</p></li>
<spanclass="sig-name descname"><spanclass="pre">advertise</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.advertise"title="Permalink to this definition">¶</a></dt>
<dd><p>Advertise the resource. If the other end of the link accepts
the resource advertisement it will begin transferring.</p>
<spanclass="sig-name descname"><spanclass="pre">cancel</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.cancel"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">progress</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.progress"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The current progress of the resource transfer as a <em>float</em> between 0.0 and 1.0.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</div>
<divclass="section"id="transport">
<spanid="api-transport"></span><h3>Transport<aclass="headerlink"href="#transport"title="Permalink to this headline">¶</a></h3>
<dlclass="py class">
<dtclass="sig sig-object py"id="RNS.Transport">
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Transport</span></span><aclass="headerlink"href="#RNS.Transport"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">register_announce_handler</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">handler</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Transport.register_announce_handler"title="Permalink to this definition">¶</a></dt>
<dd><p>Registers an announce handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>handler</strong>– Must be an object with an <em>aspect_filter</em> attribute and a <em>received_announce(destination_hash, announced_identity, app_data)</em> callable. See the <aclass="reference internal"href="examples.html#example-announce"><spanclass="std std-ref">Announce Example</span></a> for more info.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">deregister_announce_handler</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">handler</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Transport.deregister_announce_handler"title="Permalink to this definition">¶</a></dt>
<dd><p>Deregisters an announce handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>handler</strong>– The announce handler to be deregistered.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">has_path</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination_hash</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Transport.has_path"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>destination_hash</strong>– A destination hash as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>True</em> if a path to the destination is known, otherwise <em>False</em>.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">request_path</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination_hash</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Transport.request_path"title="Permalink to this definition">¶</a></dt>
<dd><p>Requests a path to the destination from the network. If
another reachable peer on the network knows a path, it
will announce it.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>destination_hash</strong>– A destination hash as <em>bytes</em>.</p>