@twin.org/immutable-proof-models 0.0.3-next.10 → 0.0.3-next.11

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.
Files changed (34) hide show
  1. package/README.md +1 -1
  2. package/dist/es/dataTypes/immutableProofDataTypes.js +23 -7
  3. package/dist/es/dataTypes/immutableProofDataTypes.js.map +1 -1
  4. package/dist/es/models/IImmutableProof.js.map +1 -1
  5. package/dist/es/models/IImmutableProofReceipt.js.map +1 -1
  6. package/dist/es/models/IImmutableProofVerification.js.map +1 -1
  7. package/dist/es/models/immutableProofTypes.js +5 -1
  8. package/dist/es/models/immutableProofTypes.js.map +1 -1
  9. package/dist/es/schemas/ImmutableProof.json +13 -14
  10. package/dist/es/schemas/ImmutableProofFailure.json +24 -0
  11. package/dist/es/schemas/ImmutableProofReceipt.json +39 -0
  12. package/dist/es/schemas/ImmutableProofVerification.json +30 -0
  13. package/dist/types/models/IImmutableProof.d.ts +1 -1
  14. package/dist/types/models/IImmutableProofReceipt.d.ts +2 -2
  15. package/dist/types/models/IImmutableProofVerification.d.ts +2 -2
  16. package/dist/types/models/immutableProofTypes.d.ts +4 -0
  17. package/docs/changelog.md +8 -1
  18. package/docs/examples.md +72 -1
  19. package/docs/reference/classes/ImmutableProofDataTypes.md +1 -1
  20. package/docs/reference/interfaces/IImmutableProof.md +7 -8
  21. package/docs/reference/interfaces/IImmutableProofComponent.md +4 -4
  22. package/docs/reference/interfaces/IImmutableProofCreateRequest.md +1 -1
  23. package/docs/reference/interfaces/IImmutableProofEventBusProofCreated.md +1 -1
  24. package/docs/reference/interfaces/IImmutableProofGetRequest.md +3 -3
  25. package/docs/reference/interfaces/IImmutableProofGetResponse.md +3 -3
  26. package/docs/reference/interfaces/IImmutableProofReceipt.md +7 -9
  27. package/docs/reference/interfaces/IImmutableProofVerification.md +5 -7
  28. package/docs/reference/interfaces/IImmutableProofVerifyRequest.md +3 -3
  29. package/docs/reference/interfaces/IImmutableProofVerifyResponse.md +3 -3
  30. package/docs/reference/variables/ImmutableProofContexts.md +6 -6
  31. package/docs/reference/variables/ImmutableProofFailure.md +4 -4
  32. package/docs/reference/variables/ImmutableProofTopics.md +1 -1
  33. package/docs/reference/variables/ImmutableProofTypes.md +9 -3
  34. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TWIN Immutable Proof Models
2
2
 
3
- Models which define the structure of the immutable proof connectors and services.
3
+ This package defines the shared contracts used by immutable proof components, including request and response models, verification structures, topics, and schema context values. It provides a stable foundation so services, tasks, and clients can exchange data consistently.
4
4
 
5
5
  ## Installation
6
6
 
@@ -1,9 +1,12 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
- import { DataTypeHandlerFactory } from "@twin.org/data-core";
3
+ import { DataTypeHelper } from "@twin.org/data-core";
4
4
  import { ImmutableProofContexts } from "../models/immutableProofContexts.js";
5
5
  import { ImmutableProofTypes } from "../models/immutableProofTypes.js";
6
6
  import ImmutableProofSchema from "../schemas/ImmutableProof.json" with { type: "json" };
7
+ import ImmutableProofFailureSchema from "../schemas/ImmutableProofFailure.json" with { type: "json" };
8
+ import ImmutableProofReceiptSchema from "../schemas/ImmutableProofReceipt.json" with { type: "json" };
9
+ import ImmutableProofVerificationSchema from "../schemas/ImmutableProofVerification.json" with { type: "json" };
7
10
  /**
8
11
  * Handle all the data types for immutable proof.
9
12
  */
@@ -12,12 +15,25 @@ export class ImmutableProofDataTypes {
12
15
  * Register all the data types.
13
16
  */
14
17
  static registerTypes() {
15
- DataTypeHandlerFactory.register(`${ImmutableProofContexts.Namespace}${ImmutableProofTypes.ImmutableProof}`, () => ({
16
- namespace: ImmutableProofContexts.Namespace,
17
- type: ImmutableProofTypes.ImmutableProof,
18
- defaultValue: {},
19
- jsonSchema: async () => ImmutableProofSchema
20
- }));
18
+ const types = [
19
+ {
20
+ type: ImmutableProofTypes.ImmutableProof,
21
+ schema: ImmutableProofSchema
22
+ },
23
+ {
24
+ type: ImmutableProofTypes.ImmutableProofReceipt,
25
+ schema: ImmutableProofReceiptSchema
26
+ },
27
+ {
28
+ type: ImmutableProofTypes.ImmutableProofVerification,
29
+ schema: ImmutableProofVerificationSchema
30
+ },
31
+ {
32
+ type: ImmutableProofTypes.ImmutableProofFailure,
33
+ schema: ImmutableProofFailureSchema
34
+ }
35
+ ];
36
+ DataTypeHelper.registerTypes(ImmutableProofContexts.Namespace, ImmutableProofContexts.JsonLdContext, types.map(t => ({ type: t.type, schema: t.schema })));
21
37
  }
22
38
  }
23
39
  //# sourceMappingURL=immutableProofDataTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"immutableProofDataTypes.js","sourceRoot":"","sources":["../../../src/dataTypes/immutableProofDataTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,sBAAsB,EAAoB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,oBAAoB,MAAM,gCAAgC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAExF;;GAEG;AACH,MAAM,OAAO,uBAAuB;IACnC;;OAEG;IACI,MAAM,CAAC,aAAa;QAC1B,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,sBAAsB,CAAC,SAAS,GAAG,mBAAmB,CAAC,cAAc,EAAE,EAC1E,GAAG,EAAE,CAAC,CAAC;YACN,SAAS,EAAE,sBAAsB,CAAC,SAAS;YAC3C,IAAI,EAAE,mBAAmB,CAAC,cAAc;YACxC,YAAY,EAAE,EAAE;YAChB,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,oBAAmC;SAC3D,CAAC,CACF,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { DataTypeHandlerFactory, type IJsonSchema } from \"@twin.org/data-core\";\nimport { ImmutableProofContexts } from \"../models/immutableProofContexts.js\";\nimport { ImmutableProofTypes } from \"../models/immutableProofTypes.js\";\nimport ImmutableProofSchema from \"../schemas/ImmutableProof.json\" with { type: \"json\" };\n\n/**\n * Handle all the data types for immutable proof.\n */\nexport class ImmutableProofDataTypes {\n\t/**\n\t * Register all the data types.\n\t */\n\tpublic static registerTypes(): void {\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${ImmutableProofContexts.Namespace}${ImmutableProofTypes.ImmutableProof}`,\n\t\t\t() => ({\n\t\t\t\tnamespace: ImmutableProofContexts.Namespace,\n\t\t\t\ttype: ImmutableProofTypes.ImmutableProof,\n\t\t\t\tdefaultValue: {},\n\t\t\t\tjsonSchema: async () => ImmutableProofSchema as IJsonSchema\n\t\t\t})\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"immutableProofDataTypes.js","sourceRoot":"","sources":["../../../src/dataTypes/immutableProofDataTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,oBAAoB,MAAM,gCAAgC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxF,OAAO,2BAA2B,MAAM,uCAAuC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACtG,OAAO,2BAA2B,MAAM,uCAAuC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACtG,OAAO,gCAAgC,MAAM,4CAA4C,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEhH;;GAEG;AACH,MAAM,OAAO,uBAAuB;IACnC;;OAEG;IACI,MAAM,CAAC,aAAa;QAC1B,MAAM,KAAK,GAAG;YACb;gBACC,IAAI,EAAE,mBAAmB,CAAC,cAAc;gBACxC,MAAM,EAAE,oBAAoB;aAC5B;YACD;gBACC,IAAI,EAAE,mBAAmB,CAAC,qBAAqB;gBAC/C,MAAM,EAAE,2BAA2B;aACnC;YACD;gBACC,IAAI,EAAE,mBAAmB,CAAC,0BAA0B;gBACpD,MAAM,EAAE,gCAAgC;aACxC;YACD;gBACC,IAAI,EAAE,mBAAmB,CAAC,qBAAqB;gBAC/C,MAAM,EAAE,2BAA2B;aACnC;SACD,CAAC;QAEF,cAAc,CAAC,aAAa,CAC3B,sBAAsB,CAAC,SAAS,EAChC,sBAAsB,CAAC,aAAa,EACpC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CACpD,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { DataTypeHelper } from \"@twin.org/data-core\";\nimport { ImmutableProofContexts } from \"../models/immutableProofContexts.js\";\nimport { ImmutableProofTypes } from \"../models/immutableProofTypes.js\";\nimport ImmutableProofSchema from \"../schemas/ImmutableProof.json\" with { type: \"json\" };\nimport ImmutableProofFailureSchema from \"../schemas/ImmutableProofFailure.json\" with { type: \"json\" };\nimport ImmutableProofReceiptSchema from \"../schemas/ImmutableProofReceipt.json\" with { type: \"json\" };\nimport ImmutableProofVerificationSchema from \"../schemas/ImmutableProofVerification.json\" with { type: \"json\" };\n\n/**\n * Handle all the data types for immutable proof.\n */\nexport class ImmutableProofDataTypes {\n\t/**\n\t * Register all the data types.\n\t */\n\tpublic static registerTypes(): void {\n\t\tconst types = [\n\t\t\t{\n\t\t\t\ttype: ImmutableProofTypes.ImmutableProof,\n\t\t\t\tschema: ImmutableProofSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: ImmutableProofTypes.ImmutableProofReceipt,\n\t\t\t\tschema: ImmutableProofReceiptSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: ImmutableProofTypes.ImmutableProofVerification,\n\t\t\t\tschema: ImmutableProofVerificationSchema\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: ImmutableProofTypes.ImmutableProofFailure,\n\t\t\t\tschema: ImmutableProofFailureSchema\n\t\t\t}\n\t\t];\n\n\t\tDataTypeHelper.registerTypes(\n\t\t\tImmutableProofContexts.Namespace,\n\t\t\tImmutableProofContexts.JsonLdContext,\n\t\t\ttypes.map(t => ({ type: t.type, schema: t.schema }))\n\t\t);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IImmutableProof.js","sourceRoot":"","sources":["../../../src/models/IImmutableProof.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ImmutableProofContexts } from \"./immutableProofContexts.js\";\nimport type { ImmutableProofTypes } from \"./immutableProofTypes.js\";\n\n/**\n * Interface describing an immutable proof state.\n */\nexport interface IImmutableProof {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\"?: [typeof ImmutableProofContexts.Context, typeof ImmutableProofContexts.ContextCommon];\n\n\t/**\n\t * JSON-LD Type.\n\t */\n\ttype?: typeof ImmutableProofTypes.ImmutableProof;\n\n\t/**\n\t * The id of the object associated with the proof.\n\t */\n\tid?: string;\n\n\t/**\n\t * The integrity hash of the object associated with the proof.\n\t * json-ld namespace:twin-common\n\t */\n\tproofIntegrity: string;\n}\n"]}
1
+ {"version":3,"file":"IImmutableProof.js","sourceRoot":"","sources":["../../../src/models/IImmutableProof.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ImmutableProofContexts } from \"./immutableProofContexts.js\";\nimport type { ImmutableProofTypes } from \"./immutableProofTypes.js\";\n\n/**\n * Interface describing an immutable proof state.\n */\nexport interface IImmutableProof {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\"?: [typeof ImmutableProofContexts.Context, typeof ImmutableProofContexts.ContextCommon];\n\n\t/**\n\t * JSON-LD Type.\n\t */\n\ttype?: typeof ImmutableProofTypes.ImmutableProof;\n\n\t/**\n\t * The id of the object associated with the proof.\n\t */\n\tid?: string;\n\n\t/**\n\t * The integrity hash of the object associated with the proof.\n\t * @json-ld namespace:twin-common\n\t */\n\tproofIntegrity: string;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IImmutableProofReceipt.js","sourceRoot":"","sources":["../../../src/models/IImmutableProofReceipt.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { ImmutableProofContexts } from \"./immutableProofContexts.js\";\nimport type { ImmutableProofTypes } from \"./immutableProofTypes.js\";\n\n/**\n * Interface describing an immutable proof receipt.\n */\nexport interface IImmutableProofReceipt {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\"?: [typeof ImmutableProofContexts.Context, typeof ImmutableProofContexts.ContextCommon];\n\n\t/**\n\t * JSON-LD Type.\n\t */\n\ttype: typeof ImmutableProofTypes.ImmutableProofReceipt;\n\n\t/**\n\t * The immutable receipt detail for where the proof is stored.\n\t * json-ld id\n\t */\n\timmutableReceipt?: IJsonLdNodeObject;\n\n\t/**\n\t * The verifiable storage id for where the proof is stored.\n\t * json-ld id\n\t */\n\tverifiableStorageId?: string;\n}\n"]}
1
+ {"version":3,"file":"IImmutableProofReceipt.js","sourceRoot":"","sources":["../../../src/models/IImmutableProofReceipt.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { ImmutableProofContexts } from \"./immutableProofContexts.js\";\nimport type { ImmutableProofTypes } from \"./immutableProofTypes.js\";\n\n/**\n * Interface describing an immutable proof receipt.\n */\nexport interface IImmutableProofReceipt {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\"?: [typeof ImmutableProofContexts.Context, typeof ImmutableProofContexts.ContextCommon];\n\n\t/**\n\t * JSON-LD Type.\n\t */\n\ttype: typeof ImmutableProofTypes.ImmutableProofReceipt;\n\n\t/**\n\t * The immutable receipt detail for where the proof is stored.\n\t * @json-ld id\n\t */\n\timmutableReceipt?: IJsonLdNodeObject;\n\n\t/**\n\t * The verifiable storage id for where the proof is stored.\n\t * @json-ld id\n\t */\n\tverifiableStorageId?: string;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IImmutableProofVerification.js","sourceRoot":"","sources":["../../../src/models/IImmutableProofVerification.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ImmutableProofContexts } from \"./immutableProofContexts.js\";\nimport type { ImmutableProofFailure } from \"./immutableProofFailure.js\";\nimport type { ImmutableProofTypes } from \"./immutableProofTypes.js\";\n\n/**\n * Interface describing an immutable proof verification.\n */\nexport interface IImmutableProofVerification {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\": typeof ImmutableProofContexts.Context;\n\n\t/**\n\t * JSON-LD Type.\n\t */\n\ttype: typeof ImmutableProofTypes.ImmutableProofVerification;\n\n\t/**\n\t * Was the verification successful.\n\t * json-ld namespace:twin-common\n\t */\n\tverified: boolean;\n\n\t/**\n\t * If the verification was unsuccessful the failure reason.\n\t * json-ld type:schema:Text\n\t */\n\tfailure?: ImmutableProofFailure;\n}\n"]}
1
+ {"version":3,"file":"IImmutableProofVerification.js","sourceRoot":"","sources":["../../../src/models/IImmutableProofVerification.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ImmutableProofContexts } from \"./immutableProofContexts.js\";\nimport type { ImmutableProofFailure } from \"./immutableProofFailure.js\";\nimport type { ImmutableProofTypes } from \"./immutableProofTypes.js\";\n\n/**\n * Interface describing an immutable proof verification.\n */\nexport interface IImmutableProofVerification {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\": typeof ImmutableProofContexts.Context;\n\n\t/**\n\t * JSON-LD Type.\n\t */\n\ttype: typeof ImmutableProofTypes.ImmutableProofVerification;\n\n\t/**\n\t * Was the verification successful.\n\t * @json-ld namespace:twin-common\n\t */\n\tverified: boolean;\n\n\t/**\n\t * If the verification was unsuccessful the failure reason.\n\t * @json-ld type:schema:Text\n\t */\n\tfailure?: ImmutableProofFailure;\n}\n"]}
@@ -16,6 +16,10 @@ export const ImmutableProofTypes = {
16
16
  /**
17
17
  * Represents Immutable Proof Verification.
18
18
  */
19
- ImmutableProofVerification: "ImmutableProofVerification"
19
+ ImmutableProofVerification: "ImmutableProofVerification",
20
+ /**
21
+ * Represents Immutable Proof Failure.
22
+ */
23
+ ImmutableProofFailure: "ImmutableProofFailure"
20
24
  };
21
25
  //# sourceMappingURL=immutableProofTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"immutableProofTypes.js","sourceRoot":"","sources":["../../../src/models/immutableProofTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC;;OAEG;IACH,cAAc,EAAE,gBAAgB;IAEhC;;OAEG;IACH,qBAAqB,EAAE,uBAAuB;IAE9C;;OAEG;IACH,0BAA0B,EAAE,4BAA4B;CAC/C,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The types of immutable proof data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ImmutableProofTypes = {\n\t/**\n\t * Represents Immutable Proof.\n\t */\n\tImmutableProof: \"ImmutableProof\",\n\n\t/**\n\t * Represents Immutable Proof Receipt.\n\t */\n\tImmutableProofReceipt: \"ImmutableProofReceipt\",\n\n\t/**\n\t * Represents Immutable Proof Verification.\n\t */\n\tImmutableProofVerification: \"ImmutableProofVerification\"\n} as const;\n\n/**\n * The types of immutable proof data.\n */\nexport type ImmutableProofTypes = (typeof ImmutableProofTypes)[keyof typeof ImmutableProofTypes];\n"]}
1
+ {"version":3,"file":"immutableProofTypes.js","sourceRoot":"","sources":["../../../src/models/immutableProofTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC;;OAEG;IACH,cAAc,EAAE,gBAAgB;IAEhC;;OAEG;IACH,qBAAqB,EAAE,uBAAuB;IAE9C;;OAEG;IACH,0BAA0B,EAAE,4BAA4B;IAExD;;OAEG;IACH,qBAAqB,EAAE,uBAAuB;CACrC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The types of immutable proof data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ImmutableProofTypes = {\n\t/**\n\t * Represents Immutable Proof.\n\t */\n\tImmutableProof: \"ImmutableProof\",\n\n\t/**\n\t * Represents Immutable Proof Receipt.\n\t */\n\tImmutableProofReceipt: \"ImmutableProofReceipt\",\n\n\t/**\n\t * Represents Immutable Proof Verification.\n\t */\n\tImmutableProofVerification: \"ImmutableProofVerification\",\n\n\t/**\n\t * Represents Immutable Proof Failure.\n\t */\n\tImmutableProofFailure: \"ImmutableProofFailure\"\n} as const;\n\n/**\n * The types of immutable proof data.\n */\nexport type ImmutableProofTypes = (typeof ImmutableProofTypes)[keyof typeof ImmutableProofTypes];\n"]}
@@ -1,27 +1,26 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://schema.twindev.org/immutable-proof/ImmutableProof",
4
+ "title": "ImmutableProof",
4
5
  "description": "Interface describing an immutable proof state.",
5
6
  "type": "object",
6
7
  "properties": {
7
8
  "@context": {
8
9
  "type": "array",
9
- "items": {
10
- "allOf": [
11
- {
12
- "type": "string",
13
- "const": "https://schema.twindev.org/immutable-proof/"
14
- },
15
- {
16
- "type": "string",
17
- "const": "https://schema.twindev.org/common/"
18
- }
19
- ]
20
- },
10
+ "prefixItems": [
11
+ {
12
+ "const": "https://schema.twindev.org/immutable-proof/"
13
+ },
14
+ {
15
+ "const": "https://schema.twindev.org/common/"
16
+ }
17
+ ],
18
+ "items": false,
19
+ "minItems": 2,
20
+ "maxItems": 2,
21
21
  "description": "JSON-LD Context."
22
22
  },
23
23
  "type": {
24
- "type": "string",
25
24
  "const": "ImmutableProof",
26
25
  "description": "JSON-LD Type."
27
26
  },
@@ -31,7 +30,7 @@
31
30
  },
32
31
  "proofIntegrity": {
33
32
  "type": "string",
34
- "description": "The integrity hash of the object associated with the proof. json-ld namespace:twin-common"
33
+ "description": "The integrity hash of the object associated with the proof."
35
34
  }
36
35
  },
37
36
  "required": [
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.twindev.org/immutable-proof/ImmutableProofFailure",
4
+ "title": "ImmutableProofFailure",
5
+ "description": "The failure reason of the proof.",
6
+ "oneOf": [
7
+ {
8
+ "const": "notIssued",
9
+ "description": "Proof not yet issued."
10
+ },
11
+ {
12
+ "const": "proofMissing",
13
+ "description": "Proof missing."
14
+ },
15
+ {
16
+ "const": "verificationFailure",
17
+ "description": "Verification failure."
18
+ },
19
+ {
20
+ "const": "revoked",
21
+ "description": "Revoked."
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.twindev.org/immutable-proof/ImmutableProofReceipt",
4
+ "title": "ImmutableProofReceipt",
5
+ "description": "Interface describing an immutable proof receipt.",
6
+ "type": "object",
7
+ "properties": {
8
+ "@context": {
9
+ "type": "array",
10
+ "prefixItems": [
11
+ {
12
+ "const": "https://schema.twindev.org/immutable-proof/"
13
+ },
14
+ {
15
+ "const": "https://schema.twindev.org/common/"
16
+ }
17
+ ],
18
+ "items": false,
19
+ "minItems": 2,
20
+ "maxItems": 2,
21
+ "description": "JSON-LD Context."
22
+ },
23
+ "type": {
24
+ "const": "ImmutableProofReceipt",
25
+ "description": "JSON-LD Type."
26
+ },
27
+ "immutableReceipt": {
28
+ "$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject",
29
+ "description": "The immutable receipt detail for where the proof is stored."
30
+ },
31
+ "verifiableStorageId": {
32
+ "type": "string",
33
+ "description": "The verifiable storage id for where the proof is stored."
34
+ }
35
+ },
36
+ "required": [
37
+ "type"
38
+ ]
39
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.twindev.org/immutable-proof/ImmutableProofVerification",
4
+ "title": "ImmutableProofVerification",
5
+ "description": "Interface describing an immutable proof verification.",
6
+ "type": "object",
7
+ "properties": {
8
+ "@context": {
9
+ "const": "https://schema.twindev.org/immutable-proof/",
10
+ "description": "JSON-LD Context."
11
+ },
12
+ "type": {
13
+ "const": "ImmutableProofVerification",
14
+ "description": "JSON-LD Type."
15
+ },
16
+ "verified": {
17
+ "type": "boolean",
18
+ "description": "Was the verification successful."
19
+ },
20
+ "failure": {
21
+ "$ref": "https://schema.twindev.org/immutable-proof/ImmutableProofFailure",
22
+ "description": "If the verification was unsuccessful the failure reason."
23
+ }
24
+ },
25
+ "required": [
26
+ "@context",
27
+ "type",
28
+ "verified"
29
+ ]
30
+ }
@@ -18,7 +18,7 @@ export interface IImmutableProof {
18
18
  id?: string;
19
19
  /**
20
20
  * The integrity hash of the object associated with the proof.
21
- * json-ld namespace:twin-common
21
+ * @json-ld namespace:twin-common
22
22
  */
23
23
  proofIntegrity: string;
24
24
  }
@@ -15,12 +15,12 @@ export interface IImmutableProofReceipt {
15
15
  type: typeof ImmutableProofTypes.ImmutableProofReceipt;
16
16
  /**
17
17
  * The immutable receipt detail for where the proof is stored.
18
- * json-ld id
18
+ * @json-ld id
19
19
  */
20
20
  immutableReceipt?: IJsonLdNodeObject;
21
21
  /**
22
22
  * The verifiable storage id for where the proof is stored.
23
- * json-ld id
23
+ * @json-ld id
24
24
  */
25
25
  verifiableStorageId?: string;
26
26
  }
@@ -15,12 +15,12 @@ export interface IImmutableProofVerification {
15
15
  type: typeof ImmutableProofTypes.ImmutableProofVerification;
16
16
  /**
17
17
  * Was the verification successful.
18
- * json-ld namespace:twin-common
18
+ * @json-ld namespace:twin-common
19
19
  */
20
20
  verified: boolean;
21
21
  /**
22
22
  * If the verification was unsuccessful the failure reason.
23
- * json-ld type:schema:Text
23
+ * @json-ld type:schema:Text
24
24
  */
25
25
  failure?: ImmutableProofFailure;
26
26
  }
@@ -14,6 +14,10 @@ export declare const ImmutableProofTypes: {
14
14
  * Represents Immutable Proof Verification.
15
15
  */
16
16
  readonly ImmutableProofVerification: "ImmutableProofVerification";
17
+ /**
18
+ * Represents Immutable Proof Failure.
19
+ */
20
+ readonly ImmutableProofFailure: "ImmutableProofFailure";
17
21
  };
18
22
  /**
19
23
  * The types of immutable proof data.
package/docs/changelog.md CHANGED
@@ -1,4 +1,11 @@
1
- # @twin.org/immutable-proof-models - Changelog
1
+ # Changelog
2
+
3
+ ## [0.0.3-next.11](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-models-v0.0.3-next.10...immutable-proof-models-v0.0.3-next.11) (2026-03-25)
4
+
5
+
6
+ ### Features
7
+
8
+ * add missing proof type registration ([1e9f52b](https://github.com/twinfoundation/immutable-proof/commit/1e9f52b88ab201e97c9d2aa7611fb8f77a82d614))
2
9
 
3
10
  ## [0.0.3-next.10](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-models-v0.0.3-next.9...immutable-proof-models-v0.0.3-next.10) (2026-02-25)
4
11
 
package/docs/examples.md CHANGED
@@ -1 +1,72 @@
1
- # @twin.org/immutable-proof-models - Examples
1
+ # Immutable Proof Models Examples
2
+
3
+ These snippets show how to register data types and then use the immutable proof model contracts in request and response flows.
4
+
5
+ ## ImmutableProofDataTypes
6
+
7
+ ```typescript
8
+ import { DataTypeHandlerFactory } from '@twin.org/data-core';
9
+ import { ImmutableProofDataTypes, ImmutableProofTypes } from '@twin.org/immutable-proof-models';
10
+
11
+ ImmutableProofDataTypes.registerTypes();
12
+
13
+ const handler = DataTypeHandlerFactory.get(
14
+ 'https://schema.twindev.org/immutable-proof/ImmutableProof'
15
+ );
16
+ console.log(handler.type === ImmutableProofTypes.ImmutableProof); // true
17
+ ```
18
+
19
+ ## Model Contracts
20
+
21
+ ```typescript
22
+ import type {
23
+ IImmutableProofCreateRequest,
24
+ IImmutableProofGetResponse,
25
+ IImmutableProofVerifyResponse
26
+ } from '@twin.org/immutable-proof-models';
27
+
28
+ const createRequest: IImmutableProofCreateRequest = {
29
+ body: {
30
+ document: {
31
+ '@context': 'https://schema.org',
32
+ type: 'Person',
33
+ name: 'Alice Example'
34
+ }
35
+ }
36
+ };
37
+
38
+ console.log(createRequest.body.document.type); // Person
39
+ ```
40
+
41
+ ```typescript
42
+ import { ImmutableProofFailure, ImmutableProofTypes } from '@twin.org/immutable-proof-models';
43
+ import type {
44
+ IImmutableProofGetResponse,
45
+ IImmutableProofVerifyResponse
46
+ } from '@twin.org/immutable-proof-models';
47
+
48
+ const getResponse: IImmutableProofGetResponse = {
49
+ body: {
50
+ '@context': ['https://www.w3.org/2018/credentials/v1'],
51
+ type: ['VerifiableCredential', ImmutableProofTypes.ImmutableProof],
52
+ issuer: 'did:iota:tst:issuer',
53
+ id: 'immutable-proof:01JABCDEF1234567890',
54
+ credentialSubject: {
55
+ id: 'https://example.org/documents/100',
56
+ proofIntegrity: 'yEr9VvYCGDh2Ww1YwQMehUy4LlW35mLhX8j8R8U6x0g='
57
+ }
58
+ }
59
+ };
60
+
61
+ const verifyResponse: IImmutableProofVerifyResponse = {
62
+ body: {
63
+ '@context': 'https://schema.twindev.org/immutable-proof',
64
+ type: ImmutableProofTypes.ImmutableProofVerification,
65
+ verified: false,
66
+ failure: ImmutableProofFailure.ProofMissing
67
+ }
68
+ };
69
+
70
+ console.log(getResponse.body.id); // immutable-proof:01JABCDEF1234567890
71
+ console.log(verifyResponse.body.failure); // proof-missing
72
+ ```
@@ -14,7 +14,7 @@ Handle all the data types for immutable proof.
14
14
 
15
15
  ## Methods
16
16
 
17
- ### registerTypes()
17
+ ### registerTypes() {#registertypes}
18
18
 
19
19
  > `static` **registerTypes**(): `void`
20
20
 
@@ -4,33 +4,32 @@ Interface describing an immutable proof state.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### @context?
7
+ ### @context? {#context}
8
8
 
9
- > `optional` **@context**: \[`"https://schema.twindev.org/immutable-proof/"`, `"https://schema.twindev.org/common/"`\]
9
+ > `optional` **@context?**: \[`"https://schema.twindev.org/immutable-proof/"`, `"https://schema.twindev.org/common/"`\]
10
10
 
11
11
  JSON-LD Context.
12
12
 
13
13
  ***
14
14
 
15
- ### type?
15
+ ### type? {#type}
16
16
 
17
- > `optional` **type**: `"ImmutableProof"`
17
+ > `optional` **type?**: `"ImmutableProof"`
18
18
 
19
19
  JSON-LD Type.
20
20
 
21
21
  ***
22
22
 
23
- ### id?
23
+ ### id? {#id}
24
24
 
25
- > `optional` **id**: `string`
25
+ > `optional` **id?**: `string`
26
26
 
27
27
  The id of the object associated with the proof.
28
28
 
29
29
  ***
30
30
 
31
- ### proofIntegrity
31
+ ### proofIntegrity {#proofintegrity}
32
32
 
33
33
  > **proofIntegrity**: `string`
34
34
 
35
35
  The integrity hash of the object associated with the proof.
36
- json-ld namespace:twin-common
@@ -8,7 +8,7 @@ Interface describing an immutable proof contract.
8
8
 
9
9
  ## Methods
10
10
 
11
- ### create()
11
+ ### create() {#create}
12
12
 
13
13
  > **create**(`document`): `Promise`\<`string`\>
14
14
 
@@ -30,7 +30,7 @@ The id of the new proof.
30
30
 
31
31
  ***
32
32
 
33
- ### get()
33
+ ### get() {#get}
34
34
 
35
35
  > **get**(`id`): `Promise`\<`IDidVerifiableCredential`\>
36
36
 
@@ -56,7 +56,7 @@ NotFoundError if the proof is not found.
56
56
 
57
57
  ***
58
58
 
59
- ### verify()
59
+ ### verify() {#verify}
60
60
 
61
61
  > **verify**(`id`): `Promise`\<[`IImmutableProofVerification`](IImmutableProofVerification.md)\>
62
62
 
@@ -82,7 +82,7 @@ NotFoundError if the proof is not found.
82
82
 
83
83
  ***
84
84
 
85
- ### removeVerifiable()
85
+ ### removeVerifiable() {#removeverifiable}
86
86
 
87
87
  > **removeVerifiable**(`id`): `Promise`\<`void`\>
88
88
 
@@ -4,7 +4,7 @@ Create a proof.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
7
+ ### body {#body}
8
8
 
9
9
  > **body**: `object`
10
10
 
@@ -4,7 +4,7 @@ Event bus payload for proof created.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### id
7
+ ### id {#id}
8
8
 
9
9
  > **id**: `string`
10
10
 
@@ -4,9 +4,9 @@ Get a proof.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### headers?
7
+ ### headers? {#headers}
8
8
 
9
- > `optional` **headers**: `object`
9
+ > `optional` **headers?**: `object`
10
10
 
11
11
  The headers which can be used to determine the response data type.
12
12
 
@@ -16,7 +16,7 @@ The headers which can be used to determine the response data type.
16
16
 
17
17
  ***
18
18
 
19
- ### pathParams
19
+ ### pathParams {#pathparams}
20
20
 
21
21
  > **pathParams**: `object`
22
22
 
@@ -4,9 +4,9 @@ Response to getting an immutable proof.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### headers?
7
+ ### headers? {#headers}
8
8
 
9
- > `optional` **headers**: `object`
9
+ > `optional` **headers?**: `object`
10
10
 
11
11
  The headers which can be used to determine the response data type.
12
12
 
@@ -16,7 +16,7 @@ The headers which can be used to determine the response data type.
16
16
 
17
17
  ***
18
18
 
19
- ### body
19
+ ### body {#body}
20
20
 
21
21
  > **body**: `IDidVerifiableCredential`
22
22
 
@@ -4,15 +4,15 @@ Interface describing an immutable proof receipt.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### @context?
7
+ ### @context? {#context}
8
8
 
9
- > `optional` **@context**: \[`"https://schema.twindev.org/immutable-proof/"`, `"https://schema.twindev.org/common/"`\]
9
+ > `optional` **@context?**: \[`"https://schema.twindev.org/immutable-proof/"`, `"https://schema.twindev.org/common/"`\]
10
10
 
11
11
  JSON-LD Context.
12
12
 
13
13
  ***
14
14
 
15
- ### type
15
+ ### type {#type}
16
16
 
17
17
  > **type**: `"ImmutableProofReceipt"`
18
18
 
@@ -20,18 +20,16 @@ JSON-LD Type.
20
20
 
21
21
  ***
22
22
 
23
- ### immutableReceipt?
23
+ ### immutableReceipt? {#immutablereceipt}
24
24
 
25
- > `optional` **immutableReceipt**: `IJsonLdNodeObject`
25
+ > `optional` **immutableReceipt?**: `IJsonLdNodeObject`
26
26
 
27
27
  The immutable receipt detail for where the proof is stored.
28
- json-ld id
29
28
 
30
29
  ***
31
30
 
32
- ### verifiableStorageId?
31
+ ### verifiableStorageId? {#verifiablestorageid}
33
32
 
34
- > `optional` **verifiableStorageId**: `string`
33
+ > `optional` **verifiableStorageId?**: `string`
35
34
 
36
35
  The verifiable storage id for where the proof is stored.
37
- json-ld id
@@ -4,7 +4,7 @@ Interface describing an immutable proof verification.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### @context
7
+ ### @context {#context}
8
8
 
9
9
  > **@context**: `"https://schema.twindev.org/immutable-proof/"`
10
10
 
@@ -12,7 +12,7 @@ JSON-LD Context.
12
12
 
13
13
  ***
14
14
 
15
- ### type
15
+ ### type {#type}
16
16
 
17
17
  > **type**: `"ImmutableProofVerification"`
18
18
 
@@ -20,18 +20,16 @@ JSON-LD Type.
20
20
 
21
21
  ***
22
22
 
23
- ### verified
23
+ ### verified {#verified}
24
24
 
25
25
  > **verified**: `boolean`
26
26
 
27
27
  Was the verification successful.
28
- json-ld namespace:twin-common
29
28
 
30
29
  ***
31
30
 
32
- ### failure?
31
+ ### failure? {#failure}
33
32
 
34
- > `optional` **failure**: [`ImmutableProofFailure`](../type-aliases/ImmutableProofFailure.md)
33
+ > `optional` **failure?**: [`ImmutableProofFailure`](../type-aliases/ImmutableProofFailure.md)
35
34
 
36
35
  If the verification was unsuccessful the failure reason.
37
- json-ld type:schema:Text
@@ -4,9 +4,9 @@ Verify a proof.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### headers?
7
+ ### headers? {#headers}
8
8
 
9
- > `optional` **headers**: `object`
9
+ > `optional` **headers?**: `object`
10
10
 
11
11
  The headers which can be used to determine the response data type.
12
12
 
@@ -16,7 +16,7 @@ The headers which can be used to determine the response data type.
16
16
 
17
17
  ***
18
18
 
19
- ### pathParams
19
+ ### pathParams {#pathparams}
20
20
 
21
21
  > **pathParams**: `object`
22
22
 
@@ -4,9 +4,9 @@ Response to verifying an immutable proof.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### headers?
7
+ ### headers? {#headers}
8
8
 
9
- > `optional` **headers**: `object`
9
+ > `optional` **headers?**: `object`
10
10
 
11
11
  The headers which can be used to determine the response data type.
12
12
 
@@ -16,7 +16,7 @@ The headers which can be used to determine the response data type.
16
16
 
17
17
  ***
18
18
 
19
- ### body
19
+ ### body {#body}
20
20
 
21
21
  > **body**: [`IImmutableProofVerification`](IImmutableProofVerification.md)
22
22
 
@@ -6,37 +6,37 @@ The contexts of immutable proof data.
6
6
 
7
7
  ## Type Declaration
8
8
 
9
- ### Namespace
9
+ ### Namespace {#namespace}
10
10
 
11
11
  > `readonly` **Namespace**: `"https://schema.twindev.org/immutable-proof/"` = `"https://schema.twindev.org/immutable-proof/"`
12
12
 
13
13
  The canonical RDF namespace URI for Immutable Proof.
14
14
 
15
- ### Context
15
+ ### Context {#context}
16
16
 
17
17
  > `readonly` **Context**: `"https://schema.twindev.org/immutable-proof/"` = `"https://schema.twindev.org/immutable-proof/"`
18
18
 
19
19
  The value to use in context for Immutable Proof.
20
20
 
21
- ### JsonLdContext
21
+ ### JsonLdContext {#jsonldcontext}
22
22
 
23
23
  > `readonly` **JsonLdContext**: `"https://schema.twindev.org/immutable-proof/types.jsonld"` = `"https://schema.twindev.org/immutable-proof/types.jsonld"`
24
24
 
25
25
  The JSON-LD Context URL for Immutable Proof.
26
26
 
27
- ### NamespaceCommon
27
+ ### NamespaceCommon {#namespacecommon}
28
28
 
29
29
  > `readonly` **NamespaceCommon**: `"https://schema.twindev.org/common/"` = `"https://schema.twindev.org/common/"`
30
30
 
31
31
  The canonical RDF namespace URI for TWIN Common.
32
32
 
33
- ### ContextCommon
33
+ ### ContextCommon {#contextcommon}
34
34
 
35
35
  > `readonly` **ContextCommon**: `"https://schema.twindev.org/common/"` = `"https://schema.twindev.org/common/"`
36
36
 
37
37
  The value to use in JSON-LD context for TWIN Common.
38
38
 
39
- ### JsonLdContextCommon
39
+ ### JsonLdContextCommon {#jsonldcontextcommon}
40
40
 
41
41
  > `readonly` **JsonLdContextCommon**: `"https://schema.twindev.org/common/types.jsonld"` = `"https://schema.twindev.org/common/types.jsonld"`
42
42
 
@@ -6,25 +6,25 @@ The failure reason of the proof.
6
6
 
7
7
  ## Type Declaration
8
8
 
9
- ### NotIssued
9
+ ### NotIssued {#notissued}
10
10
 
11
11
  > `readonly` **NotIssued**: `"notIssued"` = `"notIssued"`
12
12
 
13
13
  Proof not yet issued.
14
14
 
15
- ### ProofMissing
15
+ ### ProofMissing {#proofmissing}
16
16
 
17
17
  > `readonly` **ProofMissing**: `"proofMissing"` = `"proofMissing"`
18
18
 
19
19
  Proof missing.
20
20
 
21
- ### VerificationFailure
21
+ ### VerificationFailure {#verificationfailure}
22
22
 
23
23
  > `readonly` **VerificationFailure**: `"verificationFailure"` = `"verificationFailure"`
24
24
 
25
25
  Verification failure.
26
26
 
27
- ### Revoked
27
+ ### Revoked {#revoked}
28
28
 
29
29
  > `readonly` **Revoked**: `"revoked"` = `"revoked"`
30
30
 
@@ -6,7 +6,7 @@ The topics for immutable proof event bus notifications.
6
6
 
7
7
  ## Type Declaration
8
8
 
9
- ### ProofCreated
9
+ ### ProofCreated {#proofcreated}
10
10
 
11
11
  > `readonly` **ProofCreated**: `"immutable-proof:proof-created"` = `"immutable-proof:proof-created"`
12
12
 
@@ -6,20 +6,26 @@ The types of immutable proof data.
6
6
 
7
7
  ## Type Declaration
8
8
 
9
- ### ImmutableProof
9
+ ### ImmutableProof {#immutableproof}
10
10
 
11
11
  > `readonly` **ImmutableProof**: `"ImmutableProof"` = `"ImmutableProof"`
12
12
 
13
13
  Represents Immutable Proof.
14
14
 
15
- ### ImmutableProofReceipt
15
+ ### ImmutableProofReceipt {#immutableproofreceipt}
16
16
 
17
17
  > `readonly` **ImmutableProofReceipt**: `"ImmutableProofReceipt"` = `"ImmutableProofReceipt"`
18
18
 
19
19
  Represents Immutable Proof Receipt.
20
20
 
21
- ### ImmutableProofVerification
21
+ ### ImmutableProofVerification {#immutableproofverification}
22
22
 
23
23
  > `readonly` **ImmutableProofVerification**: `"ImmutableProofVerification"` = `"ImmutableProofVerification"`
24
24
 
25
25
  Represents Immutable Proof Verification.
26
+
27
+ ### ImmutableProofFailure {#immutableprooffailure}
28
+
29
+ > `readonly` **ImmutableProofFailure**: `"ImmutableProofFailure"` = `"ImmutableProofFailure"`
30
+
31
+ Represents Immutable Proof Failure.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@twin.org/immutable-proof-models",
3
- "version": "0.0.3-next.10",
4
- "description": "Models which define the structure of the immutable proof connectors and services",
3
+ "version": "0.0.3-next.11",
4
+ "description": "Shared model contracts, schema types, and context constants for immutable proof workflows",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/twinfoundation/immutable-proof.git",