refactor(client): introduce a keyPrefix field

The path prefix added to a key was spread out over several functions.
Instead of doing this lets add a keyPrefix to the client and use it
everywhere. Along the way refactor duplicate logic into the
sendKeyRequest function.