@twin.org/immutable-proof-service 0.0.1-next.20 → 0.0.1-next.22
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/cjs/index.cjs +13 -7
- package/dist/esm/index.mjs +13 -7
- package/docs/changelog.md +1 -1
- package/docs/open-api/spec.json +8 -2
- package/package.json +3 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -175,7 +175,10 @@ function generateRestRoutesImmutableProof(baseRouteName, componentName) {
|
|
|
175
175
|
id: "immutableProofGetResponseExample",
|
|
176
176
|
response: {
|
|
177
177
|
body: {
|
|
178
|
-
"@context":
|
|
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":
|
|
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",
|
|
@@ -496,8 +502,7 @@ class ImmutableProofService {
|
|
|
496
502
|
}
|
|
497
503
|
try {
|
|
498
504
|
const { immutableProof } = await this.internalGet(id, false);
|
|
499
|
-
|
|
500
|
-
return compacted;
|
|
505
|
+
return dataJsonLd.JsonLdProcessor.compact(immutableProof);
|
|
501
506
|
}
|
|
502
507
|
catch (error) {
|
|
503
508
|
throw new core.GeneralError(this.CLASS_NAME, "getFailed", undefined, error);
|
|
@@ -587,7 +592,7 @@ class ImmutableProofService {
|
|
|
587
592
|
*/
|
|
588
593
|
proofEntityToJsonLd(proofEntity) {
|
|
589
594
|
const model = {
|
|
590
|
-
"@context": immutableProofModels.ImmutableProofTypes.ContextRoot,
|
|
595
|
+
"@context": [immutableProofModels.ImmutableProofTypes.ContextRoot, immutableProofModels.ImmutableProofTypes.ContextRootCommon],
|
|
591
596
|
type: immutableProofModels.ImmutableProofTypes.ImmutableProof,
|
|
592
597
|
id: proofEntity.id,
|
|
593
598
|
userIdentity: proofEntity.userIdentity,
|
|
@@ -609,13 +614,14 @@ class ImmutableProofService {
|
|
|
609
614
|
// As we are adding the proof to the data we update its context
|
|
610
615
|
immutableProof["@context"] = [
|
|
611
616
|
immutableProofModels.ImmutableProofTypes.ContextRoot,
|
|
617
|
+
immutableProofModels.ImmutableProofTypes.ContextRootCommon,
|
|
612
618
|
standardsW3cDid.DidContexts.ContextVCDataIntegrity
|
|
613
619
|
];
|
|
614
620
|
immutableProof.proof = task.result.proof;
|
|
615
621
|
if (core.Is.stringValue(immutableProof.proof.created)) {
|
|
616
622
|
proofEntity.dateCreated = immutableProof.proof.created;
|
|
617
623
|
}
|
|
618
|
-
const compacted = await dataJsonLd.JsonLdProcessor.compact(immutableProof
|
|
624
|
+
const compacted = await dataJsonLd.JsonLdProcessor.compact(immutableProof);
|
|
619
625
|
const immutableStoreResult = await this._immutableStorage.store(proofEntity.nodeIdentity, core.ObjectHelper.toBytes(compacted));
|
|
620
626
|
proofEntity.immutableStorageId = immutableStoreResult.id;
|
|
621
627
|
await this._proofStorage.set(proofEntity);
|
|
@@ -690,7 +696,7 @@ class ImmutableProofService {
|
|
|
690
696
|
// We hash the data for the proof without the the proof or immutable receipt for the proof
|
|
691
697
|
// without these objects we can simplify the context
|
|
692
698
|
const object = core.ObjectHelper.omit(immutableProof, ["proof", "immutableReceipt"]);
|
|
693
|
-
object["@context"] = immutableProofModels.ImmutableProofTypes.ContextRoot;
|
|
699
|
+
object["@context"] = [immutableProofModels.ImmutableProofTypes.ContextRoot, immutableProofModels.ImmutableProofTypes.ContextRootCommon];
|
|
694
700
|
const canonicalDocument = core.JsonHelper.canonicalize(object);
|
|
695
701
|
const proofKey = await this._vaultConnector.getKey(`${nodeIdentity}/${this._proofHashKeyId}`);
|
|
696
702
|
const proofHash = crypto.Sha256.sum256(proofKey.privateKey);
|
package/dist/esm/index.mjs
CHANGED
|
@@ -173,7 +173,10 @@ function generateRestRoutesImmutableProof(baseRouteName, componentName) {
|
|
|
173
173
|
id: "immutableProofGetResponseExample",
|
|
174
174
|
response: {
|
|
175
175
|
body: {
|
|
176
|
-
"@context":
|
|
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":
|
|
209
|
+
"@context": [
|
|
210
|
+
ImmutableProofTypes.ContextRoot,
|
|
211
|
+
ImmutableProofTypes.ContextRootCommon
|
|
212
|
+
],
|
|
207
213
|
type: ImmutableProofTypes.ImmutableProof,
|
|
208
214
|
id: "ais:1234567890",
|
|
209
215
|
userIdentity: "user-1",
|
|
@@ -494,8 +500,7 @@ class ImmutableProofService {
|
|
|
494
500
|
}
|
|
495
501
|
try {
|
|
496
502
|
const { immutableProof } = await this.internalGet(id, false);
|
|
497
|
-
|
|
498
|
-
return compacted;
|
|
503
|
+
return JsonLdProcessor.compact(immutableProof);
|
|
499
504
|
}
|
|
500
505
|
catch (error) {
|
|
501
506
|
throw new GeneralError(this.CLASS_NAME, "getFailed", undefined, error);
|
|
@@ -585,7 +590,7 @@ class ImmutableProofService {
|
|
|
585
590
|
*/
|
|
586
591
|
proofEntityToJsonLd(proofEntity) {
|
|
587
592
|
const model = {
|
|
588
|
-
"@context": ImmutableProofTypes.ContextRoot,
|
|
593
|
+
"@context": [ImmutableProofTypes.ContextRoot, ImmutableProofTypes.ContextRootCommon],
|
|
589
594
|
type: ImmutableProofTypes.ImmutableProof,
|
|
590
595
|
id: proofEntity.id,
|
|
591
596
|
userIdentity: proofEntity.userIdentity,
|
|
@@ -607,13 +612,14 @@ class ImmutableProofService {
|
|
|
607
612
|
// As we are adding the proof to the data we update its context
|
|
608
613
|
immutableProof["@context"] = [
|
|
609
614
|
ImmutableProofTypes.ContextRoot,
|
|
615
|
+
ImmutableProofTypes.ContextRootCommon,
|
|
610
616
|
DidContexts.ContextVCDataIntegrity
|
|
611
617
|
];
|
|
612
618
|
immutableProof.proof = task.result.proof;
|
|
613
619
|
if (Is.stringValue(immutableProof.proof.created)) {
|
|
614
620
|
proofEntity.dateCreated = immutableProof.proof.created;
|
|
615
621
|
}
|
|
616
|
-
const compacted = await JsonLdProcessor.compact(immutableProof
|
|
622
|
+
const compacted = await JsonLdProcessor.compact(immutableProof);
|
|
617
623
|
const immutableStoreResult = await this._immutableStorage.store(proofEntity.nodeIdentity, ObjectHelper.toBytes(compacted));
|
|
618
624
|
proofEntity.immutableStorageId = immutableStoreResult.id;
|
|
619
625
|
await this._proofStorage.set(proofEntity);
|
|
@@ -688,7 +694,7 @@ class ImmutableProofService {
|
|
|
688
694
|
// We hash the data for the proof without the the proof or immutable receipt for the proof
|
|
689
695
|
// without these objects we can simplify the context
|
|
690
696
|
const object = ObjectHelper.omit(immutableProof, ["proof", "immutableReceipt"]);
|
|
691
|
-
object["@context"] = ImmutableProofTypes.ContextRoot;
|
|
697
|
+
object["@context"] = [ImmutableProofTypes.ContextRoot, ImmutableProofTypes.ContextRootCommon];
|
|
692
698
|
const canonicalDocument = JsonHelper.canonicalize(object);
|
|
693
699
|
const proofKey = await this._vaultConnector.getKey(`${nodeIdentity}/${this._proofHashKeyId}`);
|
|
694
700
|
const proofHash = Sha256.sum256(proofKey.privateKey);
|
package/docs/changelog.md
CHANGED
package/docs/open-api/spec.json
CHANGED
|
@@ -194,7 +194,10 @@
|
|
|
194
194
|
"examples": {
|
|
195
195
|
"immutableProofGetResponseExample": {
|
|
196
196
|
"value": {
|
|
197
|
-
"@context":
|
|
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":
|
|
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.
|
|
3
|
+
"version": "0.0.1-next.22",
|
|
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.
|
|
27
|
-
"@twin.org/immutable-proof-task": "0.0.1-next.
|
|
26
|
+
"@twin.org/immutable-proof-models": "0.0.1-next.22",
|
|
27
|
+
"@twin.org/immutable-proof-task": "0.0.1-next.22",
|
|
28
28
|
"@twin.org/immutable-storage-models": "next",
|
|
29
29
|
"@twin.org/nameof": "next",
|
|
30
30
|
"@twin.org/standards-w3c-did": "next",
|