@openeudi/openid4vp 0.9.0 → 0.9.1
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.cjs +13 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -40,7 +40,7 @@ var __export = (target, all) => {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
// src/errors.ts
|
|
43
|
-
exports.InvalidSignatureError = void 0; exports.ExpiredCredentialError = void 0; exports.UnsupportedFormatError = void 0; exports.MalformedCredentialError = void 0; exports.NonceValidationError = void 0; exports.HaipValidationError = void 0; exports.OpenID4VPError = void 0; exports.TrustAnchorNotFoundError = void 0; exports.CertificateChainError = void 0; exports.RevokedCertificateError = void 0; exports.RevocationCheckFailedError = void 0; exports.LotlFetchError = void 0; exports.LotlSignatureError = void 0; exports.SignedRequestBuildError = void 0; exports.UnsupportedJweError = void 0; exports.DecryptionFailedError = void 0; exports.MissingDecryptionKeyError = void 0; exports.MultipleCredentialsNotSupportedError = void 0;
|
|
43
|
+
exports.InvalidSignatureError = void 0; exports.ExpiredCredentialError = void 0; exports.UnsupportedFormatError = void 0; exports.MalformedCredentialError = void 0; exports.NonceValidationError = void 0; exports.HaipValidationError = void 0; exports.OpenID4VPError = void 0; exports.TrustAnchorNotFoundError = void 0; exports.CertificateChainError = void 0; exports.RevokedCertificateError = void 0; exports.RevocationCheckFailedError = void 0; exports.LotlFetchError = void 0; exports.LotlSignatureError = void 0; exports.SignedRequestBuildError = void 0; exports.UnsupportedJweError = void 0; exports.DecryptionFailedError = void 0; exports.MissingDecryptionKeyError = void 0; exports.MissingVerifierEncryptionKeyError = void 0; exports.MultipleCredentialsNotSupportedError = void 0;
|
|
44
44
|
var init_errors = __esm({
|
|
45
45
|
"src/errors.ts"() {
|
|
46
46
|
exports.InvalidSignatureError = class extends Error {
|
|
@@ -165,6 +165,12 @@ var init_errors = __esm({
|
|
|
165
165
|
super(message);
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
|
+
exports.MissingVerifierEncryptionKeyError = class extends exports.OpenID4VPError {
|
|
169
|
+
code = "missing_verifier_encryption_key";
|
|
170
|
+
constructor(message = "verifierEncryptionJwk is required to build the OID4VP 1.0 OpenID4VPHandover SessionTranscript for an encrypted response") {
|
|
171
|
+
super(message);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
168
174
|
exports.MultipleCredentialsNotSupportedError = class extends exports.OpenID4VPError {
|
|
169
175
|
code = "multi_credential_unsupported";
|
|
170
176
|
entryCount;
|
|
@@ -9525,6 +9531,9 @@ async function jwkSha256Thumbprint(jwk) {
|
|
|
9525
9531
|
if (jwk.kty !== "EC") {
|
|
9526
9532
|
throw new Error(`Unsupported JWK kty for thumbprint: ${jwk.kty}`);
|
|
9527
9533
|
}
|
|
9534
|
+
if (!jwk.crv || !jwk.x || !jwk.y) {
|
|
9535
|
+
throw new Error("EC JWK for thumbprint is missing a required member (crv, x, or y)");
|
|
9536
|
+
}
|
|
9528
9537
|
const canonical = `{"crv":"${jwk.crv}","kty":"EC","x":"${jwk.x}","y":"${jwk.y}"}`;
|
|
9529
9538
|
return sha256(new TextEncoder().encode(canonical));
|
|
9530
9539
|
}
|
|
@@ -9618,6 +9627,9 @@ async function verifyAuthorizationResponse(envelope, query, options) {
|
|
|
9618
9627
|
const nextOptions = { ...options };
|
|
9619
9628
|
if (options.mdocSessionTranscript === void 0 && options.clientId !== void 0 && options.responseUri !== void 0 && options.nonce !== void 0) {
|
|
9620
9629
|
if (options.sessionTranscriptProfile === "openid4vp-1.0") {
|
|
9630
|
+
if (options.verifierEncryptionJwk === void 0) {
|
|
9631
|
+
throw new exports.MissingVerifierEncryptionKeyError();
|
|
9632
|
+
}
|
|
9621
9633
|
nextOptions.mdocSessionTranscript = await buildOpenID4VPHandoverSessionTranscript({
|
|
9622
9634
|
clientId: options.clientId,
|
|
9623
9635
|
nonce: options.nonce,
|