Adds keyLocality option with local/remote/random

Fixes #322