added sendPublicKey function