@@ -41,8 +41,12 @@ The following options are supported:
41
41
### presignRequest
42
42
43
43
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:
46
50
47
51
- ` request ` - The request to be signed. This parameter will not be
48
52
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
53
57
string with values separated by ` , ` .
54
58
Keys should be considered case insensitive.
55
59
- ` 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() ` .
60
60
- ` expiration ` - The time at which the signed URL should no longer
61
61
be honored.
62
62
This value should be a Date object, a unix (epoch) timestamp, or a
63
63
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).
81
75
82
- ### signRequest
76
+ ### sign
83
77
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.
87
80
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.
98
99
This value should be a Date object, a unix (epoch) timestamp, or
99
100
a string that can be unerstood by the JavaScript ` Date ` constructor.
100
101
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