Skip to content

Commit

Permalink
fix: rename jwt_vc_json_ld to jwt_vc_json-ld
Browse files Browse the repository at this point in the history
Signed-off-by: Berend Sliedrecht <[email protected]>
  • Loading branch information
berendsliedrecht committed Jun 1, 2023
1 parent d9dae74 commit a366bef
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
6 changes: 3 additions & 3 deletions packages/client/lib/CredentialRequestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class CredentialRequestClient {
let format: string = uniformRequest.format;
if (format === 'jwt_vc_json') {
format = 'jwt_vc';
} else if (format === 'jwt_vc_json_ld') {
} else if (format === 'jwt_vc_json-ld') {
format = 'ldp_vc';
}

Expand Down Expand Up @@ -97,13 +97,13 @@ export class CredentialRequestClient {
if (formatSelection === 'jwt_vc' || formatSelection === 'jwt') {
format = 'jwt_vc_json';
} else if (formatSelection === 'ldp_vc' || formatSelection === 'ldp') {
format = 'jwt_vc_json_ld';
format = 'jwt_vc_json-ld';
}
}

if (!format) {
throw Error(`Format of credential to be issued is missing`);
} else if (format !== 'jwt_vc_json_ld' && format !== 'jwt_vc_json' && format !== 'ldp_vc') {
} else if (format !== 'jwt_vc_json-ld' && format !== 'jwt_vc_json' && format !== 'ldp_vc') {
throw Error(`Invalid format of credential to be issued: ${format}`);
}
const typesSelection =
Expand Down
4 changes: 2 additions & 2 deletions packages/client/lib/__tests__/CredentialRequestClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe('Credential Request Client ', () => {
.build();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await expect(credReqClient.acquireCredentialsUsingRequest({ format: 'jwt_vc_json_ld', types: ['random'], proof })).rejects.toThrow(
await expect(credReqClient.acquireCredentialsUsingRequest({ format: 'jwt_vc_json-ld', types: ['random'], proof })).rejects.toThrow(
Error(URL_NOT_VALID)
);
});
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('Credential Request Client with different issuers ', () => {
jwt: getMockData('spruce')?.credential.request.proof.jwt as string,
},
credentialTypes: ['OpenBadgeCredential'],
format: 'jwt_vc_json_ld',
format: 'jwt_vc_json-ld',
version: OpenId4VCIVersion.VER_1_0_08,
});
expect(credentialRequest).toEqual(getMockData('spruce')?.credential.request);
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/__tests__/IT.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('OID4VCI-Client should', () => {

const credentialResponse = await client.acquireCredentials({
credentialTypes: 'OpenBadgeCredential',
format: 'jwt_vc_json_ld',
format: 'jwt_vc_json-ld',
proofCallbacks: {
signCallback: proofOfPossessionCallbackFunction,
},
Expand Down
10 changes: 5 additions & 5 deletions packages/client/lib/__tests__/data/VciDataFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface IssuerMockData {
deeplink: string;
request: {
types: [string];
format: 'jwt_vc' | 'ldp_vc' | 'jwt_vc_json_ld' | string;
format: 'jwt_vc' | 'ldp_vc' | 'jwt_vc_json-ld' | string;
proof: {
proof_type: 'jwt' | string;
jwt: string;
Expand Down Expand Up @@ -111,7 +111,7 @@ const mockData: VciMockDataStructure = {
'openid-initiate-issuance://?issuer=https%3A%2F%2Fngi%2Doidc4vci%2Dtest%2Espruceid%2Exyz&credential_type=OpenBadgeCredential&pre-authorized_code=eyJhbGciOiJFUzI1NiJ9.eyJjcmVkZW50aWFsX3R5cGUiOlsiT3BlbkJhZGdlQ3JlZGVudGlhbCJdLCJleHAiOiIyMDIzLTA0LTIwVDA5OjA0OjM2WiIsIm5vbmNlIjoibWFibmVpT0VSZVB3V3BuRFFweEt3UnRsVVRFRlhGUEwifQ.qOZRPN8sTv_knhp7WaWte2-aDULaPZX--2i9unF6QDQNUllqDhvxgIHMDCYHCV8O2_Gj-T2x1J84fDMajE3asg&user_pin_required=false',
request: {
types: ['OpenBadgeCredential'],
format: 'jwt_vc_json_ld',
format: 'jwt_vc_json-ld',
proof: {
proof_type: 'jwt',
jwt: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksiLCJraWQiOiJkaWQ6andrOmV5SmhiR2NpT2lKRlV6STFOa3NpTENKMWMyVWlPaUp6YVdjaUxDSnJkSGtpT2lKRlF5SXNJbU55ZGlJNkluTmxZM0F5TlRack1TSXNJbmdpT2lKclpuVmpTa0V0VEhKck9VWjBPRmx5TFVkMlQzSmpia3N3YjNkc2RqUlhNblUwU3pJeFNHZHZTVlIzSWl3aWVTSTZJalozY0ZCUE1rOUNRVXBTU0ZFMVRXdEtXVlJaV0dsQlJFUXdOMU5OTlV0amVXcDNYMkUzVUUxWmVGa2lmUSMwIn0.eyJhdWQiOiJodHRwczovL25naS1vaWRjNHZjaS10ZXN0LnNwcnVjZWlkLnh5eiIsImlhdCI6MTY4MTkxMTA2MC45NDIsImV4cCI6MTY4MTkxMTcyMC45NDIsImlzcyI6InNwaGVyZW9uOnNzaS13YWxsZXQiLCJqdGkiOiJhNjA4MzMxZi02ZmE0LTQ0ZjAtYWNkZWY5NmFjMjdmNmQ3MCJ9.NwF3_41gwnlIdd_6Uk9CczeQHzIQt6UcvTT5Cxv72j9S1vNwiY9annA2kLsjsTiR5-WMBdUhJCO7wYCtZ15mxw',
Expand Down Expand Up @@ -366,7 +366,7 @@ const mockData: VciMockDataStructure = {
response: {
credential:
'eyJraWQiOiJkaWQ6andrOmV5SnJkSGtpT2lKUFMxQWlMQ0oxYzJVaU9pSnphV2NpTENKamNuWWlPaUpGWkRJMU5URTVJaXdpYTJsa0lqb2lOMlEyWTJKbU1qUTRPV0l6TkRJM05tSXhOekl4T1RBMU5EbGtNak01TVRnaUxDSjRJam9pUm01RlZWVmhkV1J0T1RsT016QmlPREJxY3poV2REUkJiazk0ZGxKM1dIUm5VbU5MY1ROblFrbDFPQ0lzSW1Gc1p5STZJa1ZrUkZOQkluMCMwIiwidHlwIjoiSldUIiwiYWxnIjoiRWREU0EifQ.eyJpc3MiOiJkaWQ6andrOmV5Sn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2Zlc3QgMiBpbiBBdWd1c3QtTm92ZW1iZXIgb2YgMjAyMiBjb2xsYWJvcmF0ZWQgdG8gcHVzaCBpbnRlcm9wZXJhYmlsaXR5IG9mIFZDcyBpbiBlZHVjYXRpb24gZm9yd2FyZC4iLCJ0eXBlIjoiQ3JpdGVyaWEifSwiZGVzY3JpcHRpb24iOiJUaGlzIHdhbGxldCBjYW4gZGlzcGxheSB0aGlzIE9wZW4gQmFkZ2UgMy4wIiwiaWQiOiIwIiwiaW1hZ2UiOnsiaWQiOiJodHRwczovL3czYy1jY2cuZ2l0aHViLmlvL3ZjLWVkL3BsdWdmZXN0LTItMjAyMi9pbWFnZXMvSkZGLVZDLUVEVS1QTFVHRkVTVDItYmFkZ2UtaW1hZ2UucG5nIiwidHlwZSI6IkltYWdlIn0sIm5hbWUiOiJPdXIgV2FsbGV0IFBhc3NlZCBKRkYgUGx1Z2Zlc3QgIzIgMjAyMiIsInR5cGUiOiJBY2hpZXZlbWVudCJ9LCJ0eXBlIjoiQWNoaWV2ZW1lbnRTdWJqZWN0In0sIm5hbWUiOiJBY2hpZXZlbWVudCBDcmVkZW50aWFsIn0sImp0aSI6InVybjp1dWlkOmM0YTA4MDYzLTc4ZTUtNDdkNS04NGY5LTg2YTFmNjNiYzNkYSJ9.AM-lAUjCjcuQgy1QhQXctd3YrUoC2UdXvOwDHcHsi_UuHX0nt__QrYlfcwUutc9gSsz-U9SZ1e6iAGarTNVbDQ',
format: 'jwt_vc_json_ld',
format: 'jwt_vc_json-ld',
},
},
},
Expand Down Expand Up @@ -574,7 +574,7 @@ const mockData: VciMockDataStructure = {
url: 'https://launchpad.vii.electron.mattrlabs.io/oidc/v1/auth/credential',
request: {
types: ['OpenBadgeCredential'],
format: 'jwt_vc_json_ld',
format: 'jwt_vc_json-ld',
proof: {
proof_type: 'jwt',
jwt: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa3AxM3N6QUFMVFN0cDV1OGtMcnl5YW5vYWtrVWtFUGZXazdvOHY3dms0RW1KI3o2TWtwMTNzekFBTFRTdHA1dThrTHJ5eWFub2Fra1VrRVBmV2s3bzh2N3ZrNEVtSiJ9.eyJhdWQiOiJodHRwczovL2xhdW5jaHBhZC5tYXR0cmxhYnMuY29tIiwiaWF0IjoxNjgxOTE0NDgyLjUxOSwiZXhwIjoxNjgxOTE1MTQyLjUxOSwiaXNzIjoic3BoZXJlb246c3NpLXdhbGxldCIsImp0aSI6ImI5NDY1ZGE5LTY4OGYtNDdjNi04MjUwNDA0ZGNiOWI5Y2E5In0.uQ8ewOfIjy_1p_Gk6PjeEWccBJnjOca1pwbTWiCAFMQX9wlIsfeUdGtXUoHjH5_PQtpwytodx7WU456_CT9iBQ',
Expand Down Expand Up @@ -688,7 +688,7 @@ const mockData: VciMockDataStructure = {
url: 'https://oidc4vc.diwala.io/credential',
request: {
types: ['OpenBadgeCredential'],
format: 'jwt_vc_json_ld',
format: 'jwt_vc_json-ld',
proof: {
proof_type: 'jwt',
jwt: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa3AxM3N6QUFMVFN0cDV1OGtMcnl5YW5vYWtrVWtFUGZXazdvOHY3dms0RW1KI3o2TWtwMTNzekFBTFRTdHA1dThrTHJ5eWFub2Fra1VrRVBmV2s3bzh2N3ZrNEVtSiJ9.eyJhdWQiOiJodHRwczovL29pZGM0dmMuZGl3YWxhLmlvIiwiaWF0IjoxNjgxOTE1MDk1LjIwMiwiZXhwIjoxNjgxOTE1NzU1LjIwMiwiaXNzIjoic3BoZXJlb246c3NpLXdhbGxldCIsImp0aSI6IjYxN2MwM2EzLTM3MTUtNGJlMy1hYjkxNzM4MTlmYzYxNTYzIn0.KA-cHjecaYp9FSaWHkz5cqtNyhBIVT_0I7cJnpHn03T4UWFvdhjhn8Hpe-BU247enFyWOWJ6v3NQZyZgle7xBA',
Expand Down
6 changes: 3 additions & 3 deletions packages/common/lib/types/Generic.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface CredentialLogo {
[key: string]: unknown;
}

export type OID4VCICredentialFormat = 'jwt_vc_json' | 'jwt_vc_json_ld' | 'ldp_vc' /*| 'mso_mdoc'*/; // we do not support mdocs at this point
export type OID4VCICredentialFormat = 'jwt_vc_json' | 'jwt_vc_json-ld' | 'ldp_vc' /*| 'mso_mdoc'*/; // we do not support mdocs at this point

export interface NameAndLocale {
name?: string; // REQUIRED. String value of a display name for the Credential.
Expand Down Expand Up @@ -169,7 +169,7 @@ export interface CredentialRequestJwtVcJson extends CommonCredentialRequest {
}

export interface CredentialRequestJwtVcJsonLdAndLdpVc extends CommonCredentialRequest {
format: 'jwt_vc_json_ld' | 'ldp_vc';
format: 'jwt_vc_json-ld' | 'ldp_vc';
credential_definition: IssuerCredentialDefinition;
}

Expand All @@ -182,7 +182,7 @@ export interface CommonCredentialResponse {
}

export interface CredentialResponseJwtVcJsonLdAndLdpVc extends CommonCredentialResponse {
format: 'jwt_vc_json_ld' | 'ldp_vc';
format: 'jwt_vc_json-ld' | 'ldp_vc';
credential: IVerifiableCredential;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/issuer/lib/VcIssuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export class VcIssuer {
clientId?: string
jwtVerifyCallback?: JWTVerifyCallback
}) {
if (credentialRequest.format !== 'jwt_vc_json' && credentialRequest.format !== 'jwt_vc_json_ld') {
if (credentialRequest.format !== 'jwt_vc_json' && credentialRequest.format !== 'jwt_vc_json-ld') {
throw Error(`Format ${credentialRequest.format} not supported yet`)
} else if (typeof this._verifyCallback !== 'function' && typeof jwtVerifyCallback !== 'function') {
throw new Error(JWT_VERIFY_CONFIG_ERROR)
Expand Down
6 changes: 5 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a366bef

Please sign in to comment.