Skip to content

Commit 26f5ec0

Browse files
committed
Revert "Update switchbot-openapi.ts"
This reverts commit 2028c89.
1 parent 2028c89 commit 26f5ec0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/switchbot-openapi.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export class SwitchBotOpenAPI extends EventEmitter {
170170
* - `t`: The current timestamp in milliseconds since the Unix epoch.
171171
* - `Content-Type`: The content type of the request, set to `application/json`.
172172
*/
173-
private generateHeaders = (): { 'Authorization': string, 'sign': string, 'nonce': `${string}-${string}-${string}-${string}-${string}`, 't': string, 'Content-Type': string, 'X-Amz-Date': string } => {
173+
private generateHeaders = (): { 'Authorization': string, 'sign': string, 'nonce': `${string}-${string}-${string}-${string}-${string}`, 't': string, 'Content-Type': string } => {
174174
const t = `${Date.now()}`
175175
const nonce = randomUUID()
176176
const data = this.token + t + nonce
@@ -179,15 +179,13 @@ export class SwitchBotOpenAPI extends EventEmitter {
179179
.update(Buffer.from(data, 'utf-8'))
180180
.digest()
181181
const sign = signTerm.toString('base64')
182-
const amzDate = new Date().toISOString().replace(/[:-]|\.\d{3}/g, '')
183182

184183
return {
185-
'Authorization': `Credential=${this.token}, Signature=${sign}, SignedHeaders=content-type;host;x-amz-date, SignedHeaders=content-type;host;x-amz-date`,
184+
'Authorization': this.token,
186185
'sign': sign,
187186
'nonce': nonce,
188187
't': t,
189188
'Content-Type': 'application/json',
190-
'X-Amz-Date': amzDate,
191189
}
192190
}
193191

0 commit comments

Comments
 (0)