Skip to content

Commit 008bad5

Browse files
committed
update: rename methods (detach|attach)_payload
1 parent a96ebb0 commit 008bad5

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

cwt/cose_message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def _get_kid(self, sig: list) -> Optional[bytes]:
300300
kid = sig[1].get(4, None)
301301
return kid if kid else self._loads(sig[0]).get(4, None)
302302

303-
def to_detached(self: Self) -> Tuple[Self, bytes]:
303+
def detach_payload(self: Self) -> Tuple[Self, bytes]:
304304
"""
305305
Detach a payload from the COSE message
306306
@@ -316,7 +316,7 @@ def to_detached(self: Self) -> Tuple[Self, bytes]:
316316

317317
return COSEMessage(self._type, [self._msg[0], self._msg[1], None, *self._msg[3:]]), self._payload
318318

319-
def from_detached(self: Self, payload: bytes) -> Self:
319+
def attach_payload(self: Self, payload: bytes) -> Self:
320320
"""
321321
Attach a detached content to the COSE message
322322

tests/test_cose_message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,9 @@ def test_cose_message_detach_and_attach(self):
500500
)
501501
expected_payload = bytes.fromhex("546869732069732074686520636F6E74656E742E")
502502

503-
detached_content_cose_message, detached_payload = ecdsa_cose_sign1_example.to_detached()
503+
detached_content_cose_message, detached_payload = ecdsa_cose_sign1_example.detach_payload()
504504
assert expected_detached_cose_message == detached_content_cose_message
505505
assert expected_payload == detached_payload
506506

507-
reverted_cose_message = detached_content_cose_message.from_detached(detached_payload)
507+
reverted_cose_message = detached_content_cose_message.attach_payload(detached_payload)
508508
assert ecdsa_cose_sign1_example == reverted_cose_message

0 commit comments

Comments
 (0)