@twin.org/immutable-proof-service 0.0.1-next.20 → 0.0.1-next.21

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.
@@ -175,7 +175,10 @@ function generateRestRoutesImmutableProof(baseRouteName, componentName) {
175
175
  id: "immutableProofGetResponseExample",
176
176
  response: {
177
177
  body: {
178
- "@context": immutableProofModels.ImmutableProofTypes.ContextRoot,
178
+ "@context": [
179
+ immutableProofModels.ImmutableProofTypes.ContextRoot,
180
+ immutableProofModels.ImmutableProofTypes.ContextRootCommon
181
+ ],
179
182
  type: immutableProofModels.ImmutableProofTypes.ImmutableProof,
180
183
  id: "ais:1234567890",
181
184
  userIdentity: "user-1",
@@ -205,7 +208,10 @@ function generateRestRoutesImmutableProof(baseRouteName, componentName) {
205
208
  [web.HeaderTypes.ContentType]: web.MimeTypes.JsonLd
206
209
  },
207
210
  body: {
208
- "@context": immutableProofModels.ImmutableProofTypes.ContextRoot,
211
+ "@context": [
212
+ immutableProofModels.ImmutableProofTypes.ContextRoot,
213
+ immutableProofModels.ImmutableProofTypes.ContextRootCommon
214
+ ],
209
215
  type: immutableProofModels.ImmutableProofTypes.ImmutableProof,
210
216
  id: "ais:1234567890",
211
217
  userIdentity: "user-1",
@@ -587,7 +593,7 @@ class ImmutableProofService {
587
593
  */
588
594
  proofEntityToJsonLd(proofEntity) {
589
595
  const model = {
590
- "@context": immutableProofModels.ImmutableProofTypes.ContextRoot,
596
+ "@context": [immutableProofModels.ImmutableProofTypes.ContextRoot, immutableProofModels.ImmutableProofTypes.ContextRootCommon],
591
597
  type: immutableProofModels.ImmutableProofTypes.ImmutableProof,
592
598
  id: proofEntity.id,
593
599
  userIdentity: proofEntity.userIdentity,
@@ -609,6 +615,7 @@ class ImmutableProofService {
609
615
  // As we are adding the proof to the data we update its context
610
616
  immutableProof["@context"] = [
611
617
  immutableProofModels.ImmutableProofTypes.ContextRoot,
618
+ immutableProofModels.ImmutableProofTypes.ContextRootCommon,
612
619
  standardsW3cDid.DidContexts.ContextVCDataIntegrity
613
620
  ];
614
621
  immutableProof.proof = task.result.proof;
@@ -690,7 +697,7 @@ class ImmutableProofService {
690
697
  // We hash the data for the proof without the the proof or immutable receipt for the proof
691
698
  // without these objects we can simplify the context
692
699
  const object = core.ObjectHelper.omit(immutableProof, ["proof", "immutableReceipt"]);
693
- object["@context"] = immutableProofModels.ImmutableProofTypes.ContextRoot;
700
+ object["@context"] = [immutableProofModels.ImmutableProofTypes.ContextRoot, immutableProofModels.ImmutableProofTypes.ContextRootCommon];
694
701
  const canonicalDocument = core.JsonHelper.canonicalize(object);
695
702
  const proofKey = await this._vaultConnector.getKey(`${nodeIdentity}/${this._proofHashKeyId}`);
696
703
  const proofHash = crypto.Sha256.sum256(proofKey.privateKey);
@@ -173,7 +173,10 @@ function generateRestRoutesImmutableProof(baseRouteName, componentName) {
173
173
  id: "immutableProofGetResponseExample",
174
174
  response: {
175
175
  body: {
176
- "@context": ImmutableProofTypes.ContextRoot,
176
+ "@context": [
177
+ ImmutableProofTypes.ContextRoot,
178
+ ImmutableProofTypes.ContextRootCommon
179
+ ],
177
180
  type: ImmutableProofTypes.ImmutableProof,
178
181
  id: "ais:1234567890",
179
182
  userIdentity: "user-1",
@@ -203,7 +206,10 @@ function generateRestRoutesImmutableProof(baseRouteName, componentName) {
203
206
  [HeaderTypes.ContentType]: MimeTypes.JsonLd
204
207
  },
205
208
  body: {
206
- "@context": ImmutableProofTypes.ContextRoot,
209
+ "@context": [
210
+ ImmutableProofTypes.ContextRoot,
211
+ ImmutableProofTypes.ContextRootCommon
212
+ ],
207
213
  type: ImmutableProofTypes.ImmutableProof,
208
214
  id: "ais:1234567890",
209
215
  userIdentity: "user-1",
@@ -585,7 +591,7 @@ class ImmutableProofService {
585
591
  */
586
592
  proofEntityToJsonLd(proofEntity) {
587
593
  const model = {
588
- "@context": ImmutableProofTypes.ContextRoot,
594
+ "@context": [ImmutableProofTypes.ContextRoot, ImmutableProofTypes.ContextRootCommon],
589
595
  type: ImmutableProofTypes.ImmutableProof,
590
596
  id: proofEntity.id,
591
597
  userIdentity: proofEntity.userIdentity,
@@ -607,6 +613,7 @@ class ImmutableProofService {
607
613
  // As we are adding the proof to the data we update its context
608
614
  immutableProof["@context"] = [
609
615
  ImmutableProofTypes.ContextRoot,
616
+ ImmutableProofTypes.ContextRootCommon,
610
617
  DidContexts.ContextVCDataIntegrity
611
618
  ];
612
619
  immutableProof.proof = task.result.proof;
@@ -688,7 +695,7 @@ class ImmutableProofService {
688
695
  // We hash the data for the proof without the the proof or immutable receipt for the proof
689
696
  // without these objects we can simplify the context
690
697
  const object = ObjectHelper.omit(immutableProof, ["proof", "immutableReceipt"]);
691
- object["@context"] = ImmutableProofTypes.ContextRoot;
698
+ object["@context"] = [ImmutableProofTypes.ContextRoot, ImmutableProofTypes.ContextRootCommon];
692
699
  const canonicalDocument = JsonHelper.canonicalize(object);
693
700
  const proofKey = await this._vaultConnector.getKey(`${nodeIdentity}/${this._proofHashKeyId}`);
694
701
  const proofHash = Sha256.sum256(proofKey.privateKey);
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/immutable-proof-service - Changelog
2
2
 
3
- ## v0.0.1-next.20
3
+ ## v0.0.1-next.21
4
4
 
5
5
  - Initial Release
@@ -194,7 +194,10 @@
194
194
  "examples": {
195
195
  "immutableProofGetResponseExample": {
196
196
  "value": {
197
- "@context": "https://schema.twindev.org/immutable-proof/",
197
+ "@context": [
198
+ "https://schema.twindev.org/immutable-proof/",
199
+ "https://schema.twindev.org/common/"
200
+ ],
198
201
  "type": "ImmutableProof",
199
202
  "id": "ais:1234567890",
200
203
  "userIdentity": "user-1",
@@ -219,7 +222,10 @@
219
222
  "examples": {
220
223
  "immutableProofJsonLdGetResponseExample": {
221
224
  "value": {
222
- "@context": "https://schema.twindev.org/immutable-proof/",
225
+ "@context": [
226
+ "https://schema.twindev.org/immutable-proof/",
227
+ "https://schema.twindev.org/common/"
228
+ ],
223
229
  "type": "ImmutableProof",
224
230
  "id": "ais:1234567890",
225
231
  "userIdentity": "user-1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/immutable-proof-service",
3
- "version": "0.0.1-next.20",
3
+ "version": "0.0.1-next.21",
4
4
  "description": "Immutable proof contract implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,8 +23,8 @@
23
23
  "@twin.org/entity-storage-models": "next",
24
24
  "@twin.org/event-bus-models": "next",
25
25
  "@twin.org/identity-models": "next",
26
- "@twin.org/immutable-proof-models": "0.0.1-next.20",
27
- "@twin.org/immutable-proof-task": "0.0.1-next.20",
26
+ "@twin.org/immutable-proof-models": "0.0.1-next.21",
27
+ "@twin.org/immutable-proof-task": "0.0.1-next.21",
28
28
  "@twin.org/immutable-storage-models": "next",
29
29
  "@twin.org/nameof": "next",
30
30
  "@twin.org/standards-w3c-did": "next",