How to create an OUT destination from remote info provided to request handler #354
-
Forgive me if this is obvious but I've been away for 2 weeks and I can't see how to do this. app A announces, app B then creates a link to app A and makes requests, gets responses back from app A. How can app A create a destination to app B from info provided to app A's request handler, so that app A can establish a link in reverse to app B at a later point in time? I tried the following but RNS.Identity.recall returns None.
However, within the request handler this will create the outgoing destination:
Given that, I just need a way to save the remote_identity in a file for use later to create a destination. What is the best way to do that? I have tried to save the remote_identity to a file, but I get "'str' object has no attribute 'hexhash'" or other value type errors on the variations I've tried. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
I need to write a routine for my own app, but it's very late and that's a problem for Tomorrow Me. Here's some basic information if you get back to work before I finish an example. Reticulum doesn't provide sender information as part of the packet. Without an active measure from the sender, there's no way to determine their identity. Since you're creating a link, you can use that to identify the sender. From the Identify example:
should send your identity to the server. I don't know if it saves it as a known destination automatically. In a pinch you can use identity.from_file/to_file to save a specific identity. The "'str' object has no attribute 'hexhash'" error is a type issue. What ever you're feeding it into isn't expecting a string, it's probably expecting an identity. It's not entirely clear, since simply calling the identity returns a string, but it's a full class with a number of pieces of information, such as cryptographic keys. Also, an identity's hash isn't always the hash you're looking for, since the identity hash could be AAA, but LXMF.message would be BBB, and AppName,aspect would be CCC. It's predictable if you know AAA and the full name, but otherwise there are a limitless number of potential destination addresses linked to a specific identity. |
Beta Was this translation helpful? Give feedback.
-
I see the save & load_known_destinations in Identity.py soure file, but without a way to reference them I'm not so sure it helps to resolve the problem I expressed in the OP. The NoneType+NoneType error I see when trying to save the remote_identity must be coming from Identity.get_private_key method, which returns self.pub_bytes+self.sig_pub_bytes. That's the only + operator involved. That actually makes sense, that the private key from a remote_identity doesn't exist. Although that doesn't seem like a bug, it should be documented and explicit. The problem expressed in the OP remains however, how do I create a destination to the initiator of a link? |
Beta Was this translation helpful? Give feedback.
-
I decided to temporarily hard code a destination so I could finish coding a function and figure out how to derive the destination from the traffic across the established link later. App B prints a destination hash at startup using RNS.prettyhexrep which I added to app A (full hash like "<ac123...ef890>"). I use that destination string inside app A's message callback (that handles app B's requests), the same way as the Requests & Responses example:
which prints the hexified bytes of app B's destination string and False. If a link exists and thus a path between B and A wouldn't that path also be valid for A to B? Paths can't be based on identity or destinations which can move, thus changing the path. The only reason a path wouldn't exist is if the no traffic traveled through the nodes between destinations. If the intermediate nodes don't change why should the path? Even within a link's request message callback where communication is occurring and thus a path must exist, I can't seem to even create a reverse link manually. It shouldn't be this difficult, I must be doing something wrong here. |
Beta Was this translation helpful? Give feedback.
-
Thinking further about this, even if the reverse path was valid, it probably shouldn't be relied upon to exist at a later point in time. I'm thinking about a scenario where app A disconnects from app B after conveying work to do, then reconnects later to get the status of that work. If app A is mobile, or even if stationary the RNS path between them could change between time of disconnect and reconnect for status request. RNS is designed to be dynamic and routes to destinations can change for the same destinations (destination != location). So although it will be more work to implement a path request involving the UI event loop, timer & delays impacting UX, it is a better and more robust design to do so. |
Beta Was this translation helpful? Give feedback.
Thinking further about this, even if the reverse path was valid, it probably shouldn't be relied upon to exist at a later point in time.
I'm thinking about a scenario where app A disconnects from app B after conveying work to do, then reconnects later to get the status of that work. If app A is mobile, or even if stationary the RNS path between them could change between time of disconnect and reconnect for status request. RNS is designed to be dynamic and routes to destinations can change for the same destinations (destination != location).
So although it will be more work to implement a path request involving the UI event loop, timer & delays impacting UX, it is a better and more robust …