would sth = something work for you ?
If you search the forum you'll see that Joplin does not delete masterkeys, when you disable encryption (and in a few other cases).
As for the rest, I let sb ( = somebody) else fill in.