@sd-jwt/sd-jwt-vc 0.19.1-next.11 → 0.19.1-next.13
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 +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +3 -3
- package/src/sd-jwt-vc-instance.ts +7 -5
- package/src/test/index.spec.ts +19 -1
package/dist/index.d.mts
CHANGED
|
@@ -986,10 +986,10 @@ declare class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
986
986
|
protected userConfig: SDJWTVCConfig;
|
|
987
987
|
constructor(userConfig?: SDJWTVCConfig);
|
|
988
988
|
/**
|
|
989
|
-
* Validates if the
|
|
989
|
+
* Validates if the disclosure frame attempts to selectively disclose protected SD-JWT-VC claims.
|
|
990
990
|
* @param disclosureFrame
|
|
991
991
|
*/
|
|
992
|
-
protected
|
|
992
|
+
protected validateDisclosureFrame(disclosureFrame?: DisclosureFrame<SdJwtVcPayload>): void;
|
|
993
993
|
/**
|
|
994
994
|
* Fetches the status list from the uri with a timeout of 10 seconds.
|
|
995
995
|
* @param uri The URI to fetch from.
|
package/dist/index.d.ts
CHANGED
|
@@ -986,10 +986,10 @@ declare class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
986
986
|
protected userConfig: SDJWTVCConfig;
|
|
987
987
|
constructor(userConfig?: SDJWTVCConfig);
|
|
988
988
|
/**
|
|
989
|
-
* Validates if the
|
|
989
|
+
* Validates if the disclosure frame attempts to selectively disclose protected SD-JWT-VC claims.
|
|
990
990
|
* @param disclosureFrame
|
|
991
991
|
*/
|
|
992
|
-
protected
|
|
992
|
+
protected validateDisclosureFrame(disclosureFrame?: DisclosureFrame<SdJwtVcPayload>): void;
|
|
993
993
|
/**
|
|
994
994
|
* Fetches the status list from the uri with a timeout of 10 seconds.
|
|
995
995
|
* @param uri The URI to fetch from.
|
package/dist/index.js
CHANGED
|
@@ -280,10 +280,10 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
|
-
* Validates if the
|
|
283
|
+
* Validates if the disclosure frame attempts to selectively disclose protected SD-JWT-VC claims.
|
|
284
284
|
* @param disclosureFrame
|
|
285
285
|
*/
|
|
286
|
-
|
|
286
|
+
validateDisclosureFrame(disclosureFrame) {
|
|
287
287
|
if ((disclosureFrame == null ? void 0 : disclosureFrame._sd) && Array.isArray(disclosureFrame._sd) && disclosureFrame._sd.length > 0) {
|
|
288
288
|
const reservedNames = ["iss", "nbf", "exp", "cnf", "vct", "status"];
|
|
289
289
|
const reservedNamesInDisclosureFrame = disclosureFrame._sd.filter(
|
|
@@ -716,6 +716,9 @@ ${import_zod2.default.prettifyError(validated.error)}`
|
|
|
716
716
|
verifyStatus(result, options) {
|
|
717
717
|
return __async(this, null, function* () {
|
|
718
718
|
var _a, _b, _c;
|
|
719
|
+
if (options == null ? void 0 : options.disableStatusVerification) {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
719
722
|
if (result.payload.status) {
|
|
720
723
|
if (result.payload.status.status_list) {
|
|
721
724
|
const fetcher = (_a = this.userConfig.statusListFetcher) != null ? _a : this.statusListFetcher.bind(this);
|
package/dist/index.mjs
CHANGED
|
@@ -242,10 +242,10 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends SDJwtInstance {
|
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
/**
|
|
245
|
-
* Validates if the
|
|
245
|
+
* Validates if the disclosure frame attempts to selectively disclose protected SD-JWT-VC claims.
|
|
246
246
|
* @param disclosureFrame
|
|
247
247
|
*/
|
|
248
|
-
|
|
248
|
+
validateDisclosureFrame(disclosureFrame) {
|
|
249
249
|
if ((disclosureFrame == null ? void 0 : disclosureFrame._sd) && Array.isArray(disclosureFrame._sd) && disclosureFrame._sd.length > 0) {
|
|
250
250
|
const reservedNames = ["iss", "nbf", "exp", "cnf", "vct", "status"];
|
|
251
251
|
const reservedNamesInDisclosureFrame = disclosureFrame._sd.filter(
|
|
@@ -678,6 +678,9 @@ ${z2.prettifyError(validated.error)}`
|
|
|
678
678
|
verifyStatus(result, options) {
|
|
679
679
|
return __async(this, null, function* () {
|
|
680
680
|
var _a, _b, _c;
|
|
681
|
+
if (options == null ? void 0 : options.disableStatusVerification) {
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
681
684
|
if (result.payload.status) {
|
|
682
685
|
if (result.payload.status.status_list) {
|
|
683
686
|
const fetcher = (_a = this.userConfig.statusListFetcher) != null ? _a : this.statusListFetcher.bind(this);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sd-jwt/sd-jwt-vc",
|
|
3
|
-
"version": "0.19.1-next.
|
|
3
|
+
"version": "0.19.1-next.13+3d8a72a",
|
|
4
4
|
"description": "sd-jwt draft 7 implementation in typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@owf/token-status-list": "^0.1.0-alpha-20260312123226",
|
|
42
|
-
"@sd-jwt/core": "0.19.1-next.
|
|
42
|
+
"@sd-jwt/core": "0.19.1-next.13+3d8a72a",
|
|
43
43
|
"zod": "^4.3.5"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"esm"
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "3d8a72a0a279d67439db038c9c2b52621568b866"
|
|
67
67
|
}
|
|
@@ -48,20 +48,18 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* Validates if the
|
|
51
|
+
* Validates if the disclosure frame attempts to selectively disclose protected SD-JWT-VC claims.
|
|
52
52
|
* @param disclosureFrame
|
|
53
53
|
*/
|
|
54
|
-
protected
|
|
55
|
-
disclosureFrame
|
|
54
|
+
protected validateDisclosureFrame(
|
|
55
|
+
disclosureFrame?: DisclosureFrame<SdJwtVcPayload>,
|
|
56
56
|
): void {
|
|
57
|
-
//validate disclosureFrame according to https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-08.html#section-3.2.2.2
|
|
58
57
|
if (
|
|
59
58
|
disclosureFrame?._sd &&
|
|
60
59
|
Array.isArray(disclosureFrame._sd) &&
|
|
61
60
|
disclosureFrame._sd.length > 0
|
|
62
61
|
) {
|
|
63
62
|
const reservedNames = ['iss', 'nbf', 'exp', 'cnf', 'vct', 'status'];
|
|
64
|
-
// check if there is any reserved names in the disclosureFrame._sd array
|
|
65
63
|
const reservedNamesInDisclosureFrame = disclosureFrame._sd.filter((key) =>
|
|
66
64
|
reservedNames.includes(String(key)),
|
|
67
65
|
);
|
|
@@ -625,6 +623,10 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
|
|
|
625
623
|
result: VerificationResult,
|
|
626
624
|
options?: VerifierOptions,
|
|
627
625
|
): Promise<void> {
|
|
626
|
+
if (options?.disableStatusVerification) {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
|
|
628
630
|
if (result.payload.status) {
|
|
629
631
|
//checks if a status field is present in the payload based on https://www.ietf.org/archive/id/draft-ietf-oauth-status-list-02.html
|
|
630
632
|
if (result.payload.status.status_list) {
|
package/src/test/index.spec.ts
CHANGED
|
@@ -120,7 +120,7 @@ describe('Revocation', () => {
|
|
|
120
120
|
},
|
|
121
121
|
});
|
|
122
122
|
|
|
123
|
-
test('Test with a non
|
|
123
|
+
test('Test with a non revoked credential', async () => {
|
|
124
124
|
const claims = {
|
|
125
125
|
firstname: 'John',
|
|
126
126
|
status: {
|
|
@@ -152,6 +152,24 @@ describe('Revocation', () => {
|
|
|
152
152
|
await expect(result).rejects.toThrowError('Status is not valid');
|
|
153
153
|
});
|
|
154
154
|
|
|
155
|
+
test('Test with a revoked credential but status verification disabled', async () => {
|
|
156
|
+
const claims = {
|
|
157
|
+
firstname: 'John',
|
|
158
|
+
status: {
|
|
159
|
+
status_list: {
|
|
160
|
+
uri: 'https://example.com/status-list',
|
|
161
|
+
idx: 1,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
const expectedPayload: SdJwtVcPayload = { iat, iss, vct, ...claims };
|
|
166
|
+
const encodedSdjwt = await sdjwt.issue(expectedPayload);
|
|
167
|
+
const result = await sdjwt.verify(encodedSdjwt, {
|
|
168
|
+
disableStatusVerification: true,
|
|
169
|
+
});
|
|
170
|
+
expect(result).toBeDefined();
|
|
171
|
+
});
|
|
172
|
+
|
|
155
173
|
test('test to fetch the statuslist', async () => {
|
|
156
174
|
//TODO: not implemented yet since we need to either mock the fetcher or use a real fetcher
|
|
157
175
|
});
|