@sd-jwt/sd-jwt-vc 0.17.2-next.3 → 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 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+8d5a743",
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.3+8d5a743",
42
- "@sd-jwt/jwt-status-list": "0.17.2-next.3+8d5a743",
43
- "@sd-jwt/utils": "0.17.2-next.3+8d5a743"
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.3+8d5a743",
47
- "@sd-jwt/types": "0.17.2-next.3+8d5a743",
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": "8d5a743f1ff5ae51adea37509b5c24a6c09ede8a"
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 acording to the spec
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.extends) {
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
  }
@@ -3,4 +3,4 @@ import type { TypeMetadataFormat } from './sd-jwt-vc-type-metadata-format';
3
3
  export type VcTFetcher = (
4
4
  uri: string,
5
5
  integrity?: string,
6
- ) => Promise<TypeMetadataFormat>;
6
+ ) => Promise<TypeMetadataFormat | undefined>;