@owf/mdoc 0.8.3-alpha-20261017132420 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +35 -0
- package/dist/index.mjs +49 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1255,6 +1255,11 @@ export declare class IssuerAuth extends Sign1$1 {
|
|
|
1255
1255
|
identifierList?: IdentifierListCwt;
|
|
1256
1256
|
trustedIdentifierListChain?: Uint8Array[];
|
|
1257
1257
|
}>;
|
|
1258
|
+
/**
|
|
1259
|
+
* The revocation of the mdoc as data, when `error` reports one, so that a caller can tell it from
|
|
1260
|
+
* a revocation list that could not be verified without parsing the message.
|
|
1261
|
+
*/
|
|
1262
|
+
private revocationResult;
|
|
1258
1263
|
verify(options: {
|
|
1259
1264
|
verificationCallback?: VerificationCallback;
|
|
1260
1265
|
now?: Date;
|
|
@@ -2044,6 +2049,18 @@ export declare const reportDeviceRequestMatch: (match: DeviceRequestMatchResult,
|
|
|
2044
2049
|
export type VerificationAssessmentResult = {
|
|
2045
2050
|
type: 'deviceRequestMatch';
|
|
2046
2051
|
match: DeviceRequestMatchResult;
|
|
2052
|
+
} | {
|
|
2053
|
+
/** The status of the MSO in its status list is not Valid. */
|
|
2054
|
+
type: 'statusListEntryNotValid';
|
|
2055
|
+
uri: string;
|
|
2056
|
+
idx: number;
|
|
2057
|
+
/** The status at `idx`, e.g. `1` for Invalid (revoked) or `2` for Suspended. */
|
|
2058
|
+
status: number;
|
|
2059
|
+
} | {
|
|
2060
|
+
/** The identifier of the MSO is in its identifier list. */
|
|
2061
|
+
type: 'identifierListEntryRevoked';
|
|
2062
|
+
uri: string;
|
|
2063
|
+
id: Uint8Array;
|
|
2047
2064
|
};
|
|
2048
2065
|
export interface VerificationAssessment {
|
|
2049
2066
|
status: 'PASSED' | 'FAILED' | 'WARNING';
|
|
@@ -2509,6 +2526,24 @@ export declare class IdentifierFoundInRevokedListError extends MdlError {}
|
|
|
2509
2526
|
* or passed expiration, or an issuance time in the future).
|
|
2510
2527
|
*/
|
|
2511
2528
|
export declare class InvalidRevocationListError extends MdlError {}
|
|
2529
|
+
/**
|
|
2530
|
+
* The status list was verified, but the status of the MSO in it is not Valid, which ISO/IEC
|
|
2531
|
+
* 18013-5 second edition 12.3.6.1 requires. Unlike a list that fails verification, this is a
|
|
2532
|
+
* statement about the mdoc (Token Status List § 7 and § 8.3), so `uri`, `idx` and `status` are
|
|
2533
|
+
* carried as data rather than only in the message. It extends `InvalidRevocationListError`,
|
|
2534
|
+
* which a status that is not Valid was reported as before.
|
|
2535
|
+
*/
|
|
2536
|
+
export declare class StatusListEntryNotValidError extends InvalidRevocationListError {
|
|
2537
|
+
readonly uri: string;
|
|
2538
|
+
readonly idx: number;
|
|
2539
|
+
/** The status at `idx`, e.g. `1` for Invalid (revoked) or `2` for Suspended. */
|
|
2540
|
+
readonly status: number;
|
|
2541
|
+
constructor(message: string, { uri, idx, status }: {
|
|
2542
|
+
uri: string;
|
|
2543
|
+
idx: number;
|
|
2544
|
+
status: number;
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2512
2547
|
/**
|
|
2513
2548
|
* ISO/IEC TS 18013-7:2025 C.5 requires the mdoc to abort when the DC API did not provide an origin,
|
|
2514
2549
|
* as the session transcript — and thus the anti-relay binding — cannot be computed without it.
|
package/dist/index.mjs
CHANGED
|
@@ -105,6 +105,21 @@ var IdentifierFoundInRevokedListError = class extends MdlError {};
|
|
|
105
105
|
*/
|
|
106
106
|
var InvalidRevocationListError = class extends MdlError {};
|
|
107
107
|
/**
|
|
108
|
+
* The status list was verified, but the status of the MSO in it is not Valid, which ISO/IEC
|
|
109
|
+
* 18013-5 second edition 12.3.6.1 requires. Unlike a list that fails verification, this is a
|
|
110
|
+
* statement about the mdoc (Token Status List § 7 and § 8.3), so `uri`, `idx` and `status` are
|
|
111
|
+
* carried as data rather than only in the message. It extends `InvalidRevocationListError`,
|
|
112
|
+
* which a status that is not Valid was reported as before.
|
|
113
|
+
*/
|
|
114
|
+
var StatusListEntryNotValidError = class extends InvalidRevocationListError {
|
|
115
|
+
constructor(message, { uri, idx, status }) {
|
|
116
|
+
super(message);
|
|
117
|
+
this.uri = uri;
|
|
118
|
+
this.idx = idx;
|
|
119
|
+
this.status = status;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
108
123
|
* ISO/IEC TS 18013-7:2025 C.5 requires the mdoc to abort when the DC API did not provide an origin,
|
|
109
124
|
* as the session transcript — and thus the anti-relay binding — cannot be computed without it.
|
|
110
125
|
*/
|
|
@@ -2469,12 +2484,21 @@ async function verifyStatusListToken({ statusListInfo, trustedCertificates, disa
|
|
|
2469
2484
|
await asMdlRevocationListError(() => statusListCwt.verify({
|
|
2470
2485
|
key,
|
|
2471
2486
|
uri,
|
|
2472
|
-
idx,
|
|
2473
2487
|
now,
|
|
2474
2488
|
skewSeconds,
|
|
2475
2489
|
checkIssuedAt: checkFreshness,
|
|
2476
2490
|
requiredClaims: [RegisteredCwtClaimKey$1.ExpirationTime]
|
|
2477
2491
|
}, { sign1: ctx.cose.sign1 }), InvalidSignatureError);
|
|
2492
|
+
try {
|
|
2493
|
+
statusListCwt.verifyStatus(idx);
|
|
2494
|
+
} catch (error) {
|
|
2495
|
+
if (error instanceof SLException) throw new StatusListEntryNotValidError(error.message, {
|
|
2496
|
+
uri,
|
|
2497
|
+
idx,
|
|
2498
|
+
status: statusListCwt.payload.statusList.getStatus(idx)
|
|
2499
|
+
});
|
|
2500
|
+
throw error;
|
|
2501
|
+
}
|
|
2478
2502
|
return {
|
|
2479
2503
|
statusListCwt,
|
|
2480
2504
|
chain
|
|
@@ -2581,6 +2605,27 @@ var IssuerAuth = class extends Sign1$1 {
|
|
|
2581
2605
|
trustedIdentifierListChain: identifierListResult?.chain
|
|
2582
2606
|
};
|
|
2583
2607
|
}
|
|
2608
|
+
/**
|
|
2609
|
+
* The revocation of the mdoc as data, when `error` reports one, so that a caller can tell it from
|
|
2610
|
+
* a revocation list that could not be verified without parsing the message.
|
|
2611
|
+
*/
|
|
2612
|
+
revocationResult(error) {
|
|
2613
|
+
if (error instanceof StatusListEntryNotValidError) {
|
|
2614
|
+
const { uri, idx, status } = error;
|
|
2615
|
+
return {
|
|
2616
|
+
type: "statusListEntryNotValid",
|
|
2617
|
+
uri,
|
|
2618
|
+
idx,
|
|
2619
|
+
status
|
|
2620
|
+
};
|
|
2621
|
+
}
|
|
2622
|
+
const identifierList = this.mobileSecurityObject.status?.identifierList;
|
|
2623
|
+
if (error instanceof IdentifierFoundInRevokedListError && identifierList) return {
|
|
2624
|
+
type: "identifierListEntryRevoked",
|
|
2625
|
+
uri: identifierList.uri,
|
|
2626
|
+
id: identifierList.id
|
|
2627
|
+
};
|
|
2628
|
+
}
|
|
2584
2629
|
async verify(options, ctx) {
|
|
2585
2630
|
const verificationCallback = options.verificationCallback ?? defaultVerificationCallback;
|
|
2586
2631
|
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
@@ -2640,7 +2685,8 @@ var IssuerAuth = class extends Sign1$1 {
|
|
|
2640
2685
|
onCheck({
|
|
2641
2686
|
status: "FAILED",
|
|
2642
2687
|
check: "Status information must be valid",
|
|
2643
|
-
reason: err instanceof Error ? err.message : "Unknown error"
|
|
2688
|
+
reason: err instanceof Error ? err.message : "Unknown error",
|
|
2689
|
+
result: this.revocationResult(err)
|
|
2644
2690
|
});
|
|
2645
2691
|
}
|
|
2646
2692
|
const { validityInfo } = this.mobileSecurityObject;
|
|
@@ -4477,6 +4523,6 @@ var Verifier = class {
|
|
|
4477
4523
|
}
|
|
4478
4524
|
};
|
|
4479
4525
|
//#endregion
|
|
4480
|
-
export { AgeOverLimitExceededError, AtLeastOneCertificateRequiredError, BleOptions, CoseKey, Curve, DateOnly, DeviceAuth, DeviceAuthentication, DeviceEngagement, DeviceKey, DeviceKeyInfo, DeviceKeyNotAuthorizedError, DeviceMac, DeviceNamespaces, DeviceRequest, DeviceResponse, DeviceRetrievalMethod, DeviceRetrievalMethodType, DeviceSignature, DeviceSigned, DeviceSignedBuilder, DeviceSignedItems, DocRequest, DocTypeMismatchError, Document, DocumentError, DuplicateElementIdentifierError, EDeviceKey, EReaderKey, EitherSignatureOrMacMustBeProvidedError, EncryptedResponse, EncryptedResponseData, EncryptionInfo, EncryptionParameters, EngagementToAppHandover, ErrorItems, Errors, Handover, Holder, HpkeNotSupportedError, HpkeSuiteId, IdentifierFoundInRevokedListError, IdentifierList, IdentifierListCwt, IdentifierListCwtClaimKey, IdentifierListCwtPayload, IdentifierListCwtProtectedHeaders, IdentifierListInfo, InvalidDcApiRequestError, InvalidDcApiResponseError, InvalidDeviceRequestMatchOptionsError, InvalidElementSelectionError, InvalidEncryptedResponseError, InvalidEncryptionInfoError, InvalidIdentifierListSignatureError, InvalidOriginError, InvalidRevocationListError, InvalidSignatureError, InvalidValidityInfoError, IsoMdocDcApi, IsoMdocDcApiHandover, Issuer, IssuerAuth, IssuerNamespaces, IssuerSigned, IssuerSignedBuilder, IssuerSignedItem, ItemsRequest, JwtNotSupportForStatusListError, KeyAuthorizations, KeyInfo, KeyOps, KeyType, Mac0, MdlError, MdlParseError, MediaTypes, MissingOriginError, MissingRequestedElementError, MobileSecurityObject, NfcHandover, NfcOptions, NoPublicKeySetOnStatusListError, Oidc, OriginalBytesCborStructure, ProtectedHeaders, ProtocolInfo, QrHandover, ReaderAuth, ReaderAuthentication, RegisteredCwtClaimKey, RegisteredCwtHeaderClaimKey, Security, ServerRetrievalMethod, SessionTranscript, Sign1, SignatureAlgorithm, SignatureAlgorithmDoesNotMatchSigningKeyAlgorithmError, Status, StatusListInfo, TrustedRevocationCertificatesMustContainAtleastOneCertificateError, UnableToExtractX5ChainFromCwtError, UnableToExtractX5ChainFromIdentifierListError, UnprotectedHeaders, UnprotectedX5ChainNotBoundError, UnsupportedDeviceMacAlgorithmError, ValidityInfo, ValueDigests, VerificationError, Verifier, WebApi, WifiOptions, cborDecode, cborEncode, collectDeviceSignedElements, defaultVerificationCallback, describeUnauthorizedDeviceSignedElements, deviceSignedItemsSchema, errorItemsSchema, findAgeOverCandidate, findUnauthorizedDeviceSignedElements, isoMdocDcApiHpkeSuite, isoMdocDcApiProtocol, isoMdocDcApiRequestSchema, isoMdocDcApiResponseSchema, issuerNamespacesDecodedSchema, issuerNamespacesEncodedSchema, issuerSignedItemSchema, matchCredentialsToDeviceRequest, matchDeviceRequest, onCategoryCheck, parseAgeOverIdentifier, reportDeviceRequestMatch, sessionTranscriptEncodedSchema, verifyIdentifierListToken, verifyStatusListToken };
|
|
4526
|
+
export { AgeOverLimitExceededError, AtLeastOneCertificateRequiredError, BleOptions, CoseKey, Curve, DateOnly, DeviceAuth, DeviceAuthentication, DeviceEngagement, DeviceKey, DeviceKeyInfo, DeviceKeyNotAuthorizedError, DeviceMac, DeviceNamespaces, DeviceRequest, DeviceResponse, DeviceRetrievalMethod, DeviceRetrievalMethodType, DeviceSignature, DeviceSigned, DeviceSignedBuilder, DeviceSignedItems, DocRequest, DocTypeMismatchError, Document, DocumentError, DuplicateElementIdentifierError, EDeviceKey, EReaderKey, EitherSignatureOrMacMustBeProvidedError, EncryptedResponse, EncryptedResponseData, EncryptionInfo, EncryptionParameters, EngagementToAppHandover, ErrorItems, Errors, Handover, Holder, HpkeNotSupportedError, HpkeSuiteId, IdentifierFoundInRevokedListError, IdentifierList, IdentifierListCwt, IdentifierListCwtClaimKey, IdentifierListCwtPayload, IdentifierListCwtProtectedHeaders, IdentifierListInfo, InvalidDcApiRequestError, InvalidDcApiResponseError, InvalidDeviceRequestMatchOptionsError, InvalidElementSelectionError, InvalidEncryptedResponseError, InvalidEncryptionInfoError, InvalidIdentifierListSignatureError, InvalidOriginError, InvalidRevocationListError, InvalidSignatureError, InvalidValidityInfoError, IsoMdocDcApi, IsoMdocDcApiHandover, Issuer, IssuerAuth, IssuerNamespaces, IssuerSigned, IssuerSignedBuilder, IssuerSignedItem, ItemsRequest, JwtNotSupportForStatusListError, KeyAuthorizations, KeyInfo, KeyOps, KeyType, Mac0, MdlError, MdlParseError, MediaTypes, MissingOriginError, MissingRequestedElementError, MobileSecurityObject, NfcHandover, NfcOptions, NoPublicKeySetOnStatusListError, Oidc, OriginalBytesCborStructure, ProtectedHeaders, ProtocolInfo, QrHandover, ReaderAuth, ReaderAuthentication, RegisteredCwtClaimKey, RegisteredCwtHeaderClaimKey, Security, ServerRetrievalMethod, SessionTranscript, Sign1, SignatureAlgorithm, SignatureAlgorithmDoesNotMatchSigningKeyAlgorithmError, Status, StatusListEntryNotValidError, StatusListInfo, TrustedRevocationCertificatesMustContainAtleastOneCertificateError, UnableToExtractX5ChainFromCwtError, UnableToExtractX5ChainFromIdentifierListError, UnprotectedHeaders, UnprotectedX5ChainNotBoundError, UnsupportedDeviceMacAlgorithmError, ValidityInfo, ValueDigests, VerificationError, Verifier, WebApi, WifiOptions, cborDecode, cborEncode, collectDeviceSignedElements, defaultVerificationCallback, describeUnauthorizedDeviceSignedElements, deviceSignedItemsSchema, errorItemsSchema, findAgeOverCandidate, findUnauthorizedDeviceSignedElements, isoMdocDcApiHpkeSuite, isoMdocDcApiProtocol, isoMdocDcApiRequestSchema, isoMdocDcApiResponseSchema, issuerNamespacesDecodedSchema, issuerNamespacesEncodedSchema, issuerSignedItemSchema, matchCredentialsToDeviceRequest, matchDeviceRequest, onCategoryCheck, parseAgeOverIdentifier, reportDeviceRequestMatch, sessionTranscriptEncodedSchema, verifyIdentifierListToken, verifyStatusListToken };
|
|
4481
4527
|
|
|
4482
4528
|
//# sourceMappingURL=index.mjs.map
|