Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

42 changes: 42 additions & 0 deletions shared/openId4VCI/Utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import {
ACTIVATION_NEEDED,
Issuers_Key_Ref,
getDisplayObjectForCurrentLanguage,
getCredentialIssuersWellKnownConfig,
removeBottomSectionFields,
getMatchingCredentialIssuerMetadata,
selectCredentialRequestKey,
updateCredentialInformation,
} from './Utils';
import {VCFormat} from '../VCFormat';
import {CACHED_API} from '../api';

// Mock VCProcessor
jest.mock('../../components/VC/common/VCProcessor', () => ({
Expand All @@ -22,6 +24,12 @@ jest.mock('../../components/VC/common/VCProcessor', () => ({
},
}));

jest.mock('../api', () => ({
CACHED_API: {
fetchIssuerWellknownConfig: jest.fn(),
},
}));

describe('openId4VCI Utils', () => {
describe('Protocols', () => {
it('should have OpenId4VCI protocol defined', () => {
Expand Down Expand Up @@ -230,6 +238,40 @@ describe('openId4VCI Utils', () => {
});
});

describe('getCredentialIssuersWellKnownConfig', () => {
it('should include mdoc fallback fields when issuer order is missing', async () => {
(CACHED_API.fetchIssuerWellknownConfig as jest.Mock).mockResolvedValue({
credential_configurations_supported: {
SampleMdocCredential: {
format: VCFormat.mso_mdoc,
claims: {
'org.iso.18013.5.1': {
family_name: {display: [{locale: 'en', name: 'Family Name'}]},
given_name: {display: [{locale: 'en', name: 'Given Name'}]},
},
},
},
},
});

const result = await getCredentialIssuersWellKnownConfig(
'issuer-cache-key',
['default-field'],
'SampleMdocCredential',
VCFormat.mso_mdoc,
'https://issuer.example',
);

expect(result.fields).toEqual(
expect.arrayContaining([
'org.iso.18013.5.1~family_name',
'org.iso.18013.5.1~given_name',
]),
);
expect(result.fields).toHaveLength(2);
});
});

describe('selectCredentialRequestKey', () => {
it('should select first supported key type', () => {
const proofSigningAlgos = ['RS256', 'ES256'];
Expand Down
4 changes: 1 addition & 3 deletions shared/openId4VCI/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
BOTTOM_SECTION_FIELDS_WITH_DETAILED_ADDRESS_FIELDS,
DETAIL_VIEW_ADD_ON_FIELDS,
DETAIL_VIEW_BOTTOM_SECTION_FIELDS,
getCredentialTypeFromWellKnown,
} from '../../components/VC/common/VCUtils';
import {displayType} from '../../machines/Issuers/IssuersMachine';
import {
Expand All @@ -25,7 +24,6 @@ import {
} from '../constants';
import {getJWT} from '../cryptoutil/cryptoUtil';
import {verifyCredential} from '../vcjs/verifyCredential';
import {getVerifiableCredential} from '../../machines/VerifiableCredential/VCItemMachine/VCItemSelectors';
import {getErrorEventData, sendErrorEvent} from '../telemetry/TelemetryUtils';
import {TelemetryConstants} from '../telemetry/TelemetryConstants';
import {KeyTypes} from '../cryptoutil/KeyTypes';
Expand Down Expand Up @@ -163,7 +161,7 @@ export const getCredentialIssuersWellKnownConfig = async (
Object.keys(matchingWellknownDetails.claims).forEach(namespace => {
Object.keys(matchingWellknownDetails.claims[namespace]).forEach(
claim => {
fields.concat(`${namespace}~${claim}`);
fields = fields.concat(`${namespace}~${claim}`);
},
);
});
Expand Down
Loading