adding password validation and generate a pubkey