Skip to content

Commit 57ede16

Browse files
nihalgonsalvesAllanZhengYP
authored andcommitted
docs(signature-v4-node): update README.md (#351)
Updated to match SignatureV4.d.ts
1 parent 7ada293 commit 57ede16

File tree

1 file changed

+44
-47
lines changed

1 file changed

+44
-47
lines changed

packages/signature-v4-node/README.md

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ The following options are supported:
4141
### presignRequest
4242

4343
The `presignRequest` method accepts a request and returns a Promise that
44-
resolves with a presigned request. The presigned request will have an
45-
expiration and can be passed directly to an HTTP client. The following options can be provided within a hash to the `presignRequest` method:
44+
resolves with a presigned request.
45+
46+
The presigned request will have an expiration and can be passed directly
47+
to an HTTP client.
48+
49+
The following options can be provided to the `presignRequest` method:
4650

4751
- `request` - The request to be signed. This parameter will not be
4852
modified during the signing process but will instead be cloned.
@@ -53,58 +57,51 @@ expiration and can be passed directly to an HTTP client. The following options c
5357
string with values separated by `,`.
5458
Keys should be considered case insensitive.
5559
- `body` - Optional. May be a string, ArrayBuffer, or stream.
56-
- `signingDate` - Optional. The date and time to be used as signature metadata.
57-
This value should be a Date object, a unix (epoch) timestamp, or
58-
a string that can be unerstood by the JavaScript `Date` constructor.
59-
Defaults to `new Date()`.
6060
- `expiration` - The time at which the signed URL should no longer
6161
be honored.
6262
This value should be a Date object, a unix (epoch) timestamp, or a
6363
string that can be understood by the JavaScript `Date` constructor.
64-
- `hoistHeaders` - Optional. Indicates whether to move all values that
65-
would normally be sent as headers to the query string of the URL.
66-
This allows the returned value to be used in contexts that do not
67-
permit specifying additional headers, such as `<img>` tags or `<a>` links.
68-
If set to false, then the request must be sent along with the headers
69-
with which it was signed.
70-
Defaults to true.
71-
- `unsignableHeaders` - Optional. An object whose keys represents
72-
headers that cannot be signed. All headers in the provided request
73-
will have their names converted to lower case and then checked for
74-
existence in the `unsignableHeaders` object using the `in` operator.
75-
Defaults to an object whose keys are lower-cased transfer-specific
76-
headers (such as `user-agent`, `referer`, `expect`, etc).
77-
- `unsignedPayload` - Optional. Indicates whether to sign requests
78-
in such a way as to allow arbitrary message bodies.
79-
Useful for presigning requests for which the body is not known in advance.
80-
Defaults to value passed into constructor.
64+
- `options` object
65+
- `signingDate` - Optional. The date and time to be used as signature metadata.
66+
This value should be a Date object, a unix (epoch) timestamp, or
67+
a string that can be unerstood by the JavaScript `Date` constructor.
68+
Defaults to `new Date()`.
69+
- `unsignableHeaders` - Optional. An object whose keys represents
70+
headers that cannot be signed. All headers in the provided request
71+
will have their names converted to lower case and then checked for
72+
existence in the `unsignableHeaders` object using the `in` operator.
73+
Defaults to an object whose keys are lower-cased transfer-specific
74+
headers (such as `user-agent`, `referer`, `expect`, etc).
8175

82-
### signRequest
76+
### sign
8377

84-
The `signRequest` method accepts a request and returns a Promise that
85-
resolves with a signed request. The signed request will have an
86-
expiration and can be passed directly to an HTTP client. The following options can be provided within a hash to the `signRequest` method:
78+
The `sign` method accepts a request or string and returns a Promise that
79+
resolves with a signed request or signed string.
8780

88-
- `request` - The request to be signed. This parameter will not be
89-
modified during the signing process but will instead be cloned.
90-
The shape of the request should be an object with the following defined:
91-
- `method` - HTTP method (e.g. 'GET', 'PUT', etc).
92-
- `headers` - A mapping of header names to string values.
93-
Multiple values for the same header should be represented as a single
94-
string with values separated by `,`.
95-
Keys should be considered case insensitive.
96-
- `body` - Optional. May be a string, ArrayBuffer, or stream.
97-
- `signingDate` - Optional. The date and time to be used as signature metadata.
81+
The signed request will have an expiration and can be passed directly
82+
to an HTTP client.
83+
84+
The following options can be provided within a hash to the `sign` method:
85+
86+
- `request` or `string`:
87+
- `request` - The request to be signed. This parameter will not be
88+
modified during the signing process but will instead be cloned.
89+
The shape of the request should be an object with the following defined:
90+
- `method` - HTTP method (e.g. 'GET', 'PUT', etc).
91+
- `headers` - A mapping of header names to string values.
92+
Multiple values for the same header should be represented as a single
93+
string with values separated by `,`.
94+
Keys should be considered case insensitive.
95+
- `body` - Optional. May be a string, ArrayBuffer, or stream.
96+
- or `string`
97+
- `options` object
98+
- `signingDate` - Optional. The date and time to be used as signature metadata.
9899
This value should be a Date object, a unix (epoch) timestamp, or
99100
a string that can be unerstood by the JavaScript `Date` constructor.
100101
Defaults to `new Date()`.
101-
- `unsignableHeaders` - Optional. An object whose keys represents
102-
headers that cannot be signed. All headers in the provided request
103-
will have their names converted to lower case and then checked for
104-
existence in the `unsignableHeaders` object using the `in` operator.
105-
Defaults to an object whose keys are lower-cased transfer-specific
106-
headers (such as `user-agent`, `referer`, `expect`, etc).
107-
- `unsignedPayload` - Optional. Indicates whether to sign requests
108-
in such a way as to allow arbitrary message bodies.
109-
Useful for presigning requests for which the body is not known in advance.
110-
Defaults to value passed into constructor.
102+
- `unsignableHeaders` - Optional. An object whose keys represents
103+
headers that cannot be signed. All headers in the provided request
104+
will have their names converted to lower case and then checked for
105+
existence in the `unsignableHeaders` object using the `in` operator.
106+
Defaults to an object whose keys are lower-cased transfer-specific
107+
headers (such as `user-agent`, `referer`, `expect`, etc).

0 commit comments

Comments
 (0)