Skip to content

Commit

Permalink
type [] in credential_definition not types
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Jan 12, 2024
1 parent 83b86ae commit 730d6d1
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('issuerCallback', () => {
{
format: 'ldp_vc',
credential_definition: {
types: ['VerifiableCredential'],
type: ['VerifiableCredential'],
'@context': ['https://www.w3.org/2018/credentials/v1'],
credentialSubject: {},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/client/lib/CredentialRequestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ export class CredentialRequestClient {
return {
types,
format,
proof,
proof, // TODO Don't we need credential_definition here as well?
};
} else if (format === 'jwt_vc_json-ld' || format === 'ldp_vc') {
return {
format,
proof,
credential_definition: {
types,
type: types,
// FIXME: this was not included in the original code, but it is required
'@context': [],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/OpenID4VCIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ export class OpenID4VCIClient {
} else if ('vct' in c) {
return [c.vct];
} else {
return c.credential_definition.types;
return c.credential_definition.type;
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/functions/CredentialOfferUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export function getTypesFromOffer(credentialOffer: UniformCredentialOfferPayload
if (typeof curr === 'string') {
return [...prev, curr];
} else if (curr.format === 'jwt_vc_json-ld' || curr.format === 'ldp_vc') {
return [...prev, ...curr.credential_definition.types];
return [...prev, ...curr.credential_definition.type];
} else if (curr.format === 'jwt_vc_json' || curr.format === 'jwt_vc') {
return [...prev, ...curr.types];
} else if (curr.format === 'vc+sd-jwt') {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/functions/CredentialRequestUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function getTypesFromRequest(credentialRequest: UniformCredentialRequest,
if (credentialRequest.format === 'jwt_vc_json' || credentialRequest.format === 'jwt_vc') {
types = credentialRequest.types;
} else if (credentialRequest.format === 'jwt_vc_json-ld' || credentialRequest.format === 'ldp_vc') {
types = credentialRequest.credential_definition.types;
types = credentialRequest.credential_definition.type;
} else if (credentialRequest.format === 'vc+sd-jwt') {
types = [credentialRequest.vct];
}
Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/types/Generic.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export type CreateCredentialOfferURIResult = {

export interface JsonLdIssuerCredentialDefinition {
'@context': ICredentialContextType[];
types: string[];
type: string[];
credentialSubject?: IssuerCredentialSubject;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('OID4VCIServer', () => {
format: 'ldp_vc',
credential_definition: {
'@context': ['test_context'],
types: ['VerifiableCredential'],
type: ['VerifiableCredential'],
credentialSubject: {},
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/issuer/lib/__tests__/VcIssuer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('VcIssuer', () => {
{
format: 'ldp_vc',
credential_definition: {
types: ['VerifiableCredential'],
type: ['VerifiableCredential'],
'@context': ['https://www.w3.org/2018/credentials/v1'],
credentialSubject: {},
},
Expand Down

0 comments on commit 730d6d1

Please sign in to comment.