Skip to content

Commit 515168c

Browse files
authored
Add expires message header (#61)
The header is time in milliseconds to expire the message.
1 parent 083406c commit 515168c

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/pubtools/sign/signers/msgsigner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ def _construct_headers(
214214
"owner_id": self.creator,
215215
"mtype": sig_type.value,
216216
"source": "metadata",
217+
"expires": self.timeout * self.retries * 1000,
217218
}
218219
if extra_attrs:
219220
headers.update(extra_attrs)

tests/test_msg_batch_signer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ def test_create_msg_batch_message(f_config_msg_batch_signer_ok):
261261
headers={
262262
"service": "pubtools-sign",
263263
"environment": "prod",
264+
"expires": 3000,
264265
"owner_id": "pubtools-sign-test",
265266
"mtype": "batch",
266267
"source": "metadata",

tests/test_msg_signer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ def test__construct_headers(f_config_msg_signer_ok):
489489
assert ret == {
490490
"service": "pubtools-sign",
491491
"environment": "prod",
492+
"expires": 3000,
492493
"owner_id": "pubtools-sign-test",
493494
"mtype": SignRequestType.CONTAINER,
494495
"source": "metadata",
@@ -522,6 +523,7 @@ def test_create_msg_message(f_config_msg_signer_ok):
522523
"service": "pubtools-sign",
523524
"environment": "prod",
524525
"owner_id": "pubtools-sign-test",
526+
"expires": 3000,
525527
"mtype": SignRequestType.CONTAINER,
526528
"source": "metadata",
527529
},
@@ -544,6 +546,7 @@ def test_create_msg_message(f_config_msg_signer_ok):
544546
"service": "pubtools-sign",
545547
"environment": "prod",
546548
"owner_id": "pubtools-sign-test",
549+
"expires": 3000,
547550
"mtype": SignRequestType.CLEARSIGN,
548551
"source": "metadata",
549552
},

0 commit comments

Comments
 (0)