Do not add created field if algorithm is rsa, hmac or ecdsa

pull/23/head
Georg Krause 2021-04-23 17:25:51 +02:00
parent fbd98984ce
commit 6a5f54b77a
No known key found for this signature in database
GPG Key ID: FD479B9A4D48E632
1 changed files with 3 additions and 1 deletions

View File

@ -123,8 +123,10 @@ class HTTPSignatureAuth(requests.auth.AuthBase):
("algorithm", self.algorithm),
("headers", " ".join(self.headers)),
("signature", sig),
("created", int(created_timestamp)),
]
if not (self.algorithm.startswith("rsa") or self.algorithm.startswith("hmac") or
self.algorithm.startswith("ecdsa")):
sig_struct.append(("created", int(created_timestamp)))
if expires_timestamp is not None:
sig_struct.append(("expires", int(expires_timestamp)))
return ",".join('{}="{}"'.format(k, v) for k, v in sig_struct)