datastorm-open / shinymanager

Simple and secure authentification mechanism for single shiny applications.
https://datastorm-open.github.io/shinymanager/
381 stars 79 forks source link

How to change the stored db password #115

Closed dcont5512 closed 2 years ago

dcont5512 commented 3 years ago

Is it possible to change the default password that you set with shinymanager::create_db? In the example below, I would like to change the db password that I originally created ("garfield") with something else:

create_db( credentials_data = credentials, sqlite_path = "path/to/database.sqlite", passphrase = "garfield" )

pvictor commented 2 years ago

No it's not possible, but you can read what's in the DB and write elsewhere:

# read previous db
credentials <- read_db_decrypt("database.sqlite", "credentials", passphrase = "garfield")
pwd_mngt <- read_db_decrypt("database.sqlite", "pwd_mngt", passphrase = "garfield")
logs <- read_db_decrypt("database.sqlite", "logs", passphrase = "garfield")

# write in a new db
write_db_encrypt("new_database.sqlite", credentials, "credentials", passphrase = "new_passphrase")
write_db_encrypt("new_database.sqlite", pwd_mngt, "pwd_mngt", passphrase = "new_passphrase")
write_db_encrypt("new_database.sqlite", logs, "logs", passphrase = "new_passphrase")

Victor