Use scrypt to encrypt credentials before temporarily store them in redis

Also better handling of the redis connection.