proposal: mppx.challenge and mppx.verifyCredential interface refactor#337
Open
brendanjryan wants to merge 3 commits intomainfrom
Open
proposal: mppx.challenge and mppx.verifyCredential interface refactor#337brendanjryan wants to merge 3 commits intomainfrom
brendanjryan wants to merge 3 commits intomainfrom
Conversation
commit: |
Add two new methods on the Mppx instance:
- mppx.challenge.{method}.{intent}(opts) — generates Challenge objects
using the same options, defaults, and schema transforms as the 402
handler. Eliminates manual base-unit conversion for UCP/webhook use.
- mppx.verifyCredential(credential) — single-call end-to-end
verification: deserialize, HMAC-check, method match, schema validate,
expiry check, and verify. Replaces 5 manual steps.
Both are extractions of existing createMethodFn internals.
Tests cover charge + session intents, multi-method dispatch, schema
transforms, HMAC rejection, expiry, invalid payloads, unregistered
methods, malformed input, and full round-trip flows.
894000e to
de17026
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two ergonomic changes to public
mppxinterfacemppx.challenge.{method}.{intent}(opts)— Generate aChallengeobject using the same options, defaults, and schema transforms as the 402 handler. Eliminates manual base-unit conversion.mppx.verifyCredential(credential)— Single-call end-to-end verification (deserialize → HMAC → method match → schema validate → expiry → verify). Replaces 5 manual steps.Both are extractions of existing
createMethodFninternals — no new verification logic.