@twin.org/identity-models 0.0.1-next.38 → 0.0.1-next.39

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.
@@ -144,11 +144,11 @@ class VerificationHelper {
144
144
  if (!core.Is.object(jwtHeader) || !core.Is.object(jwtPayload) || !core.Is.uint8Array(jwtSignature)) {
145
145
  throw new core.GeneralError(VerificationHelper.CLASS_NAME, "jwtDecodeFailed");
146
146
  }
147
- const iss = jwtPayload?.iss;
148
- const kid = jwtPayload?.kid;
147
+ const iss = jwtHeader?.iss;
148
+ const kid = jwtHeader?.kid;
149
149
  core.Guards.stringValue(VerificationHelper.CLASS_NAME, "iss", iss);
150
150
  core.Guards.stringValue(VerificationHelper.CLASS_NAME, "kid", kid);
151
- const didDocument = await resolver.resolveDocument(iss);
151
+ const didDocument = await resolver.identityResolve(iss);
152
152
  const jwk = DocumentHelper.getJwk(didDocument, kid);
153
153
  const publicKey = await web.Jwk.toCryptoKey(jwk);
154
154
  return web.Jwt.verify(jwt, publicKey);
@@ -180,7 +180,7 @@ class VerificationHelper {
180
180
  document = documentCache[proofVerificationMethod.id];
181
181
  }
182
182
  else {
183
- document = await resolver.resolveDocument(proofVerificationMethod.id);
183
+ document = await resolver.identityResolve(proofVerificationMethod.id);
184
184
  documentCache[proofVerificationMethod.id] = document;
185
185
  }
186
186
  const verificationJwk = await DocumentHelper.getJwk(document, proofVerificationMethod.id);
@@ -142,11 +142,11 @@ class VerificationHelper {
142
142
  if (!Is.object(jwtHeader) || !Is.object(jwtPayload) || !Is.uint8Array(jwtSignature)) {
143
143
  throw new GeneralError(VerificationHelper.CLASS_NAME, "jwtDecodeFailed");
144
144
  }
145
- const iss = jwtPayload?.iss;
146
- const kid = jwtPayload?.kid;
145
+ const iss = jwtHeader?.iss;
146
+ const kid = jwtHeader?.kid;
147
147
  Guards.stringValue(VerificationHelper.CLASS_NAME, "iss", iss);
148
148
  Guards.stringValue(VerificationHelper.CLASS_NAME, "kid", kid);
149
- const didDocument = await resolver.resolveDocument(iss);
149
+ const didDocument = await resolver.identityResolve(iss);
150
150
  const jwk = DocumentHelper.getJwk(didDocument, kid);
151
151
  const publicKey = await Jwk.toCryptoKey(jwk);
152
152
  return Jwt.verify(jwt, publicKey);
@@ -178,7 +178,7 @@ class VerificationHelper {
178
178
  document = documentCache[proofVerificationMethod.id];
179
179
  }
180
180
  else {
181
- document = await resolver.resolveDocument(proofVerificationMethod.id);
181
+ document = await resolver.identityResolve(proofVerificationMethod.id);
182
182
  documentCache[proofVerificationMethod.id] = document;
183
183
  }
184
184
  const verificationJwk = await DocumentHelper.getJwk(document, proofVerificationMethod.id);
@@ -1,6 +1,6 @@
1
1
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
2
  import { type IJwtHeader, type IJwtPayload } from "@twin.org/web";
3
- import type { IIdentityResolverConnector } from "../models/IIdentityResolverConnector";
3
+ import type { IIdentityResolverComponent } from "../models/IIdentityResolverComponent";
4
4
  /**
5
5
  * Helper methods for verification.
6
6
  */
@@ -15,7 +15,7 @@ export declare class VerificationHelper {
15
15
  * @param jwt The token to verify.
16
16
  * @returns The decoded payload.
17
17
  */
18
- static verifyJwt<T extends IJwtHeader, U extends IJwtPayload>(resolver: IIdentityResolverConnector, jwt: string): Promise<{
18
+ static verifyJwt<T extends IJwtHeader, U extends IJwtPayload>(resolver: IIdentityResolverComponent, jwt: string): Promise<{
19
19
  header: T;
20
20
  payload: U;
21
21
  }>;
@@ -25,5 +25,5 @@ export declare class VerificationHelper {
25
25
  * @param secureDocument The secure document to verify.
26
26
  * @returns True if the verification is successful.
27
27
  */
28
- static verifyProof(resolver: IIdentityResolverConnector, secureDocument: IJsonLdNodeObject): Promise<boolean>;
28
+ static verifyProof(resolver: IIdentityResolverComponent, secureDocument: IJsonLdNodeObject): Promise<boolean>;
29
29
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/identity-service-models - Changelog
2
2
 
3
- ## v0.0.1-next.38
3
+ ## v0.0.1-next.39
4
4
 
5
5
  - Initial Release
@@ -38,7 +38,7 @@ Verified the JWT.
38
38
 
39
39
  ##### resolver
40
40
 
41
- [`IIdentityResolverConnector`](../interfaces/IIdentityResolverConnector.md)
41
+ [`IIdentityResolverComponent`](../interfaces/IIdentityResolverComponent.md)
42
42
 
43
43
  The resolver to use for finding the document.
44
44
 
@@ -66,7 +66,7 @@ Verified the proof for the document e.g. verifiable credential.
66
66
 
67
67
  ##### resolver
68
68
 
69
- [`IIdentityResolverConnector`](../interfaces/IIdentityResolverConnector.md)
69
+ [`IIdentityResolverComponent`](../interfaces/IIdentityResolverComponent.md)
70
70
 
71
71
  The resolver to use for finding the document.
72
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-models",
3
- "version": "0.0.1-next.38",
3
+ "version": "0.0.1-next.39",
4
4
  "description": "Models which define the structure of the contracts and connectors",
5
5
  "repository": {
6
6
  "type": "git",