Skip to content

[#4253 4/8] feat(holder): thread initialBindings through BuildSubmission#4286

Draft
stevenvegt wants to merge 1 commit into
4253-3-rewire-selectfrom
4253-4-buildsubmission-bindings
Draft

[#4253 4/8] feat(holder): thread initialBindings through BuildSubmission#4286
stevenvegt wants to merge 1 commit into
4253-3-rewire-selectfrom
4253-4-buildsubmission-bindings

Conversation

@stevenvegt
Copy link
Copy Markdown
Member

Parent PRD

#4253

Item 4 of 8. Depends on item #3 (#4284) — branched off 4253-3-rewire-select, retargeted up the stack as dependencies merge.

Summary

Add an initialBindings map[string]string parameter to Wallet.BuildSubmission for the captured cross-VP bindings (Policy 2), kept distinct from the user's credentialSelection. Pure, behavior-neutral plumbing — every caller passes nil in this PR, so nothing changes until #5 wires the two-VP caller to pass the filtered captured bindings.

Why a separate parameter (not reuse credentialSelection)

  • credentialSelection is the user's explicit selection, validated as user input at the API layer (Add verifiable data registry #6).
  • initialBindings is the captured org-side binding from the two-VP flow, internal plumbing.

They must stay separate at the BuildSubmission boundary. Merging captured values into credentialSelection at the caller is exactly the applyCapturedFieldsToSelection behavior the PRD removes (PRD problem #1 / Policy 2). They travel separately and merge only inside the presenter when it builds Select's single bindings map. Per Policy 2 they cannot conflict (user values already filtered the org selection, so captured values agree); the merge gives the user credentialSelection precedence defensively.

Implementation Spec

Signature gains initialBindings map[string]string after credentialSelection, before params:

  • vcr/holder/interface.go:56 — interface declaration.
  • vcr/holder/sql_wallet.go:83 — implementation; thread the param to presenter.buildSubmission.
  • vcr/holder/memory_wallet.go:63 — second implementation; same change.
  • vcr/holder/presenter.go buildSubmission — add the param; merge credentialSelection + initialBindings (user precedence) and pass the merged map to builder.SetInitialBindings. With all callers passing nil, the merge is inert in this PR.
  • vcr/holder/mock.go — regenerate via go generate ./vcr/holder/... (mockgen); update MockWallet.BuildSubmission and its recorder.

Callers pass nil for the new parameter:

  • auth/api/iam/openid4vp.go:321BuildSubmission(ctx, []did.DID{walletDID}, nil, *presentationDefinition, nil, nil, buildParams).
  • auth/client/iam/openid4vp.go:465 → add nil for initialBindings. (Moved Nuts-Network to Nuts-Node and implemented RFC004 #5 replaces this nil with the captured org bindings filtered to the SP PD's field ids.)

Testing

Acceptance Criteria

  • BuildSubmission (interface + sql_wallet + memory_wallet) takes initialBindings map[string]string; mock regenerated.
  • Presenter merges credentialSelection + initialBindings (user precedence) into the builder's initial bindings.
  • Both callers updated to pass nil; no behavior change in this PR.
  • go build ./... and go test ./vcr/holder/... ./auth/... pass.

@qltysh
Copy link
Copy Markdown
Contributor

qltysh Bot commented May 27, 2026

Qlty


Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant