@twin.org/identity-connector-entity-storage 0.0.1-next.10 → 0.0.1-next.12

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.
@@ -412,12 +412,11 @@ class EntityStorageIdentityConnector {
412
412
  throw new core.GeneralError(this.CLASS_NAME, "publicKeyJwkMissing");
413
413
  }
414
414
  const revocationService = issuerDidDocument.service?.find(s => s.id.endsWith("#revocation"));
415
+ const credentialClone = core.ObjectHelper.clone(credential);
415
416
  const finalTypes = [standardsW3cDid.DidTypes.VerifiableCredential];
416
- const credContext = core.ObjectHelper.extractProperty(credential, [
417
- "@context"
418
- ]);
419
- const credId = core.ObjectHelper.extractProperty(credential, ["@id", "id"], false);
420
- const credType = core.ObjectHelper.extractProperty(credential, ["@type", "type"]);
417
+ const credContext = core.ObjectHelper.extractProperty(credentialClone, ["@context"]);
418
+ const credId = core.ObjectHelper.extractProperty(credentialClone, ["@id", "id"], false);
419
+ const credType = core.ObjectHelper.extractProperty(credentialClone, ["@type", "type"]);
421
420
  if (core.Is.stringValue(credType)) {
422
421
  finalTypes.push(credType);
423
422
  }
@@ -425,7 +424,7 @@ class EntityStorageIdentityConnector {
425
424
  "@context": dataJsonLd.JsonLdProcessor.combineContexts(standardsW3cDid.DidContexts.ContextV1, credContext) ?? null,
426
425
  id,
427
426
  type: finalTypes,
428
- credentialSubject: credential,
427
+ credentialSubject: credentialClone,
429
428
  issuer: issuerDidDocument.id,
430
429
  issuanceDate: new Date().toISOString(),
431
430
  credentialStatus: revocationService && !core.Is.undefined(revocationIndex)
@@ -410,12 +410,11 @@ class EntityStorageIdentityConnector {
410
410
  throw new GeneralError(this.CLASS_NAME, "publicKeyJwkMissing");
411
411
  }
412
412
  const revocationService = issuerDidDocument.service?.find(s => s.id.endsWith("#revocation"));
413
+ const credentialClone = ObjectHelper.clone(credential);
413
414
  const finalTypes = [DidTypes.VerifiableCredential];
414
- const credContext = ObjectHelper.extractProperty(credential, [
415
- "@context"
416
- ]);
417
- const credId = ObjectHelper.extractProperty(credential, ["@id", "id"], false);
418
- const credType = ObjectHelper.extractProperty(credential, ["@type", "type"]);
415
+ const credContext = ObjectHelper.extractProperty(credentialClone, ["@context"]);
416
+ const credId = ObjectHelper.extractProperty(credentialClone, ["@id", "id"], false);
417
+ const credType = ObjectHelper.extractProperty(credentialClone, ["@type", "type"]);
419
418
  if (Is.stringValue(credType)) {
420
419
  finalTypes.push(credType);
421
420
  }
@@ -423,7 +422,7 @@ class EntityStorageIdentityConnector {
423
422
  "@context": JsonLdProcessor.combineContexts(DidContexts.ContextV1, credContext) ?? null,
424
423
  id,
425
424
  type: finalTypes,
426
- credentialSubject: credential,
425
+ credentialSubject: credentialClone,
427
426
  issuer: issuerDidDocument.id,
428
427
  issuanceDate: new Date().toISOString(),
429
428
  credentialStatus: revocationService && !Is.undefined(revocationIndex)
@@ -1,4 +1,4 @@
1
- import { type IJsonLdObject, type IJsonLdContextDefinitionRoot } from "@twin.org/data-json-ld";
1
+ import { type IJsonLdContextDefinitionRoot, type IJsonLdObject } from "@twin.org/data-json-ld";
2
2
  import { type IIdentityConnector } from "@twin.org/identity-models";
3
3
  import { DidVerificationMethodType, type IDidDocument, type IDidDocumentVerificationMethod, type IDidService, type IDidVerifiableCredential, type IDidVerifiablePresentation } from "@twin.org/standards-w3c-did";
4
4
  /**
@@ -85,7 +85,7 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
85
85
  * @returns The created verifiable credential and its token.
86
86
  * @throws NotFoundError if the id can not be resolved.
87
87
  */
88
- createVerifiableCredential<T extends IJsonLdObject = IJsonLdObject>(controller: string, verificationMethodId: string, id: string | undefined, credential: T, revocationIndex?: number): Promise<{
88
+ createVerifiableCredential<T extends IJsonLdObject>(controller: string, verificationMethodId: string, id: string | undefined, credential: T, revocationIndex?: number): Promise<{
89
89
  verifiableCredential: IDidVerifiableCredential<T>;
90
90
  jwt: string;
91
91
  }>;
@@ -94,7 +94,7 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
94
94
  * @param credentialJwt The credential to verify.
95
95
  * @returns The credential stored in the jwt and the revocation status.
96
96
  */
97
- checkVerifiableCredential<T extends IJsonLdObject = IJsonLdObject>(credentialJwt: string): Promise<{
97
+ checkVerifiableCredential<T extends IJsonLdObject>(credentialJwt: string): Promise<{
98
98
  revoked: boolean;
99
99
  verifiableCredential?: IDidVerifiableCredential<T>;
100
100
  }>;
@@ -126,7 +126,7 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
126
126
  * @returns The created verifiable presentation and its token.
127
127
  * @throws NotFoundError if the id can not be resolved.
128
128
  */
129
- createVerifiablePresentation<T extends IJsonLdObject = IJsonLdObject>(controller: string, presentationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential<T>)[], expiresInMinutes?: number): Promise<{
129
+ createVerifiablePresentation<T extends IJsonLdObject>(controller: string, presentationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential<T>)[], expiresInMinutes?: number): Promise<{
130
130
  verifiablePresentation: IDidVerifiablePresentation<T>;
131
131
  jwt: string;
132
132
  }>;
@@ -135,7 +135,7 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
135
135
  * @param presentationJwt The presentation to verify.
136
136
  * @returns The presentation stored in the jwt and the revocation status.
137
137
  */
138
- checkVerifiablePresentation<T extends IJsonLdObject = IJsonLdObject>(presentationJwt: string): Promise<{
138
+ checkVerifiablePresentation<T extends IJsonLdObject>(presentationJwt: string): Promise<{
139
139
  revoked: boolean;
140
140
  verifiablePresentation?: IDidVerifiablePresentation<T>;
141
141
  issuers?: IDidDocument[];
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/identity-connector-entity-storage- Changelog
2
2
 
3
- ## v0.0.1-next.10
3
+ ## v0.0.1-next.12
4
4
 
5
5
  - Initial Release
@@ -270,7 +270,7 @@ Create a verifiable credential for a verification method.
270
270
 
271
271
  #### Type Parameters
272
272
 
273
- • **T** *extends* `IJsonLdObject` = `IJsonLdObject`
273
+ • **T** *extends* `IJsonLdObject`
274
274
 
275
275
  #### Parameters
276
276
 
@@ -326,7 +326,7 @@ Check a verifiable credential is valid.
326
326
 
327
327
  #### Type Parameters
328
328
 
329
- • **T** *extends* `IJsonLdObject` = `IJsonLdObject`
329
+ • **T** *extends* `IJsonLdObject`
330
330
 
331
331
  #### Parameters
332
332
 
@@ -426,7 +426,7 @@ Create a verifiable presentation from the supplied verifiable credentials.
426
426
 
427
427
  #### Type Parameters
428
428
 
429
- • **T** *extends* `IJsonLdObject` = `IJsonLdObject`
429
+ • **T** *extends* `IJsonLdObject`
430
430
 
431
431
  #### Parameters
432
432
 
@@ -490,7 +490,7 @@ Check a verifiable presentation is valid.
490
490
 
491
491
  #### Type Parameters
492
492
 
493
- • **T** *extends* `IJsonLdObject` = `IJsonLdObject`
493
+ • **T** *extends* `IJsonLdObject`
494
494
 
495
495
  #### Parameters
496
496
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-connector-entity-storage",
3
- "version": "0.0.1-next.10",
3
+ "version": "0.0.1-next.12",
4
4
  "description": "Identity connector implementation using entity storage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "@twin.org/data-core": "next",
20
20
  "@twin.org/data-json-ld": "next",
21
21
  "@twin.org/entity": "next",
22
- "@twin.org/identity-models": "0.0.1-next.10",
22
+ "@twin.org/identity-models": "0.0.1-next.12",
23
23
  "@twin.org/nameof": "next",
24
24
  "@twin.org/standards-w3c-did": "next",
25
25
  "@twin.org/vault-models": "next",