@sd-jwt/sd-jwt-vc 0.17.2-next.2 → 0.17.2-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +7 -7
- package/src/sd-jwt-vc-instance.ts +4 -4
- package/src/sd-jwt-vc-vct.ts +1 -1
- package/src/test/index.spec.ts +2 -2
- package/test/app-e2e.spec.ts +13 -7
- package/test/array_data_types.json +1 -1
- package/test/array_full_sd.json +1 -1
- package/test/array_in_sd.json +1 -1
- package/test/array_nested_in_plain.json +1 -1
- package/test/array_none_disclosed.json +1 -1
- package/test/array_of_nulls.json +1 -1
- package/test/array_of_objects.json +1 -1
- package/test/array_of_scalars.json +1 -1
- package/test/array_recursive_sd.json +1 -1
- package/test/array_recursive_sd_some_disclosed.json +1 -1
- package/test/complex.json +1 -1
- package/test/header_mod.json +1 -1
- package/test/json_serialization.json +1 -1
- package/test/key_binding.json +1 -1
- package/test/no_sd.json +1 -1
- package/test/object_data_types.json +1 -1
- package/test/recursions.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -133,7 +133,7 @@ type TypeMetadataFormat = {
|
|
|
133
133
|
claims?: Claim[];
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
type VcTFetcher = (uri: string, integrity?: string) => Promise<TypeMetadataFormat>;
|
|
136
|
+
type VcTFetcher = (uri: string, integrity?: string) => Promise<TypeMetadataFormat | undefined>;
|
|
137
137
|
|
|
138
138
|
type StatusListFetcher = (uri: string) => Promise<string>;
|
|
139
139
|
type StatusValidator = (status: number) => Promise<void>;
|
|
@@ -215,7 +215,7 @@ declare class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
215
215
|
* @param encodedSDJwt
|
|
216
216
|
* @returns
|
|
217
217
|
*/
|
|
218
|
-
getVct(encodedSDJwt: string): Promise<TypeMetadataFormat>;
|
|
218
|
+
getVct(encodedSDJwt: string): Promise<TypeMetadataFormat | undefined>;
|
|
219
219
|
/**
|
|
220
220
|
* Validates the integrity of the response if the integrity is passed. If the integrity does not match, an error is thrown.
|
|
221
221
|
* @param integrity
|
package/dist/index.d.ts
CHANGED
|
@@ -133,7 +133,7 @@ type TypeMetadataFormat = {
|
|
|
133
133
|
claims?: Claim[];
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
type VcTFetcher = (uri: string, integrity?: string) => Promise<TypeMetadataFormat>;
|
|
136
|
+
type VcTFetcher = (uri: string, integrity?: string) => Promise<TypeMetadataFormat | undefined>;
|
|
137
137
|
|
|
138
138
|
type StatusListFetcher = (uri: string) => Promise<string>;
|
|
139
139
|
type StatusValidator = (status: number) => Promise<void>;
|
|
@@ -215,7 +215,7 @@ declare class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
215
215
|
* @param encodedSDJwt
|
|
216
216
|
* @returns
|
|
217
217
|
*/
|
|
218
|
-
getVct(encodedSDJwt: string): Promise<TypeMetadataFormat>;
|
|
218
|
+
getVct(encodedSDJwt: string): Promise<TypeMetadataFormat | undefined>;
|
|
219
219
|
/**
|
|
220
220
|
* Validates the integrity of the response if the integrity is passed. If the integrity does not match, an error is thrown.
|
|
221
221
|
* @param integrity
|
package/dist/index.js
CHANGED
|
@@ -218,7 +218,7 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
|
|
|
218
218
|
verifyVct(result) {
|
|
219
219
|
return __async(this, null, function* () {
|
|
220
220
|
const typeMetadataFormat = yield this.fetchVct(result);
|
|
221
|
-
if (typeMetadataFormat.extends) {
|
|
221
|
+
if (typeMetadataFormat == null ? void 0 : typeMetadataFormat.extends) {
|
|
222
222
|
}
|
|
223
223
|
return typeMetadataFormat;
|
|
224
224
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -196,7 +196,7 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends SDJwtInstance {
|
|
|
196
196
|
verifyVct(result) {
|
|
197
197
|
return __async(this, null, function* () {
|
|
198
198
|
const typeMetadataFormat = yield this.fetchVct(result);
|
|
199
|
-
if (typeMetadataFormat.extends) {
|
|
199
|
+
if (typeMetadataFormat == null ? void 0 : typeMetadataFormat.extends) {
|
|
200
200
|
}
|
|
201
201
|
return typeMetadataFormat;
|
|
202
202
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sd-jwt/sd-jwt-vc",
|
|
3
|
-
"version": "0.17.2-next.
|
|
3
|
+
"version": "0.17.2-next.4+213de7e",
|
|
4
4
|
"description": "sd-jwt draft 7 implementation in typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
},
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@sd-jwt/core": "0.17.2-next.
|
|
42
|
-
"@sd-jwt/jwt-status-list": "0.17.2-next.
|
|
43
|
-
"@sd-jwt/utils": "0.17.2-next.
|
|
41
|
+
"@sd-jwt/core": "0.17.2-next.4+213de7e",
|
|
42
|
+
"@sd-jwt/jwt-status-list": "0.17.2-next.4+213de7e",
|
|
43
|
+
"@sd-jwt/utils": "0.17.2-next.4+213de7e"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@sd-jwt/crypto-nodejs": "0.17.2-next.
|
|
47
|
-
"@sd-jwt/types": "0.17.2-next.
|
|
46
|
+
"@sd-jwt/crypto-nodejs": "0.17.2-next.4+213de7e",
|
|
47
|
+
"@sd-jwt/types": "0.17.2-next.4+213de7e",
|
|
48
48
|
"jose": "^6.1.2",
|
|
49
49
|
"msw": "^2.12.3"
|
|
50
50
|
},
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"esm"
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "213de7e85b9820ca638ba3362fe4deee808e236e"
|
|
68
68
|
}
|
|
@@ -134,7 +134,7 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
134
134
|
* @param encodedSDJwt
|
|
135
135
|
* @returns
|
|
136
136
|
*/
|
|
137
|
-
async getVct(encodedSDJwt: string): Promise<TypeMetadataFormat> {
|
|
137
|
+
async getVct(encodedSDJwt: string): Promise<TypeMetadataFormat | undefined> {
|
|
138
138
|
// Call the parent class's verify method
|
|
139
139
|
const { payload, header } = await SDJwt.extractJwt<
|
|
140
140
|
Record<string, unknown>,
|
|
@@ -168,7 +168,7 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
168
168
|
// validate the integrity of the response according to https://www.w3.org/TR/SRI/
|
|
169
169
|
const arrayBuffer = await response.arrayBuffer();
|
|
170
170
|
const alg = integrity.split('-')[0];
|
|
171
|
-
//TODO: error handling when a hasher is passed that is not supporting the required algorithm
|
|
171
|
+
//TODO: error handling when a hasher is passed that is not supporting the required algorithm according to the spec
|
|
172
172
|
const hashBuffer = await (this.userConfig.hasher as Hasher)(
|
|
173
173
|
arrayBuffer,
|
|
174
174
|
alg,
|
|
@@ -221,7 +221,7 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
221
221
|
): Promise<TypeMetadataFormat | undefined> {
|
|
222
222
|
const typeMetadataFormat = await this.fetchVct(result);
|
|
223
223
|
|
|
224
|
-
if (typeMetadataFormat
|
|
224
|
+
if (typeMetadataFormat?.extends) {
|
|
225
225
|
// implement based on https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-08.html#name-extending-type-metadata
|
|
226
226
|
//TODO: needs to be implemented. Unclear at this point which values will overwrite the values from the extended type metadata format
|
|
227
227
|
}
|
|
@@ -236,7 +236,7 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
236
236
|
*/
|
|
237
237
|
private async fetchVct(
|
|
238
238
|
result: VerificationResult,
|
|
239
|
-
): Promise<TypeMetadataFormat> {
|
|
239
|
+
): Promise<TypeMetadataFormat | undefined> {
|
|
240
240
|
if (!result.payload.vct) {
|
|
241
241
|
throw new SDJWTException('vct claim is required');
|
|
242
242
|
}
|
package/src/sd-jwt-vc-vct.ts
CHANGED
package/src/test/index.spec.ts
CHANGED
|
@@ -87,7 +87,7 @@ describe('App', () => {
|
|
|
87
87
|
expectedPayload,
|
|
88
88
|
disclosureFrame as unknown as DisclosureFrame<SdJwtVcPayload>,
|
|
89
89
|
);
|
|
90
|
-
expect(encodedSdjwt).rejects.toThrowError();
|
|
90
|
+
await expect(encodedSdjwt).rejects.toThrowError();
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
|
|
@@ -149,7 +149,7 @@ describe('Revocation', () => {
|
|
|
149
149
|
const expectedPayload: SdJwtVcPayload = { iat, iss, vct, ...claims };
|
|
150
150
|
const encodedSdjwt = await sdjwt.issue(expectedPayload);
|
|
151
151
|
const result = sdjwt.verify(encodedSdjwt);
|
|
152
|
-
expect(result).rejects.toThrowError('Status is not valid');
|
|
152
|
+
await expect(result).rejects.toThrowError('Status is not valid');
|
|
153
153
|
});
|
|
154
154
|
|
|
155
155
|
test('test to fetch the statuslist', async () => {
|
package/test/app-e2e.spec.ts
CHANGED
|
@@ -145,7 +145,9 @@ describe('App', () => {
|
|
|
145
145
|
});
|
|
146
146
|
|
|
147
147
|
const requiredClaimKeys = ['firstname', 'id', 'data.ssn'];
|
|
148
|
-
const verified = await sdjwt.verify(encodedSdjwt,
|
|
148
|
+
const verified = await sdjwt.verify(encodedSdjwt, {
|
|
149
|
+
requiredClaimKeys,
|
|
150
|
+
});
|
|
149
151
|
expect(verified).toBeDefined();
|
|
150
152
|
});
|
|
151
153
|
|
|
@@ -239,7 +241,7 @@ async function JSONtest(filename: string) {
|
|
|
239
241
|
payload,
|
|
240
242
|
});
|
|
241
243
|
|
|
242
|
-
const presentedSDJwt = await sdjwt.present
|
|
244
|
+
const presentedSDJwt = await sdjwt.present(
|
|
243
245
|
encodedSdjwt,
|
|
244
246
|
test.presentationFrames,
|
|
245
247
|
);
|
|
@@ -249,13 +251,15 @@ async function JSONtest(filename: string) {
|
|
|
249
251
|
const presentationClaims = await sdjwt.getClaims(presentedSDJwt);
|
|
250
252
|
|
|
251
253
|
expect(presentationClaims).toEqual({
|
|
252
|
-
...test.
|
|
254
|
+
...test.presentedClaims,
|
|
253
255
|
iat,
|
|
254
256
|
iss,
|
|
255
257
|
vct,
|
|
256
258
|
});
|
|
257
259
|
|
|
258
|
-
const verified = await sdjwt.verify(encodedSdjwt,
|
|
260
|
+
const verified = await sdjwt.verify(encodedSdjwt, {
|
|
261
|
+
requiredClaimKeys: test.requiredClaimKeys,
|
|
262
|
+
});
|
|
259
263
|
|
|
260
264
|
expect(verified).toBeDefined();
|
|
261
265
|
expect(verified).toStrictEqual({
|
|
@@ -267,9 +271,11 @@ async function JSONtest(filename: string) {
|
|
|
267
271
|
|
|
268
272
|
type TestJson = {
|
|
269
273
|
claims: object;
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
274
|
+
// biome-ignore lint/complexity/noBannedTypes: we want an empty object in this case
|
|
275
|
+
disclosureFrame: DisclosureFrame<{}>;
|
|
276
|
+
// biome-ignore lint/complexity/noBannedTypes: we want an empty object in this case
|
|
277
|
+
presentationFrames: PresentationFrame<{}>;
|
|
278
|
+
presentedClaims: object;
|
|
273
279
|
requiredClaimKeys: string[];
|
|
274
280
|
};
|
|
275
281
|
|
package/test/array_full_sd.json
CHANGED
package/test/array_in_sd.json
CHANGED
package/test/array_of_nulls.json
CHANGED
package/test/complex.json
CHANGED
package/test/header_mod.json
CHANGED
package/test/key_binding.json
CHANGED
package/test/no_sd.json
CHANGED