info1="[size=18dp][b]Encryption Keys[/b][/size][size=5dp]\n\n[/size]Your primary encryption keys are stored in a Reticulum Identity within the Sideband app. If you want to backup this Identity for later use on this or another device, you can export it as a plain text blob, with the key data encoded in Base32 format. This will allow you to restore your address in Sideband or other LXMF clients at a later point.\n\n[b]Warning![/b] Anyone that gets access to the key data will be able to control your LXMF address, impersonate you, and read your messages. It is [b]extremely important[/b] that you keep the Identity data secure if you export it.\n\nBefore displaying or exporting your Identity data, make sure that no machine or person in your vicinity is able to see, copy or record your device screen or similar."
info2="[size=18dp][b]Backup & Restore[/b][/size][size=5dp]\n\n[/size]You can backup your entire Sideband profile for import on a computer or other device. The exported backup archive will be saved in the downloads folder of your device. Please note that the exported archive contains all your messages, data and encryption keys. Take extreme care to keep this archive secure."
text="Your Identity key, in base32 format is as follows:\n\n[b]"+str(base64.b32encode(self.app.sideband.identity.get_private_key()).decode("utf-8"))+"[/b]",
c_no_button=MDRectangleFlatButton(text="No, go back",font_size=dp(18))
c_dialog=MDDialog(text="[b]Caution![/b]\n\nYour Identity key will be copied to the system clipboard. Take extreme care that no untrusted app steals your key by reading the clipboard data. Clear the system clipboard immediately after pasting your key where you need it.\n\nAre you sure that you wish to proceed?",buttons=[c_no_button,c_yes_button])
defc_dl_no(s):
c_dialog.dismiss()
defc_dl_yes(s):
c_dialog.dismiss()
yes_button=MDRectangleFlatButton(text="OK")
dialog=MDDialog(text="Your Identity key was copied to the system clipboard",buttons=[yes_button])
c_no_button=MDRectangleFlatButton(text="No, go back",font_size=dp(18))
c_dialog=MDDialog(text="[b]Caution![/b]\n\nYou are about to import a new Identity key into Sideband. The currently active key will be irreversibly destroyed, and you will loose your LXMF address if you have not already backed up your current Identity key.\n\nAre you sure that you wish to import the key?",buttons=[c_no_button,c_yes_button])
dialog=MDDialog(text="[b]The provided Identity key data was imported[/b]\n\nThe app will now exit. Please restart Sideband to use the new Identity.",buttons=[yes_button])
dialog=MDDialog(text="[b]The provided Identity key data was not valid[/b]\n\nThe error reported by Reticulum was:\n\n[i]"+str(e)+"[/i]\n\nNo Identity was imported into Sideband.",buttons=[yes_button])