-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
Conversation
BREAKING CHANGE: remove the deprecated .usingHandover method
BREAKING CHANGE: session transcripts are calculated differently so signature and MAC auth break.
c510fc4
to
f054ff6
Compare
f054ff6
to
2a0e9f8
Compare
BREAKING CHANGE: Verifier#verify options are moved to a builder pattern
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)**. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see 4fd262c
src/mdoc/Verifier.ts
Outdated
* | ||
* 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. |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/mdoc/Verifier.ts
Outdated
/** | ||
* 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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼 Removed in 10fe386
src/mdoc/model/DeviceResponse.ts
Outdated
@@ -1,3 +1,4 @@ | |||
import { createHash } from 'node:crypto'; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
Co-authored-by: Sebastian Iacomuzzi <siacomuzzi@users.noreply.github.com>
src/mdoc/model/DeviceResponse.ts
Outdated
); | ||
return this; | ||
} | ||
|
||
async #oid4vptranscript( |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 👍🏼
src/mdoc/model/DeviceResponse.ts
Outdated
if (sessionTranscriptBytes instanceof Buffer) { | ||
this.sessionTranscriptBytes = Promise.resolve(sessionTranscriptBytes); | ||
} else { | ||
this.sessionTranscriptBytes = sessionTranscriptBytes; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change necessary?
There was a problem hiding this comment.
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
Co-authored-by: Sebastian Iacomuzzi <siacomuzzi@users.noreply.github.com>
BREAKING CHANGE: remove the deprecated .usingHandover method