Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions R/credentials-db-sql.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,22 @@ write_sql_db <- function(config_db, value, name = "credentials") {
name <- SQL(name)

if("password" %in% colnames(value)){
# store hashed password
value$password <- sapply(value$password, function(x) scrypt::hashPassword(x))
# is_hashed_password is a column from storing credentials in SQLite.
if("is_hashed_password" %in% colnames(value)){
value$password <- mapply(function(pwd, is_hashed){
if(as.logical(is_hashed)){
# So, the passwords may already be hashed.
pwd
} else {
scrypt::hashPassword(pwd)
}
}, value$password, value$is_hashed_password)
value$is_hashed_password <- T
} else {
# Any clients since the addition of SQL support in version 1.0.5 won't have the
# is_hashed_password column (unless they specify it explicitly in their db config)
value$password <- sapply(value$password, function(x) scrypt::hashPassword(x))
}
}

if("MariaDBConnection" %in% class(conn)){
Expand Down