@openid4vc/openid4vp 0.3.0-alpha-20250707121837 → 0.3.0-alpha-20250711120307
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 +24 -17
- package/dist/index.d.ts +24 -17
- package/dist/index.js +24 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1057,10 +1057,10 @@ import { Oauth2ErrorCodes as Oauth2ErrorCodes5, Oauth2ServerErrorResponseError a
|
|
|
1057
1057
|
function parseAuthorizationRequestVersion(request) {
|
|
1058
1058
|
const requirements = [];
|
|
1059
1059
|
if (request.verifier_info) {
|
|
1060
|
-
requirements.push([">=",
|
|
1060
|
+
requirements.push([">=", 100]);
|
|
1061
1061
|
}
|
|
1062
1062
|
if (request.verifier_attestations) {
|
|
1063
|
-
requirements.push(["<",
|
|
1063
|
+
requirements.push(["<", 100]);
|
|
1064
1064
|
}
|
|
1065
1065
|
if (request.client_metadata?.vp_formats_supported?.mso_mdoc?.deviceauth_alg_values || request.client_metadata?.vp_formats_supported?.mso_mdoc?.deviceauth_alg_values) {
|
|
1066
1066
|
requirements.push([">=", 28]);
|
|
@@ -1145,12 +1145,12 @@ function parseAuthorizationRequestVersion(request) {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
const lessThanVersions = requirements.filter(([operator]) => operator === "<").map(([_, version]) => version);
|
|
1147
1147
|
const greaterThanVersions = requirements.filter(([operator]) => operator === ">=").map(([_, version]) => version);
|
|
1148
|
-
const highestPossibleVersion = lessThanVersions.length > 0 ? Math.max(Math.min(...lessThanVersions) - 1, 18) :
|
|
1148
|
+
const highestPossibleVersion = lessThanVersions.length > 0 ? Math.max(Math.min(...lessThanVersions) - 1, 18) : 100;
|
|
1149
1149
|
const lowestRequiredVersion = greaterThanVersions.length > 0 ? Math.max(...greaterThanVersions) : 18;
|
|
1150
1150
|
if (lowestRequiredVersion > highestPossibleVersion) {
|
|
1151
1151
|
throw new Oauth2ServerErrorResponseError6({
|
|
1152
1152
|
error: Oauth2ErrorCodes5.InvalidRequest,
|
|
1153
|
-
error_description:
|
|
1153
|
+
error_description: `Could not infer openid4vp version from the openid4vp request payload. Based on specification requirements, lowest required version is ${lowestRequiredVersion} and highest possible version is ${highestPossibleVersion}`
|
|
1154
1154
|
});
|
|
1155
1155
|
}
|
|
1156
1156
|
return highestPossibleVersion;
|
|
@@ -1747,18 +1747,24 @@ import { parseIfJson as parseIfJson2, parseWithErrorHandling as parseWithErrorHa
|
|
|
1747
1747
|
|
|
1748
1748
|
// src/vp-token/z-vp-token.ts
|
|
1749
1749
|
import { z as z17 } from "zod";
|
|
1750
|
-
var
|
|
1751
|
-
message: "
|
|
1750
|
+
var zVpTokenPresentationEntry = z17.union([z17.string(), z17.record(z17.any())], {
|
|
1751
|
+
message: "vp_token presentation entry must be string or object"
|
|
1752
1752
|
});
|
|
1753
1753
|
var zVpTokenPex = z17.union(
|
|
1754
|
-
[
|
|
1754
|
+
[
|
|
1755
|
+
zVpTokenPresentationEntry,
|
|
1756
|
+
z17.array(zVpTokenPresentationEntry).nonempty("Must have at least entry in vp_token array")
|
|
1757
|
+
],
|
|
1755
1758
|
{
|
|
1756
|
-
message: "pex vp_token must be a string, object or array of strings and objects"
|
|
1759
|
+
message: "pex vp_token must be a string, object or non-empty array of strings and objects"
|
|
1760
|
+
}
|
|
1761
|
+
);
|
|
1762
|
+
var zVpTokenDcql = z17.record(
|
|
1763
|
+
z17.union([z17.array(zVpTokenPresentationEntry).nonempty(), zVpTokenPresentationEntry]),
|
|
1764
|
+
{
|
|
1765
|
+
message: "dcql vp_token must be an object with keys referencing the dcql credential query id, and values a non-empty array of strings and objects, or string, or object"
|
|
1757
1766
|
}
|
|
1758
1767
|
);
|
|
1759
|
-
var zVpTokenDcql = z17.record(z17.union([z17.string(), z17.record(z17.any())]), {
|
|
1760
|
-
message: "dcql vp_token must be an object with keys referencing the dcql credential query id, and values the encoded (string or object) presentation"
|
|
1761
|
-
});
|
|
1762
1768
|
var zVpToken = zVpTokenDcql.or(zVpTokenPex);
|
|
1763
1769
|
|
|
1764
1770
|
// src/vp-token/parse-vp-token.ts
|
|
@@ -1771,11 +1777,17 @@ function parsePexVpToken(vpToken) {
|
|
|
1771
1777
|
return Array.isArray(parsedVpToken) ? parsedVpToken : [parsedVpToken];
|
|
1772
1778
|
}
|
|
1773
1779
|
function parseDcqlVpToken(vpToken) {
|
|
1774
|
-
|
|
1780
|
+
const parsedVpToken = parseWithErrorHandling5(
|
|
1775
1781
|
zVpTokenDcql,
|
|
1776
1782
|
parseIfJson2(vpToken),
|
|
1777
1783
|
"Could not parse dcql vp_token. Expected an object where the values are encoded presentations"
|
|
1778
1784
|
);
|
|
1785
|
+
return Object.fromEntries(
|
|
1786
|
+
Object.entries(parsedVpToken).map(([queryId, presentations]) => [
|
|
1787
|
+
queryId,
|
|
1788
|
+
Array.isArray(presentations) ? presentations : [presentations]
|
|
1789
|
+
])
|
|
1790
|
+
);
|
|
1779
1791
|
}
|
|
1780
1792
|
|
|
1781
1793
|
// src/authorization-response/validate-authorization-response.ts
|