mozilla/jwcrypto — pull request #37 by warner (2012-07-25 18:24:40+00:00)
Title: jwcrypto-test.js: improve forged-signature tests (munge payload, not signature)

while trying to learn how jwcrypto is structured, I noticed that the low-level JWS tests aren't covering the error cases as well as they might. The test that confirms we reject bad signatures is modifying the *signature*, not the payload, which wouldn't catch a bug like if `sha256()` were returning "undefined" all the time (thus causing both sign and verify to use a constant string instead of the real message).

This updates the test to unpack the payload, modify it (by adding a new field), then repack it, before handing it to `verify()` and expecting failure. All tests still pass, fortunately :).