mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-10-26 19:01:43 -04:00
do not overwrite existing files, otherwise user could lose existing keys
This commit is contained in:
parent
abd5794230
commit
bf483ed95d
1 changed files with 8 additions and 0 deletions
8
web.py
8
web.py
|
|
@ -428,9 +428,17 @@ async def main():
|
|||
|
||||
# util to generate reticulum identity and save to file without using rnid
|
||||
if args.generate_identity_file is not None:
|
||||
|
||||
# do not overwrite existing files, otherwise user could lose existing keys
|
||||
if os.path.exists(args.generate_identity_file):
|
||||
print("DANGER: the provided identity file path already exists, not overwriting!")
|
||||
return
|
||||
|
||||
# generate a new identity and save to provided file path
|
||||
identity = RNS.Identity(create_keys=True)
|
||||
with open(args.generate_identity_file, "wb") as file:
|
||||
file.write(identity.get_private_key())
|
||||
|
||||
print("A new Reticulum Identity has been saved to: {}".format(args.generate_identity_file))
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue