diff --git a/README.md b/README.md index 3edd093..8da4cdb 100644 --- a/README.md +++ b/README.md @@ -29,14 +29,26 @@ python web.py ## Using an existing Reticulum Identity -By default, a new identity is generated every time you run the script. +By default, a random identity is generated every time you run the script. -This is handy for quickly testing out the web ui, however you may want to use an existing identity when chatting to others. +This is handy for quickly testing out the web ui, however you may want to use an existing identity when chatting with others. -To do this, you can provide a base64 encoded private key, like so; +To generate a new identity, you can use the [rnid](https://reticulum.network/manual/using.html#the-rnid-utility) utility provided by Reticulum. ``` -python web.py --identity-private-key "GCN6mMhVemdNIK/fw97C1zvU17qjQPFTXRBotVckeGmoOwQIF8VOjXwNNem3CUOJZCQQpJuc/4U94VSsC39Phw==" +rnid --generate ./new_identity +``` + +You can use then use following to run the web ui with your new identity file; + +``` +python web.py --identity-file ./new_identity +``` + +Alternatively, you can provide a base64 encoded private key, like so; + +``` +python web.py --identity-base64 "GCN6mMhVemdNIK/fw97C1zvU17qjQPFTXRBotVckeGmoOwQIF8VOjXwNNem3CUOJZCQQpJuc/4U94VSsC39Phw==" ``` > NOTE: this is a randomly generated identity for example purposes. Do not use it, it has been leaked! diff --git a/web.py b/web.py index 1d5c18b..692a20e 100644 --- a/web.py +++ b/web.py @@ -29,19 +29,25 @@ def main(): parser = argparse.ArgumentParser(description="ReticulumWebChat") parser.add_argument("--host", nargs='?', default="0.0.0.0", type=str, help="The address the web server should listen on.") parser.add_argument("--port", nargs='?', default="8000", type=int, help="The port the web server should listen on.") - parser.add_argument("--identity-private-key", type=str, help="A base64 encoded private key for a Reticulum Identity to use as your LXMF address.") + parser.add_argument("--identity-file", type=str, help="Path to a Reticulum Identity file to use as your LXMF address.") + parser.add_argument("--identity-base64", type=str, help="A base64 encoded Reticulum Identity to use as your LXMF address.") args = parser.parse_args() # use provided identity, or fallback to a random one global identity - if args.identity_private_key is not None: + if args.identity_file is not None: identity = RNS.Identity(create_keys=False) - identity.load_private_key(base64.b64decode(args.identity_private_key)) - print("Reticulum Identity has been loaded.") + identity.load(args.identity_file) + print("Reticulum Identity has been loaded from file.") + print(identity) + elif args.identity_base64 is not None: + identity = RNS.Identity(create_keys=False) + identity.load_private_key(base64.b64decode(args.identity_base64)) + print("Reticulum Identity has been loaded from base64.") print(identity) else: identity = RNS.Identity(create_keys=True) - print("Reticulum Identity has been generated.") + print("Reticulum Identity has been randomly generated.") print(identity) # run sanic app