TritonDataCenter / node-http-signature

Reference implementation of Joyent's HTTP Signature Scheme
https://tritondatacenter.com
MIT License
405 stars 118 forks source link

add support for adding the keyId and algorithm params into the signing string #100

Closed dgwynne closed 4 years ago

dgwynne commented 4 years ago

We have been using this at work in a Perl and C implementation of HTTP Signature Auth that talk to each other, and it seems to work pretty well. I'd like it in this version since I consider it the reference implementation.

The biggest part of this change is reordering a chunk of code in lib/signer.js. If the algorithm is not specified as part of the passed options, it's determined by the type of key and a default hash type for that key. If "(algorithm)" is passed as a header to be signed, that needs to be determined before the signing string is built, which is why that code has been split up.

The rest of the changes are hopefully a bit more straightforward to understand.

jasonbking commented 4 years ago

Can you run 'make check' and and 'make test' and confirm they're clean -- unfortunately I don't think you can view the Jenkins results (though that's all it's doing) -- getting those two clean should fix the failed checks.

jasonbking commented 4 years ago

Thanks for the contribution! If you need this in a published npm release soon, let me know and we can get it pushed out.