@sd-jwt/sd-jwt-vc 0.19.1-next.5 → 0.19.1-next.6

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ![License](https://img.shields.io/github/license/openwallet-foundation/sd-jwt-js.svg)
2
- ![NPM](https://img.shields.io/npm/v/%40sd-jwt%2Fcore)
2
+ ![NPM](https://img.shields.io/npm/v/%40sd-jwt%2Fsd-jwt-vc)
3
3
  ![Release](https://img.shields.io/github/v/release/openwallet-foundation/sd-jwt-js)
4
4
  ![Stars](https://img.shields.io/github/stars/openwallet-foundation/sd-jwt-js)
5
5
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  ### About
11
11
 
12
- SD-JWT-VC format based on the core functions
12
+ Implementation of [SD-JWT-based Verifiable Credentials (SD-JWT VC) draft-ietf-oauth-sd-jwt-vc-15](https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-15.html), built on top of `@sd-jwt/core` ([RFC 9901](https://www.rfc-editor.org/rfc/rfc9901.html)).
13
13
 
14
14
  Check the detail description in our github [repo](https://github.com/openwallet-foundation/sd-jwt-js).
15
15
 
@@ -34,8 +34,8 @@ Ensure you have Node.js installed as a prerequisite.
34
34
 
35
35
  Here's a basic example of how to use this library:
36
36
 
37
- ```jsx
38
- import { DisclosureFrame } from '@sd-jwt/sd-jwt-vc';
37
+ ```typescript
38
+ import type { DisclosureFrame } from '@sd-jwt/core';
39
39
 
40
40
  // identifier of the issuer
41
41
  const iss = 'University';
@@ -85,7 +85,7 @@ Check out more details in our [documentation](https://github.com/openwallet-foun
85
85
 
86
86
  ### Revocation
87
87
 
88
- To add revocation capabilities, you can use the `@sd-jwt/jwt-status-list` library to create a JWT Status List and include it in the SD-JWT-VC.
88
+ To add revocation capabilities, you can use the `@owf/token-status-list` library to create a JWT Status List and include it in the SD-JWT-VC.
89
89
 
90
90
  You can pass a dedicated `statusVerifier` function in the configuration to verify the signature of the payload of the JWT of the statuslist. If no function is provided, it will fallback to the verifier that is also used for the sd-jwt-vc.
91
91
 
@@ -105,7 +105,7 @@ const sdjwt = new SDJwtVcInstance({
105
105
  });
106
106
  ```
107
107
 
108
- The library will load load the type metadata format based on the `vct` value according to the [SD-JWT-VC specification](https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-08.html#name-sd-jwt-vc-type-metadata) and validate this schema.
108
+ The library will load the type metadata format based on the `vct` value according to the [SD-JWT-VC specification](https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-15.html#name-sd-jwt-vc-type-metadata) and validate this schema.
109
109
 
110
110
  Since at this point the display is not yet implemented, the library will only validate the schema and return the type metadata format. In the future the values of the type metadata can be fetched via a function call.
111
111
 
@@ -131,7 +131,7 @@ try {
131
131
  The `safeVerify()` method collects all validation errors instead of failing on the first one. This is useful when you want to show users all issues with a credential at once, including signature, status (revocation), and VCT metadata validation:
132
132
 
133
133
  ```typescript
134
- import type { SafeVerifyResult, VerificationError } from '@sd-jwt/types';
134
+ import type { SafeVerifyResult, VerificationError } from '@sd-jwt/core';
135
135
 
136
136
  const result = await sdjwt.safeVerify(presentation);
137
137
 
@@ -168,7 +168,6 @@ In addition to the [core error codes](../core/README.md#error-codes), `safeVerif
168
168
 
169
169
  ### Dependencies
170
170
 
171
- - @sd-jwt/core
172
- - @sd-jwt/types
173
- - @sd-jwt/utils
174
- - @sd-jwt/jwt-status-list
171
+ - [@sd-jwt/core](https://www.npmjs.com/package/@sd-jwt/core)
172
+ - [@owf/token-status-list](https://www.npmjs.com/package/@owf/token-status-list)
173
+ - [zod](https://www.npmjs.com/package/zod)
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { SDJWTConfig, Verifier, kbPayload, kbHeader, DisclosureFrame, SafeVerifyResult } from '@sd-jwt/types';
1
+ import { SDJWTConfig, Verifier, SdJwtPayload, kbPayload, kbHeader, SDJwtInstance, DisclosureFrame, VerifierOptions, SafeVerifyResult } from '@sd-jwt/core';
2
2
  import { z } from 'zod';
3
- import { SdJwtPayload, SDJwtInstance, VerifierOptions } from '@sd-jwt/core';
4
3
 
5
4
  declare const BackgroundImageSchema: z.ZodObject<{
6
5
  /** REQUIRED. A URI pointing to the background image. */
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { SDJWTConfig, Verifier, kbPayload, kbHeader, DisclosureFrame, SafeVerifyResult } from '@sd-jwt/types';
1
+ import { SDJWTConfig, Verifier, SdJwtPayload, kbPayload, kbHeader, SDJwtInstance, DisclosureFrame, VerifierOptions, SafeVerifyResult } from '@sd-jwt/core';
2
2
  import { z } from 'zod';
3
- import { SdJwtPayload, SDJwtInstance, VerifierOptions } from '@sd-jwt/core';
4
3
 
5
4
  declare const BackgroundImageSchema: z.ZodObject<{
6
5
  /** REQUIRED. A URI pointing to the background image. */
package/dist/index.js CHANGED
@@ -101,9 +101,8 @@ __export(index_exports, {
101
101
  module.exports = __toCommonJS(index_exports);
102
102
 
103
103
  // src/sd-jwt-vc-instance.ts
104
+ var import_token_status_list = require("@owf/token-status-list");
104
105
  var import_core = require("@sd-jwt/core");
105
- var import_jwt_status_list = require("@sd-jwt/jwt-status-list");
106
- var import_utils = require("@sd-jwt/utils");
107
106
  var import_zod2 = __toESM(require("zod"));
108
107
 
109
108
  // src/sd-jwt-vc-type-metadata-format.ts
@@ -287,9 +286,11 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
287
286
  validateReservedFields(disclosureFrame) {
288
287
  if ((disclosureFrame == null ? void 0 : disclosureFrame._sd) && Array.isArray(disclosureFrame._sd) && disclosureFrame._sd.length > 0) {
289
288
  const reservedNames = ["iss", "nbf", "exp", "cnf", "vct", "status"];
290
- const reservedNamesInDisclosureFrame = disclosureFrame._sd.filter((key) => reservedNames.includes(key));
289
+ const reservedNamesInDisclosureFrame = disclosureFrame._sd.filter(
290
+ (key) => reservedNames.includes(String(key))
291
+ );
291
292
  if (reservedNamesInDisclosureFrame.length > 0) {
292
- throw new import_utils.SDJWTException("Cannot disclose protected field");
293
+ throw new import_core.SDJWTException("Cannot disclose protected field");
293
294
  }
294
295
  }
295
296
  }
@@ -329,7 +330,7 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
329
330
  */
330
331
  statusValidator(status) {
331
332
  return __async(this, null, function* () {
332
- if (status !== 0) throw new import_utils.SDJWTException("Status is not valid");
333
+ if (status !== 0) throw new import_core.SDJWTException("Status is not valid");
333
334
  return Promise.resolve();
334
335
  });
335
336
  }
@@ -396,7 +397,8 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
396
397
  if (result) {
397
398
  try {
398
399
  yield this.verifyStatus(result, options);
399
- } catch (error) {
400
+ } catch (e) {
401
+ const error = (0, import_core.ensureError)(e);
400
402
  const errorMessage = error.message;
401
403
  if (errorMessage.includes("Status is not valid")) {
402
404
  addError("STATUS_INVALID", errorMessage, error);
@@ -414,11 +416,11 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
414
416
  if (result) {
415
417
  result.typeMetadata = resolvedTypeMetadata;
416
418
  }
417
- } catch (error) {
419
+ } catch (e) {
418
420
  addError(
419
421
  "VCT_VERIFICATION_FAILED",
420
- `VCT verification failed: ${error.message}`,
421
- error
422
+ `VCT verification failed: ${(0, import_core.ensureError)(e).message}`,
423
+ e
422
424
  );
423
425
  }
424
426
  }
@@ -455,7 +457,7 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
455
457
  return __async(this, null, function* () {
456
458
  const { payload, header } = yield import_core.SDJwt.extractJwt(encodedSDJwt);
457
459
  if (!payload) {
458
- throw new import_utils.SDJWTException("JWT payload is missing");
460
+ throw new import_core.SDJWTException("JWT payload is missing");
459
461
  }
460
462
  const result = {
461
463
  payload,
@@ -475,10 +477,10 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
475
477
  if (!integrity) return;
476
478
  const arrayBuffer = yield response.arrayBuffer();
477
479
  const alg = integrity.split("-")[0];
478
- const hashBuffer = yield this.userConfig.hasher(
479
- arrayBuffer,
480
- alg
481
- );
480
+ if (!this.userConfig.hasher) {
481
+ throw new import_core.SDJWTException("Hasher not found");
482
+ }
483
+ const hashBuffer = yield this.userConfig.hasher(arrayBuffer, alg);
482
484
  const integrityHash = integrity.split("-")[1];
483
485
  const hash = Array.from(new Uint8Array(hashBuffer)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
484
486
  if (hash !== integrityHash) {
@@ -509,7 +511,8 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
509
511
  yield this.validateIntegrity(response.clone(), url, integrity);
510
512
  const data = yield response.json();
511
513
  return data;
512
- } catch (error) {
514
+ } catch (e) {
515
+ const error = (0, import_core.ensureError)(e);
513
516
  if (error.name === "TimeoutError") {
514
517
  throw new Error(`Request to ${url} timed out`);
515
518
  }
@@ -560,7 +563,7 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
560
563
  if (baseClaim.sd && extendingClaim.sd) {
561
564
  if ((baseClaim.sd === "always" || baseClaim.sd === "never") && baseClaim.sd !== extendingClaim.sd) {
562
565
  const pathStr = JSON.stringify(extendingClaim.path);
563
- throw new import_utils.SDJWTException(
566
+ throw new import_core.SDJWTException(
564
567
  `Cannot change 'sd' property from '${baseClaim.sd}' to '${extendingClaim.sd}' for claim at path ${pathStr}`
565
568
  );
566
569
  }
@@ -632,17 +635,17 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
632
635
  var _a;
633
636
  const maxDepth = (_a = this.userConfig.maxVctExtendsDepth) != null ? _a : 5;
634
637
  if (maxDepth !== -1 && depth > maxDepth) {
635
- throw new import_utils.SDJWTException(
638
+ throw new import_core.SDJWTException(
636
639
  `Maximum VCT extends depth of ${maxDepth} exceeded`
637
640
  );
638
641
  }
639
642
  if (!parentTypeMetadata.extends) {
640
- throw new import_utils.SDJWTException(
643
+ throw new import_core.SDJWTException(
641
644
  `Type metadata for vct '${parentTypeMetadata.vct}' has no 'extends' field. Unable to resolve extended type metadata document.`
642
645
  );
643
646
  }
644
647
  if (visitedVcts.has(parentTypeMetadata.extends)) {
645
- throw new import_utils.SDJWTException(
648
+ throw new import_core.SDJWTException(
646
649
  `Circular dependency detected in VCT extends chain: ${parentTypeMetadata.extends}`
647
650
  );
648
651
  }
@@ -652,7 +655,7 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
652
655
  parentTypeMetadata["extends#integrity"]
653
656
  );
654
657
  if (!extendedTypeMetadata) {
655
- throw new import_utils.SDJWTException(
658
+ throw new import_core.SDJWTException(
656
659
  `Resolving VCT extends value '${parentTypeMetadata.extends}' resulted in an undefined result.`
657
660
  );
658
661
  }
@@ -697,7 +700,7 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends import_core.SDJwtInstance {
697
700
  if (!data) return void 0;
698
701
  const validated = TypeMetadataFormatSchema.safeParse(data);
699
702
  if (!validated.success) {
700
- throw new import_utils.SDJWTException(
703
+ throw new import_core.SDJWTException(
701
704
  `Invalid VCT type metadata for vct '${vct}':
702
705
  ${import_zod2.default.prettifyError(validated.error)}`
703
706
  );
@@ -720,16 +723,19 @@ ${import_zod2.default.prettifyError(validated.error)}`
720
723
  result.payload.status.status_list.uri
721
724
  );
722
725
  const slJWT = import_core.Jwt.fromEncode(statusListJWT);
726
+ if (!this.userConfig.verifier || !this.userConfig.statusVerifier) {
727
+ throw new import_core.SDJWTException("Verifier not found for status list JWT");
728
+ }
723
729
  yield slJWT.verify(
724
730
  (_b = this.userConfig.statusVerifier) != null ? _b : this.userConfig.verifier,
725
731
  options
726
732
  ).catch((err) => {
727
- throw new import_jwt_status_list.SLException(
733
+ throw new import_token_status_list.SLException(
728
734
  `Status List JWT verification failed: ${err.message}`,
729
735
  err.details
730
736
  );
731
737
  });
732
- const statusList = (0, import_jwt_status_list.getListFromStatusListJWT)(statusListJWT);
738
+ const statusList = (0, import_token_status_list.getListFromStatusListJWT)(statusListJWT);
733
739
  const status = statusList.getStatus(
734
740
  result.payload.status.status_list.idx
735
741
  );
package/dist/index.mjs CHANGED
@@ -54,12 +54,17 @@ var __async = (__this, __arguments, generator) => {
54
54
  };
55
55
 
56
56
  // src/sd-jwt-vc-instance.ts
57
- import { Jwt, SDJwt, SDJwtInstance } from "@sd-jwt/core";
58
57
  import {
59
58
  getListFromStatusListJWT,
60
59
  SLException
61
- } from "@sd-jwt/jwt-status-list";
62
- import { SDJWTException } from "@sd-jwt/utils";
60
+ } from "@owf/token-status-list";
61
+ import {
62
+ ensureError,
63
+ Jwt,
64
+ SDJWTException,
65
+ SDJwt,
66
+ SDJwtInstance
67
+ } from "@sd-jwt/core";
63
68
  import z2 from "zod";
64
69
 
65
70
  // src/sd-jwt-vc-type-metadata-format.ts
@@ -243,7 +248,9 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends SDJwtInstance {
243
248
  validateReservedFields(disclosureFrame) {
244
249
  if ((disclosureFrame == null ? void 0 : disclosureFrame._sd) && Array.isArray(disclosureFrame._sd) && disclosureFrame._sd.length > 0) {
245
250
  const reservedNames = ["iss", "nbf", "exp", "cnf", "vct", "status"];
246
- const reservedNamesInDisclosureFrame = disclosureFrame._sd.filter((key) => reservedNames.includes(key));
251
+ const reservedNamesInDisclosureFrame = disclosureFrame._sd.filter(
252
+ (key) => reservedNames.includes(String(key))
253
+ );
247
254
  if (reservedNamesInDisclosureFrame.length > 0) {
248
255
  throw new SDJWTException("Cannot disclose protected field");
249
256
  }
@@ -352,7 +359,8 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends SDJwtInstance {
352
359
  if (result) {
353
360
  try {
354
361
  yield this.verifyStatus(result, options);
355
- } catch (error) {
362
+ } catch (e) {
363
+ const error = ensureError(e);
356
364
  const errorMessage = error.message;
357
365
  if (errorMessage.includes("Status is not valid")) {
358
366
  addError("STATUS_INVALID", errorMessage, error);
@@ -370,11 +378,11 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends SDJwtInstance {
370
378
  if (result) {
371
379
  result.typeMetadata = resolvedTypeMetadata;
372
380
  }
373
- } catch (error) {
381
+ } catch (e) {
374
382
  addError(
375
383
  "VCT_VERIFICATION_FAILED",
376
- `VCT verification failed: ${error.message}`,
377
- error
384
+ `VCT verification failed: ${ensureError(e).message}`,
385
+ e
378
386
  );
379
387
  }
380
388
  }
@@ -431,10 +439,10 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends SDJwtInstance {
431
439
  if (!integrity) return;
432
440
  const arrayBuffer = yield response.arrayBuffer();
433
441
  const alg = integrity.split("-")[0];
434
- const hashBuffer = yield this.userConfig.hasher(
435
- arrayBuffer,
436
- alg
437
- );
442
+ if (!this.userConfig.hasher) {
443
+ throw new SDJWTException("Hasher not found");
444
+ }
445
+ const hashBuffer = yield this.userConfig.hasher(arrayBuffer, alg);
438
446
  const integrityHash = integrity.split("-")[1];
439
447
  const hash = Array.from(new Uint8Array(hashBuffer)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
440
448
  if (hash !== integrityHash) {
@@ -465,7 +473,8 @@ var SDJwtVcInstance = class _SDJwtVcInstance extends SDJwtInstance {
465
473
  yield this.validateIntegrity(response.clone(), url, integrity);
466
474
  const data = yield response.json();
467
475
  return data;
468
- } catch (error) {
476
+ } catch (e) {
477
+ const error = ensureError(e);
469
478
  if (error.name === "TimeoutError") {
470
479
  throw new Error(`Request to ${url} timed out`);
471
480
  }
@@ -676,6 +685,9 @@ ${z2.prettifyError(validated.error)}`
676
685
  result.payload.status.status_list.uri
677
686
  );
678
687
  const slJWT = Jwt.fromEncode(statusListJWT);
688
+ if (!this.userConfig.verifier || !this.userConfig.statusVerifier) {
689
+ throw new SDJWTException("Verifier not found for status list JWT");
690
+ }
679
691
  yield slJWT.verify(
680
692
  (_b = this.userConfig.statusVerifier) != null ? _b : this.userConfig.verifier,
681
693
  options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sd-jwt/sd-jwt-vc",
3
- "version": "0.19.1-next.5+7e24764",
3
+ "version": "0.19.1-next.6+2bc47b2",
4
4
  "description": "sd-jwt draft 7 implementation in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -38,14 +38,12 @@
38
38
  },
39
39
  "license": "Apache-2.0",
40
40
  "dependencies": {
41
- "@sd-jwt/core": "0.19.1-next.5+7e24764",
42
- "@sd-jwt/jwt-status-list": "0.19.1-next.5+7e24764",
43
- "@sd-jwt/utils": "0.19.1-next.5+7e24764",
41
+ "@owf/token-status-list": "^0.1.0-alpha-20260312123226",
42
+ "@sd-jwt/core": "0.19.1-next.6+2bc47b2",
44
43
  "zod": "^4.3.5"
45
44
  },
46
45
  "devDependencies": {
47
- "@sd-jwt/crypto-nodejs": "0.19.1-next.5+7e24764",
48
- "@sd-jwt/types": "0.19.1-next.5+7e24764",
46
+ "@owf/crypto": "^0.1.0-alpha-20260312123226",
49
47
  "jose": "^6.1.2",
50
48
  "msw": "^2.12.3"
51
49
  },
@@ -65,5 +63,5 @@
65
63
  "esm"
66
64
  ]
67
65
  },
68
- "gitHead": "7e2476423c6f51158d98d3cd3b78fa53166e8e81"
66
+ "gitHead": "2bc47b207fc23ea7ef340d81fac91e84c13ad58b"
69
67
  }
@@ -1,4 +1,4 @@
1
- import type { SDJWTConfig, Verifier } from '@sd-jwt/types';
1
+ import type { SDJWTConfig, Verifier } from '@sd-jwt/core';
2
2
  import type { VCTFetcher } from './sd-jwt-vc-vct';
3
3
 
4
4
  export type StatusListFetcher = (uri: string) => Promise<string>;
@@ -1,19 +1,21 @@
1
- import { Jwt, SDJwt, SDJwtInstance, type VerifierOptions } from '@sd-jwt/core';
2
1
  import {
3
2
  getListFromStatusListJWT,
4
3
  SLException,
5
4
  type StatusListJWTHeaderParameters,
6
5
  type StatusListJWTPayload,
7
- } from '@sd-jwt/jwt-status-list';
8
- import type {
9
- DisclosureFrame,
10
- Hasher,
11
- SafeVerifyResult,
12
- VerificationError,
13
- VerificationErrorCode,
14
- Verifier,
15
- } from '@sd-jwt/types';
16
- import { SDJWTException } from '@sd-jwt/utils';
6
+ } from '@owf/token-status-list';
7
+ import {
8
+ type DisclosureFrame,
9
+ ensureError,
10
+ Jwt,
11
+ type SafeVerifyResult,
12
+ SDJWTException,
13
+ SDJwt,
14
+ SDJwtInstance,
15
+ type VerificationError,
16
+ type VerificationErrorCode,
17
+ type VerifierOptions,
18
+ } from '@sd-jwt/core';
17
19
  import z from 'zod';
18
20
  import type {
19
21
  SDJWTVCConfig,
@@ -60,9 +62,9 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
60
62
  ) {
61
63
  const reservedNames = ['iss', 'nbf', 'exp', 'cnf', 'vct', 'status'];
62
64
  // check if there is any reserved names in the disclosureFrame._sd array
63
- const reservedNamesInDisclosureFrame = (
64
- disclosureFrame._sd as string[]
65
- ).filter((key) => reservedNames.includes(key));
65
+ const reservedNamesInDisclosureFrame = disclosureFrame._sd.filter((key) =>
66
+ reservedNames.includes(String(key)),
67
+ );
66
68
  if (reservedNamesInDisclosureFrame.length > 0) {
67
69
  throw new SDJWTException('Cannot disclose protected field');
68
70
  }
@@ -203,8 +205,9 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
203
205
  if (result) {
204
206
  try {
205
207
  await this.verifyStatus(result, options);
206
- } catch (error) {
207
- const errorMessage = (error as Error).message;
208
+ } catch (e) {
209
+ const error = ensureError(e);
210
+ const errorMessage = error.message;
208
211
  if (errorMessage.includes('Status is not valid')) {
209
212
  addError('STATUS_INVALID', errorMessage, error);
210
213
  } else {
@@ -223,11 +226,11 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
223
226
  if (result) {
224
227
  result.typeMetadata = resolvedTypeMetadata;
225
228
  }
226
- } catch (error) {
229
+ } catch (e) {
227
230
  addError(
228
231
  'VCT_VERIFICATION_FAILED',
229
- `VCT verification failed: ${(error as Error).message}`,
230
- error,
232
+ `VCT verification failed: ${ensureError(e).message}`,
233
+ e,
231
234
  );
232
235
  }
233
236
  }
@@ -302,10 +305,10 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
302
305
  const arrayBuffer = await response.arrayBuffer();
303
306
  const alg = integrity.split('-')[0];
304
307
  //TODO: error handling when a hasher is passed that is not supporting the required algorithm according to the spec
305
- const hashBuffer = await (this.userConfig.hasher as Hasher)(
306
- arrayBuffer,
307
- alg,
308
- );
308
+ if (!this.userConfig.hasher) {
309
+ throw new SDJWTException('Hasher not found');
310
+ }
311
+ const hashBuffer = await this.userConfig.hasher(arrayBuffer, alg);
309
312
  const integrityHash = integrity.split('-')[1];
310
313
  const hash = Array.from(new Uint8Array(hashBuffer))
311
314
  .map((byte) => byte.toString(16).padStart(2, '0'))
@@ -340,8 +343,9 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
340
343
  const data = await response.json();
341
344
 
342
345
  return data;
343
- } catch (error) {
344
- if ((error as Error).name === 'TimeoutError') {
346
+ } catch (e) {
347
+ const error = ensureError(e);
348
+ if (error.name === 'TimeoutError') {
345
349
  throw new Error(`Request to ${url} timed out`);
346
350
  }
347
351
  throw error;
@@ -638,10 +642,12 @@ export class SDJwtVcInstance extends SDJwtInstance<SdJwtVcPayload> {
638
642
  StatusListJWTPayload
639
643
  >(statusListJWT);
640
644
  // check if the status list has a valid signature. The presence of the verifier is checked in the parent class.
645
+ if (!this.userConfig.verifier || !this.userConfig.statusVerifier) {
646
+ throw new SDJWTException('Verifier not found for status list JWT');
647
+ }
641
648
  await slJWT
642
649
  .verify(
643
- this.userConfig.statusVerifier ??
644
- (this.userConfig.verifier as Verifier),
650
+ this.userConfig.statusVerifier ?? this.userConfig.verifier,
645
651
  options,
646
652
  )
647
653
  .catch((err: SLException) => {
@@ -1,16 +1,16 @@
1
1
  import Crypto from 'node:crypto';
2
- import { digest, generateSalt } from '@sd-jwt/crypto-nodejs';
2
+ import { hasher as digest, generateSalt } from '@owf/crypto';
3
3
  import {
4
4
  createHeaderAndPayload,
5
5
  StatusList,
6
6
  type StatusListJWTHeaderParameters,
7
- } from '@sd-jwt/jwt-status-list';
7
+ } from '@owf/token-status-list';
8
8
  import type {
9
9
  DisclosureFrame,
10
10
  JwtPayload,
11
11
  Signer,
12
12
  Verifier,
13
- } from '@sd-jwt/types';
13
+ } from '@sd-jwt/core';
14
14
  import { SignJWT } from 'jose';
15
15
  import { describe, expect, test } from 'vitest';
16
16
  import { SDJwtVcInstance } from '..';
@@ -1,7 +1,7 @@
1
1
  import Crypto from 'node:crypto';
2
2
  import { afterEach } from 'node:test';
3
- import { digest, generateSalt } from '@sd-jwt/crypto-nodejs';
4
- import type { DisclosureFrame, Signer, Verifier } from '@sd-jwt/types';
3
+ import { hasher as digest, generateSalt } from '@owf/crypto';
4
+ import type { DisclosureFrame, Signer, Verifier } from '@sd-jwt/core';
5
5
  import { HttpResponse, http } from 'msw';
6
6
  import { setupServer } from 'msw/node';
7
7
  import { afterAll, beforeAll, describe, expect, test, vitest } from 'vitest';
@@ -1,4 +1,4 @@
1
- import type { kbHeader, kbPayload } from '@sd-jwt/types';
1
+ import type { kbHeader, kbPayload } from '@sd-jwt/core';
2
2
  import type { SdJwtVcPayload } from './sd-jwt-vc-payload';
3
3
  import type { ResolvedTypeMetadata } from './sd-jwt-vc-type-metadata-format';
4
4
 
@@ -1,13 +1,13 @@
1
1
  import Crypto from 'node:crypto';
2
2
  import fs from 'node:fs';
3
3
  import path from 'node:path';
4
- import { digest, generateSalt } from '@sd-jwt/crypto-nodejs';
4
+ import { hasher as digest, generateSalt } from '@owf/crypto';
5
5
  import type {
6
6
  DisclosureFrame,
7
7
  PresentationFrame,
8
8
  Signer,
9
9
  Verifier,
10
- } from '@sd-jwt/types';
10
+ } from '@sd-jwt/core';
11
11
  import { describe, expect, test } from 'vitest';
12
12
  import { SDJwtVcInstance } from '../src/index';
13
13
 
package/CHANGELOG.md DELETED
@@ -1,282 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [0.19.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.18.1...v0.19.0) (2026-01-23)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * missing/updated fields in type metadata ([#359](https://github.com/openwallet-foundation/sd-jwt-js/issues/359)) ([d230a8d](https://github.com/openwallet-foundation/sd-jwt-js/commit/d230a8df2899b342b98a1d72eb606fb31de41924))
12
-
13
-
14
- ### Features
15
-
16
- * update to locale ([#358](https://github.com/openwallet-foundation/sd-jwt-js/issues/358)) ([114389e](https://github.com/openwallet-foundation/sd-jwt-js/commit/114389ef8e02b4b40d4e16585a4eea0bdb0732bc))
17
-
18
-
19
-
20
-
21
-
22
- ## [0.18.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.18.0...v0.18.1) (2026-01-14)
23
-
24
-
25
- ### Bug Fixes
26
-
27
- * keep custom properties on type metadata ([#357](https://github.com/openwallet-foundation/sd-jwt-js/issues/357)) ([2b1f0ba](https://github.com/openwallet-foundation/sd-jwt-js/commit/2b1f0badd7fcc4096e12c38dae227f0ed9d30ec3))
28
-
29
-
30
-
31
-
32
-
33
- # [0.18.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.17.1...v0.18.0) (2026-01-11)
34
-
35
-
36
- ### Bug Fixes
37
-
38
- * integrity check ([#339](https://github.com/openwallet-foundation/sd-jwt-js/issues/339)) ([4a4c1b0](https://github.com/openwallet-foundation/sd-jwt-js/commit/4a4c1b0c04615bcf0e455d51cd1b9234cbcd0d78))
39
-
40
-
41
- ### Features
42
-
43
- * allow undefined type metadata to be returned by resolver ([#338](https://github.com/openwallet-foundation/sd-jwt-js/issues/338)) ([213de7e](https://github.com/openwallet-foundation/sd-jwt-js/commit/213de7e85b9820ca638ba3362fe4deee808e236e))
44
- * validate sd jwt vc type metadata with zod ([#348](https://github.com/openwallet-foundation/sd-jwt-js/issues/348)) ([23e4beb](https://github.com/openwallet-foundation/sd-jwt-js/commit/23e4beb767451ef975709d01e471285da00f55e9))
45
-
46
-
47
-
48
-
49
-
50
- ## [0.17.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.17.0...v0.17.1) (2025-11-18)
51
-
52
- **Note:** Version bump only for package @sd-jwt/sd-jwt-vc
53
-
54
-
55
-
56
-
57
-
58
- # [0.17.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.16.0...v0.17.0) (2025-10-23)
59
-
60
- **Note:** Version bump only for package @sd-jwt/sd-jwt-vc
61
-
62
-
63
-
64
-
65
-
66
- # [0.16.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.15.1...v0.16.0) (2025-10-07)
67
-
68
-
69
- ### Bug Fixes
70
-
71
- * change repo url from labs to other one ([#323](https://github.com/openwallet-foundation/sd-jwt-js/issues/323)) ([f68c847](https://github.com/openwallet-foundation/sd-jwt-js/commit/f68c8476c2f04bb9d53acd4059b59caf271df015))
72
- * set correct url in package json ([#321](https://github.com/openwallet-foundation/sd-jwt-js/issues/321)) ([554152c](https://github.com/openwallet-foundation/sd-jwt-js/commit/554152cc819bbc3afb504b25f4a2018a92fb72f1))
73
-
74
-
75
- ### Features
76
-
77
- * Adding validation during issuance when a schema is passed ([#308](https://github.com/openwallet-foundation/sd-jwt-js/issues/308)) ([90eef6b](https://github.com/openwallet-foundation/sd-jwt-js/commit/90eef6be1c0838d334ecdef083dbb609c3812357))
78
- * updates all dependencies to latest versions + biome updates ([#324](https://github.com/openwallet-foundation/sd-jwt-js/issues/324)) ([75d5780](https://github.com/openwallet-foundation/sd-jwt-js/commit/75d5780fb53c5e2c886537b283503fc6fb088a4a))
79
-
80
-
81
-
82
-
83
-
84
- ## [0.15.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.15.0...v0.15.1) (2025-08-28)
85
-
86
-
87
- ### Bug Fixes
88
-
89
- * make iss claim optional in SD-JWT VC payload ([#310](https://github.com/openwallet-foundation/sd-jwt-js/issues/310)) ([f6275e3](https://github.com/openwallet-foundation/sd-jwt-js/commit/f6275e35e66777709321328ba50fec53e5f48c7b))
90
-
91
-
92
-
93
-
94
-
95
- # [0.15.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.14.1...v0.15.0) (2025-08-20)
96
-
97
-
98
- ### Features
99
-
100
- * Allows to pass a custom function for the status list JWT validation ([#306](https://github.com/openwallet-foundation/sd-jwt-js/issues/306)) ([25e546e](https://github.com/openwallet-foundation/sd-jwt-js/commit/25e546e1536178f8ee41b0e1b3836656fd6f48ab))
101
-
102
-
103
-
104
-
105
-
106
- ## [0.14.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.14.0...v0.14.1) (2025-08-02)
107
-
108
-
109
- ### Bug Fixes
110
-
111
- * claim type ([#300](https://github.com/openwallet-foundation/sd-jwt-js/issues/300)) ([3bab5ea](https://github.com/openwallet-foundation/sd-jwt-js/commit/3bab5eae69b6ef872209ca00b5593f96b541bc03))
112
-
113
-
114
-
115
-
116
-
117
- # [0.14.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.13.0...v0.14.0) (2025-06-30)
118
-
119
-
120
- ### Features
121
-
122
- * Add Verifier options ([#297](https://github.com/openwallet-foundation/sd-jwt-js/issues/297)) ([2a6a367](https://github.com/openwallet-foundation/sd-jwt-js/commit/2a6a3674f94742f48feaf660056226b1a54145e7))
123
-
124
-
125
-
126
-
127
-
128
- # [0.13.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.12.0...v0.13.0) (2025-06-25)
129
-
130
-
131
- ### Features
132
-
133
- * fetch VCT Metadata from SD JWT header ([#288](https://github.com/openwallet-foundation/sd-jwt-js/issues/288)) ([#294](https://github.com/openwallet-foundation/sd-jwt-js/issues/294)) ([f89ba44](https://github.com/openwallet-foundation/sd-jwt-js/commit/f89ba445aeb57ce342ec76b58a0eb6d0c090a4e9))
134
-
135
-
136
-
137
-
138
-
139
- # [0.12.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.11.0...v0.12.0) (2025-06-21)
140
-
141
-
142
- ### Bug Fixes
143
-
144
- * expose types ([#290](https://github.com/openwallet-foundation/sd-jwt-js/issues/290)) ([1b656ac](https://github.com/openwallet-foundation/sd-jwt-js/commit/1b656ac21796b715096feae439de6b48442244a9))
145
-
146
-
147
- ### Features
148
-
149
- * add missing types ([#286](https://github.com/openwallet-foundation/sd-jwt-js/issues/286)) ([506b876](https://github.com/openwallet-foundation/sd-jwt-js/commit/506b8769ac8e0082ad30544338eace2d0df34294))
150
-
151
-
152
-
153
-
154
-
155
- # [0.11.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.10.0...v0.11.0) (2025-06-17)
156
-
157
-
158
- ### Features
159
-
160
- * SD JWT Instances VCT Metadata get separated from verify ([#285](https://github.com/openwallet-foundation/sd-jwt-js/issues/285)) ([bc91fd7](https://github.com/openwallet-foundation/sd-jwt-js/commit/bc91fd71f7d721298ad5c08d4379bc870903f65f))
161
-
162
-
163
-
164
-
165
-
166
- # [0.10.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.2...v0.10.0) (2025-03-24)
167
-
168
- **Note:** Version bump only for package @sd-jwt/sd-jwt-vc
169
-
170
-
171
-
172
-
173
-
174
- ## [0.9.2](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.1...v0.9.2) (2025-01-29)
175
-
176
- **Note:** Version bump only for package @sd-jwt/sd-jwt-vc
177
-
178
-
179
-
180
-
181
-
182
- ## [0.9.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.9.0...v0.9.1) (2024-12-13)
183
-
184
- **Note:** Version bump only for package @sd-jwt/sd-jwt-vc
185
-
186
-
187
-
188
-
189
-
190
- # [0.9.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.8.0...v0.9.0) (2024-12-10)
191
-
192
-
193
- ### Features
194
-
195
- * align type metadata fetching with sd-jwt-vc draft 08 ([#260](https://github.com/openwallet-foundation/sd-jwt-js/issues/260)) ([2358c75](https://github.com/openwallet-foundation/sd-jwt-js/commit/2358c759887ee29b4c35a3ee0e93ebd8e8c26545))
196
-
197
-
198
-
199
-
200
-
201
- # [0.8.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.2...v0.8.0) (2024-11-26)
202
-
203
-
204
- ### Bug Fixes
205
-
206
- * check if the header includes the string ([#244](https://github.com/openwallet-foundation/sd-jwt-js/issues/244)) ([8a48bb5](https://github.com/openwallet-foundation/sd-jwt-js/commit/8a48bb57fcf9bbad349f349b0aa1ffd997c86bb2))
207
-
208
-
209
- ### Features
210
-
211
- * align media type with sd-jwt-vc draft 06 ([#256](https://github.com/openwallet-foundation/sd-jwt-js/issues/256)) ([1aa3aea](https://github.com/openwallet-foundation/sd-jwt-js/commit/1aa3aea86213e75328975e34d9bf71410fc7a12a))
212
-
213
-
214
-
215
-
216
-
217
- ## [0.7.2](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.1...v0.7.2) (2024-07-19)
218
-
219
- **Note:** Version bump only for package @sd-jwt/sd-jwt-vc
220
-
221
-
222
-
223
-
224
-
225
- ## [0.7.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.7.0...v0.7.1) (2024-05-21)
226
-
227
- **Note:** Version bump only for package @sd-jwt/sd-jwt-vc
228
-
229
-
230
-
231
-
232
-
233
- # [0.7.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.6.1...v0.7.0) (2024-05-13)
234
-
235
- **Note:** Version bump only for package @sd-jwt/sd-jwt-vc
236
-
237
-
238
-
239
-
240
-
241
- ## [0.6.1](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.6.0...v0.6.1) (2024-03-18)
242
-
243
-
244
- ### Bug Fixes
245
-
246
- * **sd-jwt-vc:** improve alignment with draft-03 ([#175](https://github.com/openwallet-foundation/sd-jwt-js/issues/175)) ([bcd7d6e](https://github.com/openwallet-foundation/sd-jwt-js/commit/bcd7d6e40fff938d06425d69297274400ab9e8a6))
247
-
248
-
249
-
250
-
251
-
252
- # [0.6.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.5.0...v0.6.0) (2024-03-12)
253
-
254
- **Note:** Version bump only for package @sd-jwt/sd-jwt-vc
255
-
256
-
257
-
258
-
259
-
260
- # [0.5.0](https://github.com/openwallet-foundation/sd-jwt-js/compare/v0.4.0...v0.5.0) (2024-03-11)
261
-
262
-
263
- ### Features
264
-
265
- * make _digest value public in disclosure ([#151](https://github.com/openwallet-foundation/sd-jwt-js/issues/151)) ([7a3fbd7](https://github.com/openwallet-foundation/sd-jwt-js/commit/7a3fbd7db19b6501978340c972b171743d287285))
266
-
267
-
268
-
269
-
270
-
271
- # 0.4.0 (2024-03-08)
272
-
273
-
274
- ### Bug Fixes
275
-
276
- * change SDJwtPayload to SdJwtPayload ([9f06ef7](https://github.com/openwallet-foundation/sd-jwt-js/commit/9f06ef7bd31a1dff4e9bf988e425200a5e1aa82d))
277
- * make sdjwt instance non abstract ([#122](https://github.com/openwallet-foundation/sd-jwt-js/issues/122)) ([e85aae8](https://github.com/openwallet-foundation/sd-jwt-js/commit/e85aae89910f5d9468e29ef14ef3b3d3215b86fd))
278
-
279
-
280
- ### Features
281
-
282
- * add new package for sd-jwt-vc ([ed99188](https://github.com/openwallet-foundation/sd-jwt-js/commit/ed99188f13184d58db64b4211e39fb67f3f78cb5))