Search code examples
sqlitecapacitorencryption-asymmetriccapacitor-plugin

What is the difference between the three modes "encryption", "secret" and "newsecret" in @capacitor-community/sqlite?


I use the following capacitor plugin.

I would like to asymmetric encrypt my data on the mobile devices. This plugin abstracts the possibility to encrypt the database but I don't understand the difference between the modes and I'm not sure which one I should use.

this.sqlite.open({
  database: "my-database",
  version: 1,
  encrypted: true,
  mode: ??? // <--- "encryption" | "secret" | "newsecret"
});

Documentation

What are the differences?


Solution

  • I have asked the plugin maintainer and his answer is:

    • the mode "encryption" is to be used when you have an already existing database non encrypted and you want to encrypt it.
    • the mode "secret" is to be used when you want to open an encrypted database.
    • the mode "newsecret" is to be used when you want to change the secret of an encrypted database with the newsecret.

    thanks to Quéau Jean Pierre