Don't clear isPending unless KX successful.

If a key-exchange failed then isPending would be cleared but the
expected elements of the contact wouldn't have been filled out. This
caused a crash during the next save() call.
Include checksums in generated shared secrets.

In order to avoid typos in shared secrets, the generated shared secrets
now have a special form that includes a checksum. Old versions of the
code will continue to work fine with them but, from this change on, the
cli and gui will reject shared secrets that have the special prefix
("r!" or "r[") but don't have a valid checksum.

The second form of shared secret (beginning "r[") is not generated yet
but causes the scrypt step to be skipped. This is laying foundations for
the future where these values can be generated.