Skip to content

test: Add credential_types test scenarios for action.parameters #1

Description

@leifj

Background

The go-trust PDP (PR #22) has added support for action.parameters.credential_types. The E2E test suite should include test scenarios that verify credential type filtering works correctly.

Current State

The trust integration tests in specs/vc/trust-integration.spec.ts test basic trust evaluation but do not cover credential type constraints.

New Test Scenarios Needed

1. Credential Type Filtering

Test that the PDP correctly handles credential type constraints:

test('should permit issuer with matching credential_types', async () => {
  const result = await evaluateTrust(
    'pid', // tenant with PID issuer whitelisted
    issuerId,
    'credential-issuer',
    { credential_types: ['eu.europa.ec.eudi.pid.1'] }
  );
  expect(result.decision).toBe(true);
  expect(result.context.reason.credential_types).toContain('eu.europa.ec.eudi.pid.1');
});

test('should deny issuer for unauthorized credential_types', async () => {
  const result = await evaluateTrust(
    'pid', // tenant that only allows PID
    issuerId,
    'credential-issuer', 
    { credential_types: ['org.iso.18013.5.1.mDL'] } // mDL not allowed
  );
  expect(result.decision).toBe(false);
});

2. Trust Mark Mapping

Test that OIDF registry returns credential_type_trust_marks:

test('should return credential_type_trust_marks for OIDF issuers', async () => {
  const result = await evaluateTrust(
    'oidf',
    oidfIssuerId,
    'credential-issuer',
    { credential_types: ['eu.europa.ec.eudi.pid.1'] }
  );
  expect(result.context.reason.credential_type_trust_marks).toBeDefined();
});

3. Audit Logging

Verify that credential_types appears in all responses (success and failure) for audit purposes.

Tasks

  • Update evaluateTrust helper to support action.parameters
  • Add test suite for credential_types filtering
  • Add test for credential_type_trust_marks response
  • Add negative tests for unauthorized credential types
  • Add audit trail verification tests

Dependencies

  • go-trust PR #22 must be merged
  • go-wallet-backend #74 must implement proxy support

Related

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