Repository navigation
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Rebase in progress |
9572b15 to
a74f6b2
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a74f6b28f7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| /** The key of the intact credential, `null` if it isn't intact or isn't holder-bound. */ | ||
| private fun CredentialValidationResult.boundKey(): CryptoPublicKey? = when (val credential = unacceptedCredential) { | ||
| is ValidatedCredential.VcJwt -> credential.credential.holderKey() |
There was a problem hiding this comment.
Preserve thumbprint-bound VC-JWTs during storage
When a VC-JWT uses the expected holder key's JWK thumbprint in sub, evaluateVcJwt still passes holder binding (and the added validator test explicitly preserves that behavior), but this branch calls holderKey(), which returns a key only for did:key subjects. The prepared object's holderKey is therefore null, so storeAccepted() fails in requireHolder() even for the correct single-key holder; before this commit these accepted credentials were stored, and CHANGELOG.md limits the thumbprint break to DCQL matching. Carry the matched expected key through preparation instead.
AGENTS.md reference: AGENTS.md:L14-L15
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Yes, i will add that
nodh
left a comment
There was a problem hiding this comment.
Looking great overall, just some detailed questions to build up understanding on my side.
| val rawDisclosure = """["$salt", "family_name", "Musterfrau"]""" | ||
| .encodeToByteArray().encodeToString(Base64UrlStrict) | ||
| // Bound to the holder key, which signs the KB-JWT | ||
| val cnf = ConfirmationClaim(jsonWebKey = it.holderKeyMaterial.jsonWebKey) |
There was a problem hiding this comment.
Why has this been added here? In general, a presentation without KB-JWT may be fine, when no credential holder key binding is requested.
There was a problem hiding this comment.
The follow-up PR includes the presentation without a KB-JWT
| } | ||
| } | ||
|
|
||
| "SD-JWT VC: a cnf without a key by value is holder-bound, without a holder key" - { fixture -> |
There was a problem hiding this comment.
Would love to see a test case for "SD-JWT VC without KB-JWT is not holder-bound"
There was a problem hiding this comment.
The follow-up PR includes this test case
| key, and one with a resolver blocks the check | ||
| - Deprecate `CredentialValidationContext.expectedHolderKey`, use `expectedHolderKeys` | ||
| - Add `KeyAttestationInput.keys`, the keys to attest | ||
| - BREAKING: New parameters change `copy` and `componentN` of the data classes `CredentialValidationContext`, |
There was a problem hiding this comment.
That's just cluttering the changelog here, please trim it down
| * the `credentialSubject` and no key binding, and only a `did:key` lets the key be derived from it. Any other `sub` is | ||
| * not a key binding. | ||
| */ | ||
| internal fun VerifiableCredentialJws.isHolderBound(): Boolean = subject?.startsWith(DID_KEY_PREFIX) == true |
There was a problem hiding this comment.
That's fine for me, but should be noted as a limitation in an existing markdown file (Readme? Architecture?)
There was a problem hiding this comment.
Added to the ARCHITECTURE.md with a1e7d4b
| VerifiablePresentationFactory(keyMaterial = keyMaterial), | ||
| class HolderAgent private constructor( | ||
| /** `null` for a holder with a [HolderKeyResolver]. */ | ||
| private val singleKey: KeyMaterial?, |
There was a problem hiding this comment.
Do we really need that nullable property, or can we migrate to the HolderKeyResolver to be used exclusively?
There was a problem hiding this comment.
This can be removed if we choose to introduce a breaking change without a fallback for the deprecated keyMaterial accessor
There was a problem hiding this comment.
Looks like we're reading keyMaterial only inside HolderAgent.kt, so I'm fine with a breaking change here, with a message in @Deprecated explaining this, maybe even ReplaceWith for a simple case?
There was a problem hiding this comment.
Discussed offline, deprecation added to HolderAgent constructor.
a8f8006
| ) | ||
| if (validCredentials.any { it.holderKey()?.equalsCryptographically(keyMaterial.publicKey) != true }) | ||
| throw PresentationException("A credential is not bound to the key of the presentation") | ||
| return with( |
There was a problem hiding this comment.
I know that the with construct has been here before, but since we're refactoring this, can we get rid of that?
A holder can now bind each credential to its own key instead of one key for all.
HolderKeyResolver: finds the key a credential is bound to.HolderAgentandVerifiablePresentationFactoryget resolver-based constructors, and presentations are signed with the credential's own key.StoreEntry.holderKey()/isHolderBound(): define holder binding:cnffor SD-JWT VC,deviceKeyfor mdoc, adid:keyinsubfor VC-JWT. DCQL matching uses this definition; SD-JWT and mdoc validation share the key extraction. VC-JWT validation keeps its existingsubmatching.ProofKeySupplier: proof creators ask for a key for every credential request, including retries, allowing the supplier to allocate a fresh key each time.KeyAttestationInput.keyscarries the keys to attest, andProofCreator.createProofreports the key it used. Cancelling a proof signature ends the credential request instead of trying the next proof creator.expectedHolderKeys: a received credential must be bound to one of its request's proof keys. With a resolver and no proof keys the check is blocked, never "any known key". A single-key holder without proof keys continues to expect its one key.Holder.keyMaterial,CredentialValidationContext.expectedHolderKey, theVerifiablePresentationFactory(keyMaterial, …)constructor, and thekeyMaterialconstructors ofOpenId4VpKtorHolder,DcApiHolderandIso180137AnnexCHolder. Single-key constructors keep working.Breaking
copysignatures change, and newcomponentNfunctions are added, onCredentialValidationContext,ReceivedCredential.Decoded,CredentialRequest.Plainand.Encrypted, andKeyAttestationInput. Existing component positions remain unchanged.subis not adid:keyno longer counts as holder-bound in DCQL matching.CHANGELOG.mdandARCHITECTURE.mdare updated.Written by Claude under close supervision.