Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: implement the changes for the dash7, draft 2024 #16

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

jmcabrera
Copy link
Contributor

BREAKING CHANGE: remove the deprecated .usingHandover method

BREAKING CHANGE: remove the deprecated .usingHandover method
BREAKING CHANGE: session transcripts are calculated differently
so signature and MAC auth break.
README.md Outdated
@@ -2,7 +2,9 @@

[ISO 18013-5](https://www.iso.org/standard/69084.html) defines mDL (mobile Driver Licenses): an ISO standard for digital driver licenses.

This is a Node.js library to issue and verify mDL [CBOR encoded](https://cbor.io/) documents in accordance with **ISO 18013-7 (draft's date: 2023-08-02)**.
> [!WARNING] This is a Node.js library to issue and verify mDL [CBOR encoded](https://cbor.io/) documents in accordance with **ISO 18013-7 (draft's date: 2024-02-13)**.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't put a warning here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the callout, see 655f534

Co-authored-by: Sebastian Iacomuzzi <siacomuzzi@users.noreply.github.com>
README.md Outdated

const diagnosticInfo = await verifier
.usingEphemeralReaderKey(ephemeralReaderKey)
.usingSessionTranscriptBytes(encodedSessionTranscript)
Copy link
Contributor

@siacomuzzi siacomuzzi Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we show the wrappers for OID4VP and Web API in the doc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see 4fd262c

*
* This should match the session transcript as it will be calculated by the mdoc app.
*
* @param {string} mdocGeneratedNonce - A cryptographically random number with sufficient entropy.
Copy link
Contributor

@siacomuzzi siacomuzzi Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are on the verifier side here, use a proper description (I don't remember where this nonce value is taken when using OID4VP)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/**
* Parse and validate a DeviceResponse as specified in ISO/IEC 18013-5 (Device Retrieval section).
*
* @param encodedDeviceResponse
* @param options.encodedSessionTranscript The CBOR encoded SessionTranscript.
* @param options.ephemeralReaderKey The private part of the ephemeral key used in the session where the DeviceResponse was obtained. This is only required if the DeviceResponse is using the MAC method for device authentication.
* @param options.disableCertificateChainValidation Whether to use the certificate validation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this expected? It seems like you are removing the options param

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼 Removed in 10fe386

@@ -1,3 +1,4 @@
import { createHash } from 'node:crypto';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using uncrypto (this should works on browsers)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a hash function based on uncrypto.
Had to revisit a bit the way we deal with the session transcript, as hashing is done async in uncrypto and sync in node:crypto

jmcabrera and others added 3 commits October 4, 2024 19:11
Co-authored-by: Sebastian Iacomuzzi <siacomuzzi@users.noreply.github.com>
);
return this;
}

async #oid4vptranscript(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: consider moving this helper (and the one for web api) to utils.ts (just to avoid duplicating code)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done here and in the Verifier in 2e172eb 👍🏼

Comment on lines 86 to 90
if (sessionTranscriptBytes instanceof Buffer) {
this.sessionTranscriptBytes = Promise.resolve(sessionTranscriptBytes);
} else {
this.sessionTranscriptBytes = sessionTranscriptBytes;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, the field is awaited everywhere. I removed this check in 40bc700

jmcabrera and others added 3 commits October 8, 2024 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants