From 304acdd0c1d26fae8b512862dd371bc2547d875f Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 7 May 2026 18:15:31 +0200 Subject: [PATCH] Added ability to query network for raw identities to rnid --- RNS/Utilities/rnid.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/RNS/Utilities/rnid.py b/RNS/Utilities/rnid.py index dc1f0681..99cd9e90 100644 --- a/RNS/Utilities/rnid.py +++ b/RNS/Utilities/rnid.py @@ -157,6 +157,7 @@ def main(): if args.encrypt: encrypt(args, identity); op = True if args.decrypt: decrypt(args, identity); op = True if args.write: write_identity(args, identity); op = True + if args.generate: op = True if not op: parser.print_help() @@ -231,10 +232,13 @@ def get_operating_identity(args, allow_none=False, no_cache=False): exit(R_NO_IDENTITY) else: - id_destination_hash = RNS.Destination.hash_from_name_and_identity(DEFAULT_ASPECTS, identity) + id_destination_hash = RNS.Destination.hash_from_name_and_identity(DEFAULT_ASPECTS, requested_hash) RNS.Transport.request_path(requested_hash) # Acquire if this was a destination hash RNS.Transport.request_path(id_destination_hash) # Acquire if this was an identity hash - def spincheck(): return RNS.Identity.recall(requested_hash) != None + + def spincheck(): + received = RNS.Identity.recall(requested_hash) or RNS.Identity.recall(requested_hash, from_identity_hash=True) + return received != None spin(spincheck, "Requesting unknown Identity for "+RNS.prettyhexrep(requested_hash), args.t) if not spincheck(): @@ -243,7 +247,7 @@ def get_operating_identity(args, allow_none=False, no_cache=False): else: return None else: - identity = RNS.Identity.recall(requested_hash) + identity = RNS.Identity.recall(requested_hash) or RNS.Identity.recall(requested_hash, from_identity_hash=True) print("Received Identity "+str(identity)+" for destination "+RNS.prettyhexrep(requested_hash)+" from the network") else: @@ -364,7 +368,7 @@ def announce(args, identity): if not identity.get_private_key(): print("Cannot announce this destination, since the private key is not held"); exit(R_NO_PRVKEY) else: destination = RNS.Destination(identity, RNS.Destination.IN, RNS.Destination.SINGLE, app_name, *aspects) - print(f"Announcing {args.announce} destination {RNS.prettyhexrep(destination.hash)} for identity {identity}") + print(f"Announcing {args.announce} destination {RNS.prettyhexrep(destination.hash)} for identity {identity}") destination.announce(); time.sleep(0.25) except Exception as e: print(f"An error ocurred while attempting to send the announce: {e}"); exit(R_UNKNOWN_ERROR)