update docs on using an existing identity
This commit is contained in:
20
README.md
20
README.md
@@ -29,14 +29,26 @@ python web.py
|
|||||||
|
|
||||||
## Using an existing Reticulum Identity
|
## 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!
|
> NOTE: this is a randomly generated identity for example purposes. Do not use it, it has been leaked!
|
||||||
|
|||||||
16
web.py
16
web.py
@@ -29,19 +29,25 @@ def main():
|
|||||||
parser = argparse.ArgumentParser(description="ReticulumWebChat")
|
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("--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("--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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# use provided identity, or fallback to a random one
|
# use provided identity, or fallback to a random one
|
||||||
global identity
|
global identity
|
||||||
if args.identity_private_key is not None:
|
if args.identity_file is not None:
|
||||||
identity = RNS.Identity(create_keys=False)
|
identity = RNS.Identity(create_keys=False)
|
||||||
identity.load_private_key(base64.b64decode(args.identity_private_key))
|
identity.load(args.identity_file)
|
||||||
print("Reticulum Identity has been loaded.")
|
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)
|
print(identity)
|
||||||
else:
|
else:
|
||||||
identity = RNS.Identity(create_keys=True)
|
identity = RNS.Identity(create_keys=True)
|
||||||
print("Reticulum Identity has been generated.")
|
print("Reticulum Identity has been randomly generated.")
|
||||||
print(identity)
|
print(identity)
|
||||||
|
|
||||||
# run sanic app
|
# run sanic app
|
||||||
|
|||||||
Reference in New Issue
Block a user