Added dpop support for myaccount and passkeys#137
Merged
Conversation
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.
📋 Changes
This PR carves the DPoP slice out of #116, which combined Passkey, My Account, and DPoP into one large diff. It's the third and final of three sequential branches (Passkey → My Account → DPoP), split for merge-conflict legibility — each lands as its own PR instead of one large here was reviewed there; this PR only re-sequences it.
Features
DPoPAuthauth scheme (auth_schemes/dpop_auth.py). Binds a token to an EC P-256 key your server holds, so a stolen token alone cannot be replayed.dpop_key. Omitting it preserves today's Bearer-token behavior with no change; supplying it attaches a DPoP proof to the request (signin_with_passkey,mfa.verify, and all sevenMyAccountClientauthentication-methods/factors methods).use_dpop_nonceand aDPoP-Nonceheader, the SDK transparently rebuilds the proof with the nonce and retries once — the caller never sees the challenge.dpop_keyis supplied but the server returns an unbound (Bearer) token, or vice versa, the SDK raises rather than silently accepting a token whose binding doesn't match what was requested — onsignin_with_passkey(PasskeyError) andmfa.verify(MfaVerifyError).API Changes
DPoPAuth, exported fromauth_schemes.dpop_key: Optional[jwk.JWK]parameter on:ServerClient.signin_with_passkey,MfaClient.verify, andMyAccountClient.get_factors,list_authentication_methods,get_authentication_method,delete_authentication_method,update_authentication_method,enroll_authentication_method,verify_authentication_method.PasskeyError/MfaVerifyErrorfor the affected call.Passkeys.mdgains "DPoP-bound passkey tokens";MyAccountAuthenticationMethods.mdgains a "DPoP" section;MFA.mdgains "Verify with DPoP" for step-up.