Skip to content

Implement RDFC-1.0 canonicalization for VC proof verification #1

Description

@lokkju

Problem

The spec requires DataIntegrityProof/eddsa-rdfc-2022 for Verifiable Credential proofs, which uses RDFC-1.0 (RDF Dataset Canonicalization). The current implementation uses JCS (RFC 8785) canonicalization instead.

This means:

  • Self-attestation (method: "self") works correctly
  • VC attestation (method: "vc") works when VCs are generated by this library, but will not correctly verify VCs signed by third-party issuers using proper RDFC-1.0

What RDFC-1.0 requires

  1. JSON-LD expansion of the VC document
  2. N-Quads serialization
  3. RDFC-1.0 canonicalization (W3C algorithm)
  4. Two-step hash: hash of canonical proof options + hash of canonical document
  5. Ed25519 signature over the combined hash

Impact

Low for current use cases — the MCP guard only uses self-attestation. This becomes important when:

  • Accepting VCs from external identity providers
  • Interoperating with other x428 implementations that use proper RDFC-1.0
  • Supporting the full eddsa-rdfc-2022 cryptosuite

Implementation notes

  • Will need a JSON-LD processor (e.g., jsonld npm package)
  • The verifyVcProof function in src/core/verify.ts is the only code that needs to change
  • Current JCS-based approach is documented with a comment pointing to this issue
  • Consider making the canonicalization strategy pluggable so JCS remains available for testing

References

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions