This adds sign_bytes and verify_bytes functions in crypto, corresponding to the existing public sign and verify functions but accepting a message as bytes instead of as a string. The existing sign and verify functions are changed to be implemented in terms of the new sign_bytes and verify_bytes functions.
I changed the internal sign/verify functions to use bytes instead of strings rather than adding new functions there too, since those functions are not exported.
Signing and verifying messages as bytes instead of (base64url-encoded) strings is needed for the Unencoded Payload Option (#149).
Re: https://github.com/Keats/jsonwebtoken/pull/148#issuecomment-689074489
This adds
sign_bytes
andverify_bytes
functions incrypto
, corresponding to the existing publicsign
andverify
functions but accepting a message as bytes instead of as a string. The existingsign
andverify
functions are changed to be implemented in terms of the newsign_bytes
andverify_bytes
functions.I changed the internal sign/verify functions to use bytes instead of strings rather than adding new functions there too, since those functions are not exported.
Signing and verifying messages as bytes instead of (base64url-encoded) strings is needed for the Unencoded Payload Option (#149).