Skip to content

test: add ICRC-3 certified attribute test vectors#3788

Open
aterga wants to merge 1 commit intosea-snake/icrc3-text-typesfrom
arshavir/icrc3-test-vectors
Open

test: add ICRC-3 certified attribute test vectors#3788
aterga wants to merge 1 commit intosea-snake/icrc3-text-typesfrom
arshavir/icrc3-test-vectors

Conversation

@aterga
Copy link
Copy Markdown
Collaborator

@aterga aterga commented Apr 16, 2026

Summary

Adds 10 integration test vectors for ICRC-3 certified attributes, covering every combination of attribute selection and encoding that the II backend canister can produce. Built on top of #3770.

Each vector exercises the full pipeline — prepare_icrc3_attributesget_icrc3_attributes → signature verification — and captures:

  • Candid-encoded ICRC-3 message bytes
  • Domain-separated signed message ([0x0e] || "ic-sender-info" || message)
  • Full CBOR certificate from the canister signature
  • Human-readable ICRC-3 map representation

Scenarios covered:

# Label
1 Single email, scoped key
2 Single email, unscoped key (omit_scope = true)
3 Single name, scoped key
4 Email + name, both scoped
5 Email + name, both unscoped
6 Mixed scoping (email unscoped, name scoped)
7 Email with value validation
8 Email with specific nonce
9 Mixed scoping with specific nonce
10 No user attributes (only implicit entries)

Tests

  • icrc3_test_vectors integration test in attributes.rs — generates all 10 vectors, verifies every CBOR signature, and prints results as JSON
  • docs/icrc3-test-vectors.md — reference doc explaining the encoding pipeline and how to regenerate
  • docs/icrc3-test-vectors.json — machine-readable snapshot from a single test run

🤖 Generated with Claude Code

< Previous PR |

@aterga aterga requested a review from a team as a code owner April 16, 2026 20:04
@aterga aterga requested a review from Copilot April 16, 2026 20:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a reproducible set of ICRC-3 certified-attribute “test vectors” to the Internet Identity integration test suite and documents the encoding/signing pipeline so external verifiers can validate signatures end-to-end.

Changes:

  • Adds an icrc3_test_vectors integration test that generates 10 scenario vectors, verifies canister signatures, and prints a JSON payload for capture/regeneration.
  • Adds documentation describing the encoding pipeline, scenarios, and regeneration steps.
  • Checks in a JSON snapshot (docs/icrc3-test-vectors.json) from a sample test run.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/internet_identity/tests/integration/attributes.rs New integration test that generates/verifies ICRC-3 vectors and prints them as JSON.
docs/icrc3-test-vectors.md Reference documentation for vector structure, scenarios, and regeneration instructions.
docs/icrc3-test-vectors.json Machine-readable snapshot of generated vectors from one run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/icrc3-test-vectors.md Outdated
Comment thread docs/icrc3-test-vectors.md
Comment thread docs/icrc3-test-vectors.md
Comment thread src/internet_identity/tests/integration/attributes.rs Outdated
Comment thread src/internet_identity/tests/integration/attributes.rs
Comment thread src/internet_identity/tests/integration/attributes.rs
@aterga aterga requested a review from sea-snake April 17, 2026 14:04
@sea-snake sea-snake force-pushed the sea-snake/icrc3-text-types branch 2 times, most recently from 0a5cf6d to 151d340 Compare April 20, 2026 16:14
@aterga aterga force-pushed the arshavir/icrc3-test-vectors branch from b864233 to 3a037f6 Compare April 20, 2026 16:45
Adds an integration test generating 10 test vectors covering every
combination of attribute selection, key scoping, nonce, and value
validation that the II backend canister can produce for ICRC-3
certified attributes.

The test uses a synthetic OpenID credential backed by a JWT signed
in-test by a deterministically-generated RSA key, so the emitted
vectors contain no real personal information. The JWKS endpoint is
mocked to return the corresponding public key, and the canister
verifies the JWT against it in the normal flow.

Each vector exercises the full prepare -> get -> verify pipeline and
emits Candid message bytes, the domain-separated signed message, and
the full CBOR certificate as hex. `ICRC3_ATTRIBUTES_CERTIFICATION_DOMAIN`
is promoted from a function-local const in `canister_tests::framework`
to a module-level `pub const` so both the test and the verification
helper share a single source of truth.

Also adds docs/icrc3-test-vectors.md (reference doc) and
docs/icrc3-test-vectors.json (machine-readable snapshot from one
deterministic run).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@aterga aterga force-pushed the arshavir/icrc3-test-vectors branch from 3a037f6 to c89bd78 Compare April 20, 2026 16:55
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.

2 participants