@openeudi/openid4vp 0.9.0 → 0.9.2
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 +15 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var x509 = require('@peculiar/x509');
|
|
4
|
+
require('reflect-metadata');
|
|
4
5
|
var uuid = require('uuid');
|
|
5
6
|
var jose = require('jose');
|
|
6
7
|
var cborX = require('cbor-x');
|
|
@@ -40,7 +41,7 @@ var __export = (target, all) => {
|
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
// 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;
|
|
44
|
+
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
45
|
var init_errors = __esm({
|
|
45
46
|
"src/errors.ts"() {
|
|
46
47
|
exports.InvalidSignatureError = class extends Error {
|
|
@@ -165,6 +166,12 @@ var init_errors = __esm({
|
|
|
165
166
|
super(message);
|
|
166
167
|
}
|
|
167
168
|
};
|
|
169
|
+
exports.MissingVerifierEncryptionKeyError = class extends exports.OpenID4VPError {
|
|
170
|
+
code = "missing_verifier_encryption_key";
|
|
171
|
+
constructor(message = "verifierEncryptionJwk is required to build the OID4VP 1.0 OpenID4VPHandover SessionTranscript for an encrypted response") {
|
|
172
|
+
super(message);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
168
175
|
exports.MultipleCredentialsNotSupportedError = class extends exports.OpenID4VPError {
|
|
169
176
|
code = "multi_credential_unsupported";
|
|
170
177
|
entryCount;
|
|
@@ -9525,6 +9532,9 @@ async function jwkSha256Thumbprint(jwk) {
|
|
|
9525
9532
|
if (jwk.kty !== "EC") {
|
|
9526
9533
|
throw new Error(`Unsupported JWK kty for thumbprint: ${jwk.kty}`);
|
|
9527
9534
|
}
|
|
9535
|
+
if (!jwk.crv || !jwk.x || !jwk.y) {
|
|
9536
|
+
throw new Error("EC JWK for thumbprint is missing a required member (crv, x, or y)");
|
|
9537
|
+
}
|
|
9528
9538
|
const canonical = `{"crv":"${jwk.crv}","kty":"EC","x":"${jwk.x}","y":"${jwk.y}"}`;
|
|
9529
9539
|
return sha256(new TextEncoder().encode(canonical));
|
|
9530
9540
|
}
|
|
@@ -9618,6 +9628,9 @@ async function verifyAuthorizationResponse(envelope, query, options) {
|
|
|
9618
9628
|
const nextOptions = { ...options };
|
|
9619
9629
|
if (options.mdocSessionTranscript === void 0 && options.clientId !== void 0 && options.responseUri !== void 0 && options.nonce !== void 0) {
|
|
9620
9630
|
if (options.sessionTranscriptProfile === "openid4vp-1.0") {
|
|
9631
|
+
if (options.verifierEncryptionJwk === void 0) {
|
|
9632
|
+
throw new exports.MissingVerifierEncryptionKeyError();
|
|
9633
|
+
}
|
|
9621
9634
|
nextOptions.mdocSessionTranscript = await buildOpenID4VPHandoverSessionTranscript({
|
|
9622
9635
|
clientId: options.clientId,
|
|
9623
9636
|
nonce: options.nonce,
|
|
@@ -10279,7 +10292,7 @@ function equalBytes(a, b) {
|
|
|
10279
10292
|
|
|
10280
10293
|
// src/index.ts
|
|
10281
10294
|
init_errors();
|
|
10282
|
-
var VERSION = "0.
|
|
10295
|
+
var VERSION = "0.9.2";
|
|
10283
10296
|
/*! Bundled license information:
|
|
10284
10297
|
|
|
10285
10298
|
pvtsutils/build/index.es.js:
|