|
1 | | -import { getIssuerFromCredentialOfferPayload, PRE_AUTH_GRANT_LITERAL, WellKnownEndpoints } from '@sphereon/oid4vci-common'; |
| 1 | +import { |
| 2 | + AuthorizationServerMetadata, |
| 3 | + getIssuerFromCredentialOfferPayload, |
| 4 | + PRE_AUTH_GRANT_LITERAL, |
| 5 | + WellKnownEndpoints |
| 6 | +} from '@sphereon/oid4vci-common' |
2 | 7 | // eslint-disable-next-line @typescript-eslint/ban-ts-comment |
3 | 8 | // @ts-ignore |
4 | 9 | import nock from 'nock'; |
@@ -299,6 +304,25 @@ describe.skip('Metadataclient with SpruceId should', () => { |
299 | 304 | }); |
300 | 305 |
|
301 | 306 | describe('Metadataclient with Credenco should', () => { |
| 307 | + beforeEach(() => { |
| 308 | + const mockData = getMockData('credenco') |
| 309 | + if (!mockData?.metadata?.openid4vci_metadata) { |
| 310 | + throw new Error('Credenco mock data not found or invalid structure') |
| 311 | + } |
| 312 | + nock('https://mijnkvk.acc.credenco.com') |
| 313 | + .get('/.well-known/openid-credential-issuer') |
| 314 | + .reply(200, mockData.metadata.openid4vci_metadata) |
| 315 | + nock('https://mijnkvk.acc.credenco.com').get('/.well-known/openid-configuration').reply(404) |
| 316 | + const authMetadata: AuthorizationServerMetadata = { |
| 317 | + authorization_endpoint: 'https://mijnkvk.acc.credenco.com', |
| 318 | + "pre-authorized_grant_anonymous_access_supported": true, |
| 319 | + issuer: 'https://issuer.research.identiproof.io', |
| 320 | + token_endpoint: 'https://mijnkvk.acc.credenco.com/token', |
| 321 | + response_types_supported: ['token'] |
| 322 | + } |
| 323 | + nock('https://mijnkvk.acc.credenco.com').get('/.well-known/oauth-authorization-server').reply(200, JSON.stringify(authMetadata)); |
| 324 | + }) |
| 325 | + |
302 | 326 | it('succeed without OID4VCI and with OIDC metadata', async () => { |
303 | 327 | const metadata = await MetadataClient.retrieveAllMetadata('https://mijnkvk.acc.credenco.com/'); |
304 | 328 | expect(metadata.credential_endpoint).toEqual('https://mijnkvk.acc.credenco.com/credential'); |
|
0 commit comments