問題タブ [http-signature]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
node.js - In HTTP Signatures, should I use 'request-line' or 'target-request'?
I'm looking at the Readme.md for http-signing that is part of Joyent's node-http-signature module, and it says to use a "special name" to include the HTTP request target into the signature base:
To include the HTTP request line in the signature calculation, use the special request-line value. While this is overloading the definition of headers in HTTP linguism, the request-line is defined in RFC 2616, and as the outlier from headers in useful signature calculation, it is deemed simpler to simply use request-line than to add a separate parameter for it.
Including request-line
would imply including text like POST /url/path/here HTTP/1.1
into the signature base.
Conversely draft 03 of the spec says to use a different "special value" to include the request target:
If the header field name is
(request-target)
then generate the header field value by concatenating the lowercased :method, an ASCII space, and the :path pseudo-headers
Yes, (request-target) in parens.
With the former, the signature base for a request might look like:
...whereas with the latter, the signature base for the same request would look like this:
So which is authoritative? I doubt that there will remain two ways to include the method and path into the signature base.
I suspect "implementations rule", but I'd like to know the real intention.
node.js - Nodejs - superagent-http-signature - 署名が送信されない
このサイトを利用しています
ノードのバージョン:v4.2.1
サーバーで署名ヘッダーを調べると (ちなみに PHP を実行し、同じ仕様を使用して独自の署名検証機能を使用しています)、署名ヘッダーがありません。
不足しているものはありますか?または、同じ機能を持つ代替ノード パッケージはありますか?
これの目的は、概念実証として PHP 以外の言語を使用して API を呼び出せるようにすることで、後でこれを AWS Lambda のスケジュールされたタスクで使用できるようにすることです。
node.js - httpSignature で request-promise を使用することは可能ですか?
ドキュメントによると、それは実行可能のようです。
request-promise は request をラップするため、request で機能するものはすべて request-promise でも機能します。その他の例については、リクエスト ドキュメントもご覧ください。
そして、リクエストドキュメントは言う
httpSignature - Joyent のライブラリを使用した HTTP 署名方式のオプション。keyId および key プロパティを指定する必要があります。その他のオプションについては、ドキュメントを参照してください。
リクエスト オプションにパラメータを追加しようとしましたが、うまくいきhttpSignature: {key, keyId}
ますが、リクエストとともに秘密鍵が送信されますが、これは正しくありません。