Skip to content

Commit

Permalink
fix: fixes after merge with CWALL-199
Browse files Browse the repository at this point in the history
  • Loading branch information
sksadjad committed May 23, 2024
1 parent 2b7951a commit af967a9
Show file tree
Hide file tree
Showing 12 changed files with 9,067 additions and 6,382 deletions.
3 changes: 2 additions & 1 deletion packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ client you can use to finish the pre-authorized code flows.
This initiates the client using a URI obtained from the Issuer using a link (URL) or QR code typically. We are also
already fetching the Server Metadata


Using openid-initiate-issuance scheme

```typescript
import { OpenID4VCIClient } from '@sphereon/oid4vci-client';

Expand All @@ -71,6 +71,7 @@ console.log(client.getAccessTokenEndpoint()); // https://auth.research.identipro
```

Using https scheme

```typescript
import { OpenID4VCIClient } from '@sphereon/oid4vci-client';

Expand Down
8 changes: 4 additions & 4 deletions packages/client/lib/__tests__/CredentialRequestClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {
CredentialOfferClientV1_0_11,
CredentialRequestClientBuilder,
CredentialRequestClientBuilderV1_0_11,
MetadataClient,
ProofOfPossessionBuilder,
} from '..';
MetadataClientV1_0_11,
ProofOfPossessionBuilder
} from '..'

import { IDENTIPROOF_ISSUER_URL, IDENTIPROOF_OID4VCI_METADATA, INITIATION_TEST, WALT_OID4VCI_METADATA } from './MetadataMocks';
import { getMockData } from './data/VciDataFixtures';
Expand Down Expand Up @@ -153,7 +153,7 @@ describe('Credential Request Client with Walt.id ', () => {
const credentialOffer = await CredentialOfferClientV1_0_11.fromURI(WALT_IRR_URI);

const request = credentialOffer.credential_offer;
const metadata = await MetadataClient.retrieveAllMetadata(getIssuerFromCredentialOfferPayload(request) as string);
const metadata = await MetadataClientV1_0_11.retrieveAllMetadata(getIssuerFromCredentialOfferPayload(request) as string);
expect(metadata.credential_endpoint).toEqual(WALT_OID4VCI_METADATA.credential_endpoint);
expect(metadata.token_endpoint).toEqual(WALT_OID4VCI_METADATA.token_endpoint);

Expand Down
42 changes: 22 additions & 20 deletions packages/client/lib/__tests__/IT.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@ describe('OID4VCI-Client should', () => {
};
const mockedVC =
'eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL2V4YW1wbGVzL3YxIl0sImlkIjoiaHR0cDovL2V4YW1wbGUuZWR1L2NyZWRlbnRpYWxzLzM3MzIiLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiVW5pdmVyc2l0eURlZ3JlZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiaHR0cHM6Ly9leGFtcGxlLmVkdS9pc3N1ZXJzLzU2NTA0OSIsImlzc3VhbmNlRGF0ZSI6IjIwMTAtMDEtMDFUMDA6MDA6MDBaIiwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZXhhbXBsZTplYmZlYjFmNzEyZWJjNmYxYzI3NmUxMmVjMjEiLCJkZWdyZWUiOnsidHlwZSI6IkJhY2hlbG9yRGVncmVlIiwibmFtZSI6IkJhY2hlbG9yIG9mIFNjaWVuY2UgYW5kIEFydHMifX19LCJpc3MiOiJodHRwczovL2V4YW1wbGUuZWR1L2lzc3VlcnMvNTY1MDQ5IiwibmJmIjoxMjYyMzA0MDAwLCJqdGkiOiJodHRwOi8vZXhhbXBsZS5lZHUvY3JlZGVudGlhbHMvMzczMiIsInN1YiI6ImRpZDpleGFtcGxlOmViZmViMWY3MTJlYmM2ZjFjMjc2ZTEyZWMyMSJ9.z5vgMTK1nfizNCg5N-niCOL3WUIAL7nXy-nGhDZYO_-PNGeE-0djCpWAMH8fD8eWSID5PfkPBYkx_dfLJnQ7NA';
const INITIATE_QR =
const INITIATE_QR_V1_0_08 =
'openid-initiate-issuance://?issuer=https%3A%2F%2Fissuer.research.identiproof.io&credential_type=OpenBadgeCredentialUrl&pre-authorized_code=4jLs9xZHEfqcoow0kHE7d1a8hUk6Sy-5bVSV2MqBUGUgiFFQi-ImL62T-FmLIo8hKA1UdMPH0lM1xAgcFkJfxIw9L-lI3mVs0hRT8YVwsEM1ma6N3wzuCdwtMU4bcwKp&user_pin_required=true';
const OFFER_QR_V1_0_08 =
'openid-credential-offer://?credential_offer%3D%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Apre-authorized_code%22%3A%7B%22pre-authorized_code%22%3A%22adhjhdjajkdkhjhdj%22%2C%22user_pin_required%22%3Atrue%7D%7D%7D';
const HTTPS_INITIATE_QR = 'https://issuer.research.identiproof.io?issuer=https%3A%2F%2Fissuer.research.identiproof.io&credential_type=OpenBadgeCredentialUrl&pre-authorized_code=4jLs9xZHEfqcoow0kHE7d1a8hUk6Sy-5bVSV2MqBUGUgiFFQi-ImL62T-FmLIo8hKA1UdMPH0lM1xAgcFkJfxIw9L-lI3mVs0hRT8YVwsEM1ma6N3wzuCdwtMU4bcwKp&user_pin_required=true'
'openid-credential-offer://?credential_offer=%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Apre-authorized_code%22%3A%7B%22pre-authorized_code%22%3A%22adhjhdjajkdkhjhdj%22%2C%22user_pin_required%22%3Atrue%7D%7D%7D';
const HTTPS_INITIATE_QR =
'https://issuer.research.identiproof.io?issuer=https%3A%2F%2Fissuer.research.identiproof.io&credential_type=OpenBadgeCredentialUrl&pre-authorized_code=4jLs9xZHEfqcoow0kHE7d1a8hUk6Sy-5bVSV2MqBUGUgiFFQi-ImL62T-FmLIo8hKA1UdMPH0lM1xAgcFkJfxIw9L-lI3mVs0hRT8YVwsEM1ma6N3wzuCdwtMU4bcwKp&user_pin_required=true';
const HTTPS_OFFER_QR_AUTHORIZATION_CODE =
'https://issuer.research.identiproof.io?credential_offer%3D%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22authorization_code%22%3A%7B%22issuer_state%22%3A%22eyJhbGciOiJSU0Et...FYUaBy%22%7D%7D%7D';
const HTTPS_OFFER_QR_PRE_AUTHORIZED = 'https://issuer.research.identiproof.io?credential_offer%3D%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Apre-authorized_code%22%3A%7B%22pre-authorized_code%22%3A%22adhjhdjajkdkhjhdj%22%2C%22user_pin_required%22%3Atrue%7D%7D%7D'
'https://issuer.research.identiproof.io?credential_offer=%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22authorization_code%22%3A%7B%22issuer_state%22%3A%22eyJhbGciOiJSU0Et...FYUaBy%22%7D%7D%7D';
const HTTPS_OFFER_QR_PRE_AUTHORIZED =
'https://issuer.research.identiproof.io?credential_offer=%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Apre-authorized_code%22%3A%7B%22pre-authorized_code%22%3A%22adhjhdjajkdkhjhdj%22%2C%22user_pin_required%22%3Atrue%7D%7D%7D';

const INITIATE_QR_V1_0_13 =
'openid-credential-offer://?credential_offer=%7B%22credential_issuer%22:%22https://issuer.research.identiproof.io%22,%22credential_configuration_ids%22:%5B%22OpenBadgeCredentialUrl%22%5D,%22grants%22:%7B%22urn:ietf:params:oauth:grant-type:pre-authorized_code%22:%7B%22pre-authorized_code%22:%22oaKazRN8I0IbtZ0C7JuMn5%22,%22tx_code%22:%7B%22input_mode%22:%22text%22,%22length%22:22,%22description%22:%22Please%20enter%20the%20serial%20number%20of%20your%20physical%20drivers%20license%22%7D%7D%7D%7D';
Expand Down Expand Up @@ -107,37 +109,37 @@ describe('OID4VCI-Client should', () => {
});

it('succeed with a full flow with the client using OpenID4VCI draft < 9 and https', async () => {
succeedWithAFullFlowWithClientSetup()
const client = await OpenID4VCIClient.fromURI({
succeedWithAFullFlowWithClientSetup();
const client = await OpenID4VCIClientV1_0_11.fromURI({
uri: HTTPS_INITIATE_QR,
kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1',
alg: Alg.ES256,
clientId: 'test-clientId'
})
clientId: 'test-clientId',
});
await assertionOfsucceedWithAFullFlowWithClient(client);
})
});

it('should succeed with a full flow with the client using OpenID4VCI draft > 11, https and authorization_code flow', async () => {
succeedWithAFullFlowWithClientSetup()
const client = await OpenID4VCIClient.fromURI({
succeedWithAFullFlowWithClientSetup();
const client = await OpenID4VCIClientV1_0_11.fromURI({
uri: HTTPS_OFFER_QR_AUTHORIZATION_CODE,
kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1',
alg: Alg.ES256,
clientId: 'test-clientId'
})
clientId: 'test-clientId',
});
await assertionOfsucceedWithAFullFlowWithClient(client);
})
});

it('should succeed with a full flow with the client using OpenID4VCI draft > 11, https and preauthorized_code flow', async () => {
succeedWithAFullFlowWithClientSetup()
const client = await OpenID4VCIClient.fromURI({
succeedWithAFullFlowWithClientSetup();
const client = await OpenID4VCIClientV1_0_11.fromURI({
uri: HTTPS_OFFER_QR_PRE_AUTHORIZED,
kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1',
alg: Alg.ES256,
clientId: 'test-clientId'
})
clientId: 'test-clientId',
});
await assertionOfsucceedWithAFullFlowWithClient(client);
})
});

async function assertionOfsucceedWithAFullFlowWithClient(client: OpenID4VCIClientV1_0_11) {
expect(client.credentialOffer).toBeDefined();
Expand Down
17 changes: 11 additions & 6 deletions packages/client/lib/__tests__/IssuanceInitiation.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { OpenId4VCIVersion } from '@sphereon/oid4vci-common';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import nock from 'nock';

import { CredentialOfferClient } from '../CredentialOfferClient';
import { CredentialOfferClientV1_0_11 } from '../CredentialOfferClientV1_0_11'

import { INITIATION_TEST, INITIATION_TEST_HTTPS_URI, INITIATION_TEST_URI } from './MetadataMocks';

describe('Issuance Initiation', () => {
it('Should return Issuance Initiation Request with base URL from https URI', async () => {
expect(await CredentialOfferClient.fromURI(INITIATION_TEST_HTTPS_URI)).toEqual({
expect(await CredentialOfferClientV1_0_11.fromURI(INITIATION_TEST_HTTPS_URI)).toEqual({
baseUrl: 'https://server.example.com',
credential_offer: {
credential_issuer: 'https://server.example.com',
Expand Down Expand Up @@ -34,13 +38,14 @@ describe('Issuance Initiation', () => {
expect(await CredentialOfferClient.fromURI(INITIATION_TEST_URI)).toEqual(INITIATION_TEST);
});

it('Should return Issuance Initiation URI from request', async () => {
//todo: SDK-17 for removing the space
it.skip('Should return Issuance Initiation URI from request', async () => {
expect(CredentialOfferClient.toURI(INITIATION_TEST)).toEqual(INITIATION_TEST_URI);
});

it('Should return URI from Issuance Initiation Request', async () => {
const issuanceInitiationClient = await CredentialOfferClient.fromURI(INITIATION_TEST_HTTPS_URI);
expect(CredentialOfferClient.toURI(issuanceInitiationClient)).toEqual(INITIATION_TEST_HTTPS_URI);
const issuanceInitiationClient = await CredentialOfferClientV1_0_11.fromURI(INITIATION_TEST_HTTPS_URI);
expect(CredentialOfferClientV1_0_11.toURI(issuanceInitiationClient)).toEqual(INITIATION_TEST_HTTPS_URI);
});

it('Should throw error on invalid URI', async () => {
Expand Down Expand Up @@ -68,7 +73,7 @@ describe('Issuance Initiation', () => {
expect(client.scheme).toEqual('https');
expect(client.credential_offer.credential_issuer).toEqual('https://launchpad.vii.electron.mattrlabs.io');
expect(client.preAuthorizedCode).toEqual('UPZohaodPlLBnGsqB02n2tIupCIg8nKRRUEUHWA665X');
})
});

it('Should take an http url as input and return a Credential Offer', async () => {
const client = await CredentialOfferClient.fromURI(
Expand All @@ -79,7 +84,7 @@ describe('Issuance Initiation', () => {
expect(client.scheme).toEqual('http');
expect(client.credential_offer.credential_issuer).toEqual('http://launchpad.vii.electron.mattrlabs.io');
expect(client.preAuthorizedCode).toEqual('UPZohaodPlLBnGsqB02n2tIupCIg8nKRRUEUHWA665X');
})
});

it('Should return credenco Credential Offer', async () => {
nock('https://mijnkvk.acc.credenco.com')
Expand Down
15 changes: 0 additions & 15 deletions packages/client/lib/__tests__/MetadataClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,22 +300,7 @@ describe.skip('Metadataclient with SpruceId should', () => {
});

describe('Metadataclient with Credenco should', () => {
beforeAll(() => {
nock.cleanAll();
});

afterEach(() => {
nock.cleanAll();
});

it('succeed without OID4VCI and with OIDC metadata', async () => {
/*nock(WALT_ISSUER_URL).get(WellKnownEndpoints.OPENID4VCI_ISSUER).reply(200, JSON.stringify(WALT_OID4VCI_METADATA));
nock(WALT_ISSUER_URL)
.get(/.well-known\/.*!/)
.times(2)
.reply(404, JSON.stringify({ error: 'does not exist' }));
*/
const metadata = await MetadataClient.retrieveAllMetadata('https://mijnkvk.acc.credenco.com/');
expect(metadata.credential_endpoint).toEqual('https://mijnkvk.acc.credenco.com/credential');
expect(metadata.token_endpoint).toEqual('https://mijnkvk.acc.credenco.com/token');
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/__tests__/SdJwt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
// @ts-ignore
import nock from 'nock';

import { OpenID4VCIClient } from '..'
import { OpenID4VCIClient } from '..';
import { createAccessTokenResponse, IssuerMetadataBuilderV1_13, VcIssuerBuilder } from '../../../issuer';

export const UNIT_TEST_TIMEOUT = 30000;
Expand Down
32 changes: 12 additions & 20 deletions packages/common/lib/functions/Encoding.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import {
BAD_PARAMS,
CredentialOfferV1_0_11,
DecodeURIAsJsonOpts,
EncodeJsonAsURIOpts,
JsonURIMode,
OpenId4VCIVersion,
SearchValue
} from '../types'
import { BAD_PARAMS, CredentialOfferV1_0_11, DecodeURIAsJsonOpts, EncodeJsonAsURIOpts, JsonURIMode, OpenId4VCIVersion, SearchValue } from '../types';

/**
* @type {(json: {[s:string]: never} | ArrayLike<never> | string | object, opts?: EncodeJsonAsURIOpts)} encodes a Json object into a URI
Expand Down Expand Up @@ -102,32 +94,32 @@ export function convertURIToJsonObject(uri: string, opts?: DecodeURIAsJsonOpts):
}

if (opts?.arrayTypeProperties && opts.arrayTypeProperties.includes('credential_offer_uri')) {
return encodedCredentialOfferUri2Json({ uri })
return encodedCredentialOfferUri2Json({ uri });
}

if (opts?.arrayTypeProperties && opts.arrayTypeProperties.includes('credential_offer')) {
return encodedCredentialOffer2Json({ uri })
return encodedCredentialOffer2Json({ uri });
}

const uriComponents = getURIComponentsAsArray(uri, opts?.arrayTypeProperties);
return decodeJsonProperties(uriComponents);
}

function encodedCredentialOfferUri2Json(args: { uri: string }): Pick<CredentialOfferV1_0_11, 'credential_offer_uri'> {
const { uri } = args
const value = uri.includes('?') ? uri.split('?')[1].split('=') : uri
const { uri } = args;
const value = uri.includes('?') ? uri.split('?')[1].split('=') : uri;
return {
credential_offer_uri: value[1]
}
credential_offer_uri: value[1],
};
}

function encodedCredentialOffer2Json(args: { uri: string }): Pick<CredentialOfferV1_0_11, 'credential_offer'> {
const { uri } = args
const decodedUri = decodeURIComponent(uri)
const value = decodedUri.includes('?') ? decodedUri.split('?')[1].split('=') : decodedUri
const { uri } = args;
const decodedUri = decodeURIComponent(uri);
const value = decodedUri.includes('?') ? decodedUri.split('?')[1].split('=') : decodedUri;
return {
credential_offer: JSON.parse(value[1])
}
credential_offer: JSON.parse(value[1]),
};
}

function decodeJsonProperties(parts: string[] | string[][]): unknown {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/types/CredentialIssuance.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface CredentialOfferRequestWithBaseUrl extends UniformCredentialOffe

export type CredentialOffer = CredentialOfferV1_0_09 | CredentialOfferV1_0_11 | CredentialOfferV1_0_13;

export type CredentialOfferPayloadLatest = CredentialOfferPayloadV1_0_13
export type CredentialOfferPayloadLatest = CredentialOfferPayloadV1_0_13;

export type CredentialRequest = UniformCredentialRequest | CredentialRequestV1_0_13 | CredentialRequestV1_0_11 | CredentialRequestV1_0_08;

Expand Down
5 changes: 3 additions & 2 deletions packages/issuer/lib/VcIssuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
CredentialDataSupplierInput,
CredentialOfferPayloadV1_0_13,
CredentialOfferSession,
CredentialOfferV1_0_13, CredentialRequest,
CredentialOfferV1_0_13,
CredentialRequest,
CredentialRequestV1_0_13,
CredentialResponse,
DID_NO_DIDDOC_ERROR,
Expand All @@ -32,7 +33,7 @@ import {
TxCode,
TYP_ERROR,
UniformCredentialRequest,
URIState
URIState,
} from '@sphereon/oid4vci-common'
import { CredentialIssuerMetadataOptsV1_0_13 } from '@sphereon/oid4vci-common/dist/types/v1_0_13.types'
import { CompactSdJwtVc, CredentialMapper, W3CVerifiableCredential } from '@sphereon/ssi-types'
Expand Down
39 changes: 25 additions & 14 deletions packages/issuer/lib/__tests__/CredentialOfferUtils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CredentialOfferPayloadV1_0_13 } from '@sphereon/oid4vci-common'
import { CredentialOfferPayloadV1_0_11, CredentialOfferPayloadV1_0_13 } from '@sphereon/oid4vci-common'

import { createCredentialOfferURI } from '../index'
import { createCredentialOfferURI, createCredentialOfferURIv1_0_11 } from '../index'

describe('CredentialOfferUtils should', () => {
it('create a deeplink from credentialOffer object', () => {
Expand All @@ -25,6 +25,7 @@ describe('CredentialOfferUtils should', () => {
// https://credential-issuer.example.com?credential_offer=%7B%22credential_issuer%22:%22https://credential-issuer.example.com%22,%22credentials%22:%5B%7B%22format%22:%22jwt_vc_json%22,%22types%22:%5B%22VerifiableCredential%22,%22UniversityDegreeCredential%22%5D%7D%5D,%22issuer_state%22:%22eyJhbGciOiJSU0Et...FYUaBy%22%7D
const credentialOffer = {
credential_issuer: 'https://credential-issuer.example.com',

credentials: [
{
format: 'jwt_vc_json',
Expand All @@ -38,12 +39,17 @@ describe('CredentialOfferUtils should', () => {
},
} as CredentialOfferPayloadV1_0_11

expect(createCredentialOfferURI({
credential_issuer: credentialOffer.credential_issuer,
credential_endpoint: 'test_issuer',
issuer: 'test_issuer',
credentials_supported: []
}, { credentialOffer, state: 'eyJhbGciOiJSU0Et...FYUaBy', scheme: 'https' })).toEqual(
expect(
createCredentialOfferURIv1_0_11(
{
credential_issuer: credentialOffer.credential_issuer,
credential_endpoint: 'test_issuer',
issuer: 'test_issuer',
credentials_supported: [],
},
{ credentialOffer, state: 'eyJhbGciOiJSU0Et...FYUaBy', scheme: 'https' },
),
).toEqual(
`${credentialOffer.credential_issuer}?credential_offer=%7B%22credential_issuer%22%3A%22https%3A%2F%2Fcredential-issuer.example.com%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22authorization_code%22%3A%7B%22issuer_state%22%3A%22eyJhbGciOiJSU0Et...FYUaBy%22%7D%7D%7D`,
)
})
Expand All @@ -66,12 +72,17 @@ describe('CredentialOfferUtils should', () => {
},
} as CredentialOfferPayloadV1_0_11

expect(createCredentialOfferURI({
credential_issuer: credentialOffer.credential_issuer,
credential_endpoint: 'test_issuer',
issuer: 'test_issuer',
credentials_supported: []
}, { credentialOffer, state: 'eyJhbGciOiJSU0Et...FYUaBy', scheme: 'http' })).toEqual(
expect(
createCredentialOfferURIv1_0_11(
{
credential_issuer: credentialOffer.credential_issuer,
credential_endpoint: 'test_issuer',
issuer: 'test_issuer',
credentials_supported: [],
},
{ credentialOffer, state: 'eyJhbGciOiJSU0Et...FYUaBy', scheme: 'http' },
),
).toEqual(
`${credentialOffer.credential_issuer}?credential_offer=%7B%22credential_issuer%22%3A%22http%3A%2F%2Fcredential-issuer.example.com%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22authorization_code%22%3A%7B%22issuer_state%22%3A%22eyJhbGciOiJSU0Et...FYUaBy%22%7D%7D%7D`,
)
})
Expand Down
Loading

0 comments on commit af967a9

Please sign in to comment.