Skip to content

Add AdjustInputsForMinCircuit support for V3 stable circuits#118

Merged
olomix merged 15 commits intomainfrom
authV3
Mar 19, 2026
Merged

Add AdjustInputsForMinCircuit support for V3 stable circuits#118
olomix merged 15 commits intomainfrom
authV3

Conversation

@olomix
Copy link
Copy Markdown
Contributor

@olomix olomix commented Feb 3, 2026

Summary

  • Add support for AdjustInputsForMinCircuit function from go-circuits to automatically select the minimum required circuit variant
  • Add circuitId field to JSON response for circuits using adjustment
  • Add new stable circuit IDs: AtomicQueryV3StableCircuitID and AtomicQueryV3OnChainStableCircuitID
  • Refactor AtomicQueryV3InputsFromJson and AtomicQueryV3OnChainInputsFromJson to support both old and stable circuit IDs
  • Remove unused inputsCfg parameter from AuthInputsFromJson

Changes

  • inputs_sig.go: Add internal functions for V3 input handling with configurable circuit IDs and adjustment, integrate AdjustInputsForMinCircuit for AuthV3 and stable circuits
  • cmd/polygonid/polygonid.go: Add circuitId field to response JSON
  • Test files: Add tests for V3 stable circuits, add CircuitID verification to test helper

Circuits affected

  • AuthV3CircuitID / AuthV3_8_32CircuitID → returns circuitId: "authV3-8-32"
  • AtomicQueryV3StableCircuitID → returns circuitId: "credentialAtomicQueryV3-16-16-64"
  • AtomicQueryV3OnChainStableCircuitID → returns circuitId: "credentialAtomicQueryV3OnChain-16-16-64-16-32"

Backward compatibility

  • Old circuits (AtomicQueryV3CircuitID, AtomicQueryV3OnChainCircuitID, AuthV2CircuitID) remain unchanged and do not return circuitId field

olomix added 15 commits January 6, 2026 11:05
- Add generic AuthInputsFromJson[T] supporting AuthV2, AuthV3, and
  AuthV3_8_32 circuits with configurable BaseConfig
- Deprecate AuthV2InputsFromJson in favor of the generic version
- Migrate to Go 1.25 synctest.Test API (was synctest.Run)
- Update CI to Go 1.25.5 and latest action versions
Use GenericInputsFromJson which routes to the generic AuthInputsFromJson[T]
based on circuit ID.
Verify that the signature in auth inputs matches the challenge signed
by the public key stored in the AuthClaim.
- Add CircuitID field to AtomicQueryInputsResponse to track selected circuit
- Update marshalInputsResponse to include circuitId in JSON response
- Modify AuthInputsFromJson to use AdjustInputsForMinCircuit for AuthV3Inputs
- Refactor AtomicQueryV3InputsFromJson and AtomicQueryV3OnChainInputsFromJson
  to support adjustable circuit selection via internal functions
- Add support for AtomicQueryV3StableCircuitID and
  AtomicQueryV3OnChainStableCircuitID with min circuit adjustment
- Combine AuthV3CircuitID and AuthV3_8_32CircuitID cases in GenericInputsFromJson
- Add GenericInputsFromJson tests for AtomicQueryV3Stable and
  AtomicQueryV3OnChainStable circuits in inputs_sig_test.go
- Add test for atomic_query_v3_on_chain_stable_mtp_inputs in
  cmd/polygonid/polygonid_test.go
- Add test input/output fixtures for stable V3 circuits
Add wantCircuitID parameter to doTest function to verify that circuits
return the expected CircuitID in their response. This ensures that
AdjustInputsForMinCircuit is being called correctly for stable circuits.
Without these entries, selective disclosure queries and empty
credentialSubject queries targeting V3 stable circuits would fail
with "circuit not supported for selective disclosure."
@olomix olomix merged commit bf83aa0 into main Mar 19, 2026
5 checks passed
@olomix olomix deleted the authV3 branch March 19, 2026 16:26
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