get pub key refactor