move gpg-protocol into lib