dchest/tweetnacl-js — pull request #40 by dchest (2014-07-22 16:41:45+00:00)
Title: API CHANGE! sign and sign.open deal with signed messages.

Previously, nacl.sign returned a signature, and nacl.sign.open accepted
a message and "detached" signature. This was unlike NaCl's API, which
dealt with signed messages (concatenation of signature and message).

The new API is:

nacl.sign(message, secretKey) -> signedMessage
nacl.sign.open(signedMessage, publicKey) -> message | null

(Compatibility: the latter will throw exception if it doesn't receive 2
arguments, so that it will deliberately break code that uses old API,
but the former function won't be able to detect this, and users who
didn't upgrade their code will receive a signed message instead of just
a signature.)

Since detached signatures are common, two new API functions are
introduced:

nacl.sign.detached(message, secretKey) -> signature
nacl.sign.detached.verify(message, signature, publicKey) -> true | false

Due to change of API, we increment minor version: from 0.9.2 to 0.10.0
according to semver spec point 4 (for 0.x.y versions).

This change was discussed in issue #36.

---------

This is preliminary PR, will improve fast version to use less copying.