budibase/packages/auth/src/redis/utils.js

21 lines
359 B
JavaScript
Raw Normal View History

const SEPARATOR = "-"
exports.Databases = {
PW_RESETS: "pwReset",
}
exports.addDbPrefix = (db, key) => {
return `${db}${SEPARATOR}${key}`
}
exports.removeDbPrefix = key => {
let parts = key.split(SEPARATOR)
if (parts.length >= 2) {
parts.shift()
return parts.join(SEPARATOR)
} else {
// return the only part
return parts[0]
}
}