Skip to content

Commit

Permalink
Remove unnecessary cbor encoding for session transcript and in device…
Browse files Browse the repository at this point in the history
… authentication
  • Loading branch information
Helen Qin authored and leecam committed Feb 13, 2025
1 parent e43500e commit 6f056af
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/device_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def generate_device_response(doctype, issuer_signed, device_private_key, session
"DeviceAuthentication",
session_transcript,
doctype,
cbor2.dumps(namespace_tag),
namespace_tag,
]

device_authentication_bytes = cbor2.dumps(
Expand Down
2 changes: 1 addition & 1 deletion examples/verify_mdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
issuer_signed = mdl.generate_credential(device_public_key)

# Generate a device response, this would normally be created by the device's wallet.
session_transcript = bytes(10)
session_transcript = [None, None, ["handover", bytes(10)]]
device_response = generate_device_response(
"org.iso.18013.5.1.mDL", issuer_signed, device_private_key, session_transcript
)
Expand Down
10 changes: 5 additions & 5 deletions isomdoc/verify/verify_mdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def __init__(
device_signed: dict,
doctype: str,
device_public_key: PublicKeyTypes,
session_transcript: bytes,
session_transcript: list,
):

if "nameSpaces" not in device_signed:
Expand Down Expand Up @@ -267,7 +267,7 @@ def __init__(
"DeviceAuthentication",
session_transcript,
doctype,
cbor2.dumps(namespace_tag),
namespace_tag,
]

device_authentication_bytes = cbor2.dumps(
Expand Down Expand Up @@ -295,7 +295,7 @@ class Document:
issuer_signed: IssuerSigned
device_signed: DeviceSigned

def __init__(self, document: dict, session_transcript: bytes):
def __init__(self, document: dict, session_transcript: list):
if "docType" not in document:
raise RuntimeError("Document must contain docType")
self.doctype = document["docType"]
Expand All @@ -316,7 +316,7 @@ def __init__(self, document: dict, session_transcript: bytes):
class DeviceResponse:
documents: Document

def __init__(self, device_response: bytes, session_transcript: bytes):
def __init__(self, device_response: bytes, session_transcript: list):
self.documents = []

device_response_dict = cbor2.loads(device_response)
Expand All @@ -340,5 +340,5 @@ def __init__(self, device_response: bytes, session_transcript: bytes):
]


def verify_device_response(device_response: bytes, session_transcript: bytes) -> DeviceResponse:
def verify_device_response(device_response: bytes, session_transcript: list) -> DeviceResponse:
return DeviceResponse(device_response, session_transcript)

0 comments on commit 6f056af

Please sign in to comment.