@agent-score/commerce 2.6.4 → 2.6.5

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.
@@ -1142,6 +1142,22 @@ function x402SignerFromPayload(payload) {
1142
1142
  txHash: null
1143
1143
  };
1144
1144
  }
1145
+ function mppCredentialPayloadType(authorizationHeader) {
1146
+ if (typeof authorizationHeader !== "string") return null;
1147
+ if (!authorizationHeader.toLowerCase().startsWith("payment ")) return null;
1148
+ const token = authorizationHeader.slice("payment ".length).trim();
1149
+ if (!token) return null;
1150
+ try {
1151
+ const credential = JSON.parse(atob(token));
1152
+ if (!credential || typeof credential !== "object") return null;
1153
+ const payload = credential.payload;
1154
+ if (!payload || typeof payload !== "object") return null;
1155
+ const type = payload.type;
1156
+ return typeof type === "string" ? type : null;
1157
+ } catch {
1158
+ return null;
1159
+ }
1160
+ }
1145
1161
  function mppSignerFromAuth(authorizationHeader) {
1146
1162
  if (typeof authorizationHeader !== "string") return NULL_RESULT;
1147
1163
  if (!authorizationHeader.toLowerCase().startsWith("payment ")) return NULL_RESULT;
@@ -1434,6 +1450,7 @@ export {
1434
1450
  loadSolanaFeePayer,
1435
1451
  lookupRail,
1436
1452
  malformedPaymentCredential,
1453
+ mppCredentialPayloadType,
1437
1454
  mppxChallengeHeaders,
1438
1455
  networkFamily,
1439
1456
  networks,