@twin.org/attestation-models 0.0.2-next.4 → 0.0.3-next.10

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 (56) hide show
  1. package/README.md +1 -1
  2. package/dist/es/dataTypes/attestationDataTypes.js +30 -0
  3. package/dist/es/dataTypes/attestationDataTypes.js.map +1 -0
  4. package/dist/es/factories/attestationConnectorFactory.js +9 -0
  5. package/dist/es/factories/attestationConnectorFactory.js.map +1 -0
  6. package/dist/es/index.js +16 -0
  7. package/dist/es/index.js.map +1 -0
  8. package/dist/es/models/IAttestationComponent.js +2 -0
  9. package/dist/es/models/IAttestationComponent.js.map +1 -0
  10. package/dist/es/models/IAttestationConnector.js +2 -0
  11. package/dist/es/models/IAttestationConnector.js.map +1 -0
  12. package/dist/es/models/IAttestationInformation.js +2 -0
  13. package/dist/es/models/IAttestationInformation.js.map +1 -0
  14. package/dist/es/models/IAttestationJwtProof.js +2 -0
  15. package/dist/es/models/IAttestationJwtProof.js.map +1 -0
  16. package/dist/es/models/api/IAttestationCreateRequest.js +2 -0
  17. package/dist/es/models/api/IAttestationCreateRequest.js.map +1 -0
  18. package/dist/es/models/api/IAttestationDestroyRequest.js +4 -0
  19. package/dist/es/models/api/IAttestationDestroyRequest.js.map +1 -0
  20. package/dist/es/models/api/IAttestationGetRequest.js +2 -0
  21. package/dist/es/models/api/IAttestationGetRequest.js.map +1 -0
  22. package/dist/es/models/api/IAttestationGetResponse.js +2 -0
  23. package/dist/es/models/api/IAttestationGetResponse.js.map +1 -0
  24. package/dist/es/models/api/IAttestationTransferRequest.js +4 -0
  25. package/dist/es/models/api/IAttestationTransferRequest.js.map +1 -0
  26. package/dist/es/models/attestationContexts.js +33 -0
  27. package/dist/es/models/attestationContexts.js.map +1 -0
  28. package/dist/es/models/attestationTypes.js +17 -0
  29. package/dist/es/models/attestationTypes.js.map +1 -0
  30. package/dist/es/schemas/AttestationInformation.json +76 -0
  31. package/dist/es/schemas/AttestationJwtProof.json +42 -0
  32. package/dist/types/factories/attestationConnectorFactory.d.ts +1 -1
  33. package/dist/types/index.d.ts +13 -13
  34. package/dist/types/models/IAttestationComponent.d.ts +4 -8
  35. package/dist/types/models/IAttestationConnector.d.ts +1 -1
  36. package/dist/types/models/IAttestationInformation.d.ts +13 -5
  37. package/dist/types/models/IAttestationJwtProof.d.ts +4 -3
  38. package/dist/types/models/api/IAttestationGetResponse.d.ts +1 -1
  39. package/dist/types/models/attestationContexts.d.ts +20 -4
  40. package/docs/changelog.md +106 -26
  41. package/docs/examples.md +12 -1
  42. package/docs/reference/classes/AttestationDataTypes.md +1 -1
  43. package/docs/reference/interfaces/IAttestationComponent.md +7 -39
  44. package/docs/reference/interfaces/IAttestationConnector.md +4 -12
  45. package/docs/reference/interfaces/IAttestationCreateRequest.md +2 -2
  46. package/docs/reference/interfaces/IAttestationDestroyRequest.md +1 -1
  47. package/docs/reference/interfaces/IAttestationGetRequest.md +3 -3
  48. package/docs/reference/interfaces/IAttestationGetResponse.md +3 -3
  49. package/docs/reference/interfaces/IAttestationInformation.md +17 -17
  50. package/docs/reference/interfaces/IAttestationJwtProof.md +3 -3
  51. package/docs/reference/interfaces/IAttestationTransferRequest.md +2 -2
  52. package/docs/reference/variables/AttestationContexts.md +30 -6
  53. package/docs/reference/variables/AttestationTypes.md +2 -2
  54. package/package.json +8 -10
  55. package/dist/cjs/index.cjs +0 -217
  56. package/dist/esm/index.mjs +0 -212
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TWIN Attestation Models
2
2
 
3
- Models which define the structure of the attestation contracts and connectors.
3
+ Shared models and data types for attestation connectors and services.
4
4
 
5
5
  ## Installation
6
6
 
@@ -0,0 +1,30 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { DataTypeHandlerFactory } from "@twin.org/data-core";
4
+ import { AttestationContexts } from "../models/attestationContexts.js";
5
+ import { AttestationTypes } from "../models/attestationTypes.js";
6
+ import AttestationInformationSchema from "../schemas/AttestationInformation.json" with { type: "json" };
7
+ import AttestationJwtProofSchema from "../schemas/AttestationJwtProof.json" with { type: "json" };
8
+ /**
9
+ * Handle all the data types for attestation.
10
+ */
11
+ export class AttestationDataTypes {
12
+ /**
13
+ * Register all the data types.
14
+ */
15
+ static registerTypes() {
16
+ DataTypeHandlerFactory.register(`${AttestationContexts.Namespace}${AttestationTypes.Information}`, () => ({
17
+ namespace: AttestationContexts.Namespace,
18
+ type: AttestationTypes.Information,
19
+ defaultValue: {},
20
+ jsonSchema: async () => AttestationInformationSchema
21
+ }));
22
+ DataTypeHandlerFactory.register(`${AttestationContexts.Namespace}${AttestationTypes.JwtProof}`, () => ({
23
+ namespace: AttestationContexts.Namespace,
24
+ type: AttestationTypes.JwtProof,
25
+ defaultValue: {},
26
+ jsonSchema: async () => AttestationJwtProofSchema
27
+ }));
28
+ }
29
+ }
30
+ //# sourceMappingURL=attestationDataTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attestationDataTypes.js","sourceRoot":"","sources":["../../../src/dataTypes/attestationDataTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,4BAA4B,MAAM,wCAAwC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxG,OAAO,yBAAyB,MAAM,qCAAqC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAElG;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAChC;;OAEG;IACI,MAAM,CAAC,aAAa;QAC1B,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,mBAAmB,CAAC,SAAS,GAAG,gBAAgB,CAAC,WAAW,EAAE,EACjE,GAAG,EAAE,CAAC,CAAC;YACN,SAAS,EAAE,mBAAmB,CAAC,SAAS;YACxC,IAAI,EAAE,gBAAgB,CAAC,WAAW;YAClC,YAAY,EAAE,EAAE;YAChB,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,4BAA4B;SACpD,CAAC,CACF,CAAC;QACF,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,mBAAmB,CAAC,SAAS,GAAG,gBAAgB,CAAC,QAAQ,EAAE,EAC9D,GAAG,EAAE,CAAC,CAAC;YACN,SAAS,EAAE,mBAAmB,CAAC,SAAS;YACxC,IAAI,EAAE,gBAAgB,CAAC,QAAQ;YAC/B,YAAY,EAAE,EAAE;YAChB,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,yBAAyB;SACjD,CAAC,CACF,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { DataTypeHandlerFactory } from \"@twin.org/data-core\";\nimport { AttestationContexts } from \"../models/attestationContexts.js\";\nimport { AttestationTypes } from \"../models/attestationTypes.js\";\nimport AttestationInformationSchema from \"../schemas/AttestationInformation.json\" with { type: \"json\" };\nimport AttestationJwtProofSchema from \"../schemas/AttestationJwtProof.json\" with { type: \"json\" };\n\n/**\n * Handle all the data types for attestation.\n */\nexport class AttestationDataTypes {\n\t/**\n\t * Register all the data types.\n\t */\n\tpublic static registerTypes(): void {\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${AttestationContexts.Namespace}${AttestationTypes.Information}`,\n\t\t\t() => ({\n\t\t\t\tnamespace: AttestationContexts.Namespace,\n\t\t\t\ttype: AttestationTypes.Information,\n\t\t\t\tdefaultValue: {},\n\t\t\t\tjsonSchema: async () => AttestationInformationSchema\n\t\t\t})\n\t\t);\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${AttestationContexts.Namespace}${AttestationTypes.JwtProof}`,\n\t\t\t() => ({\n\t\t\t\tnamespace: AttestationContexts.Namespace,\n\t\t\t\ttype: AttestationTypes.JwtProof,\n\t\t\t\tdefaultValue: {},\n\t\t\t\tjsonSchema: async () => AttestationJwtProofSchema\n\t\t\t})\n\t\t);\n\t}\n}\n"]}
@@ -0,0 +1,9 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { Factory } from "@twin.org/core";
4
+ /**
5
+ * Factory for creating attestation connectors.
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8
+ export const AttestationConnectorFactory = Factory.createFactory("attestation");
9
+ //# sourceMappingURL=attestationConnectorFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attestationConnectorFactory.js","sourceRoot":"","sources":["../../../src/factories/attestationConnectorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,2BAA2B,GACvC,OAAO,CAAC,aAAa,CAAwB,aAAa,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@twin.org/core\";\nimport type { IAttestationConnector } from \"../models/IAttestationConnector.js\";\n\n/**\n * Factory for creating attestation connectors.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const AttestationConnectorFactory =\n\tFactory.createFactory<IAttestationConnector>(\"attestation\");\n"]}
@@ -0,0 +1,16 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./dataTypes/attestationDataTypes.js";
4
+ export * from "./factories/attestationConnectorFactory.js";
5
+ export * from "./models/api/IAttestationCreateRequest.js";
6
+ export * from "./models/api/IAttestationDestroyRequest.js";
7
+ export * from "./models/api/IAttestationGetRequest.js";
8
+ export * from "./models/api/IAttestationGetResponse.js";
9
+ export * from "./models/api/IAttestationTransferRequest.js";
10
+ export * from "./models/attestationContexts.js";
11
+ export * from "./models/attestationTypes.js";
12
+ export * from "./models/IAttestationComponent.js";
13
+ export * from "./models/IAttestationConnector.js";
14
+ export * from "./models/IAttestationInformation.js";
15
+ export * from "./models/IAttestationJwtProof.js";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./dataTypes/attestationDataTypes.js\";\nexport * from \"./factories/attestationConnectorFactory.js\";\nexport * from \"./models/api/IAttestationCreateRequest.js\";\nexport * from \"./models/api/IAttestationDestroyRequest.js\";\nexport * from \"./models/api/IAttestationGetRequest.js\";\nexport * from \"./models/api/IAttestationGetResponse.js\";\nexport * from \"./models/api/IAttestationTransferRequest.js\";\nexport * from \"./models/attestationContexts.js\";\nexport * from \"./models/attestationTypes.js\";\nexport * from \"./models/IAttestationComponent.js\";\nexport * from \"./models/IAttestationConnector.js\";\nexport * from \"./models/IAttestationInformation.js\";\nexport * from \"./models/IAttestationJwtProof.js\";\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAttestationComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAttestationComponent.js","sourceRoot":"","sources":["../../../src/models/IAttestationComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { IAttestationInformation } from \"./IAttestationInformation.js\";\n\n/**\n * Interface describing an attestation contract.\n */\nexport interface IAttestationComponent extends IComponent {\n\t/**\n\t * Attest the data and return the collated information.\n\t * @param attestationObject The data to attest.\n\t * @param namespace The namespace of the connector to use for the attestation, defaults to component configured namespace.\n\t * @returns The id of the attestation.\n\t */\n\tcreate(attestationObject: IJsonLdNodeObject, namespace?: string): Promise<string>;\n\n\t/**\n\t * Resolve and verify the attestation id.\n\t * @param id The attestation id to verify.\n\t * @returns The verified attestation details.\n\t */\n\tget(id: string): Promise<IAttestationInformation>;\n\n\t/**\n\t * Transfer the attestation to a new holder.\n\t * @param attestationId The attestation to transfer.\n\t * @param holderIdentity The identity to transfer the attestation to.\n\t * @param holderAddress The address to transfer the attestation to.\n\t * @returns Nothing.\n\t */\n\ttransfer(attestationId: string, holderIdentity: string, holderAddress: string): Promise<void>;\n\n\t/**\n\t * Destroy the attestation.\n\t * @param attestationId The attestation to transfer.\n\t * @returns Nothing.\n\t */\n\tdestroy(attestationId: string): Promise<void>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAttestationConnector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAttestationConnector.js","sourceRoot":"","sources":["../../../src/models/IAttestationConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { IAttestationInformation } from \"./IAttestationInformation.js\";\n\n/**\n * Interface describing an attestation connector.\n */\nexport interface IAttestationConnector extends IComponent {\n\t/**\n\t * Attest the data and return the collated information.\n\t * @param controller The controller identity of the user to access the vault keys.\n\t * @param verificationMethodId The identity verification method to use for attesting the data.\n\t * @param attestationObject The data to attest.\n\t * @returns The collated attestation data.\n\t */\n\tcreate(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tattestationObject: IJsonLdNodeObject\n\t): Promise<string>;\n\n\t/**\n\t * Resolve and verify the attestation id.\n\t * @param id The attestation id to verify.\n\t * @returns The verified attestation details.\n\t */\n\tget(id: string): Promise<IAttestationInformation>;\n\n\t/**\n\t * Transfer the attestation to a new holder.\n\t * @param controller The controller identity of the user to access the vault keys.\n\t * @param attestationId The attestation to transfer.\n\t * @param holderIdentity The holder identity of the attestation.\n\t * @param holderAddress The new controller address of the attestation belonging to the holder.\n\t * @returns Nothing.\n\t */\n\ttransfer(\n\t\tcontroller: string,\n\t\tattestationId: string,\n\t\tholderIdentity: string,\n\t\tholderAddress: string\n\t): Promise<void>;\n\n\t/**\n\t * Destroy the attestation.\n\t * @param controller The controller identity of the user to access the vault keys.\n\t * @param attestationId The attestation to destroy.\n\t * @returns Nothing.\n\t */\n\tdestroy(controller: string, attestationId: string): Promise<void>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAttestationInformation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAttestationInformation.js","sourceRoot":"","sources":["../../../src/models/IAttestationInformation.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type { SchemaOrgContexts } from \"@twin.org/standards-schema-org\";\nimport type { AttestationContexts } from \"./attestationContexts.js\";\nimport type { AttestationTypes } from \"./attestationTypes.js\";\n\n/**\n * Interface describing the collated attestation information.\n */\nexport interface IAttestationInformation {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\": [\n\t\ttypeof SchemaOrgContexts.Context,\n\t\ttypeof AttestationContexts.Context,\n\t\ttypeof AttestationContexts.ContextCommon,\n\t\t...IJsonLdContextDefinitionElement[]\n\t];\n\n\t/**\n\t * JSON-LD Type.\n\t */\n\ttype: typeof AttestationTypes.Information;\n\n\t/**\n\t * The unique identifier of the attestation.\n\t */\n\tid: string;\n\n\t/**\n\t * Created date/time of the attestation in ISO format.\n\t * @json-ld namespace:schema\n\t */\n\tdateCreated: string;\n\n\t/**\n\t * Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner.\n\t * @json-ld type:schema:Date\n\t */\n\tdateTransferred?: string;\n\n\t/**\n\t * The identity of the owner.\n\t * @json-ld type:schema:identifier\n\t */\n\townerIdentity: string;\n\n\t/**\n\t * The identity of the current holder, can be undefined if owner is still the holder.\n\t * @json-ld type:schema:identifier\n\t */\n\tholderIdentity?: string;\n\n\t/**\n\t * The data that was attested.\n\t * @json-ld namespace:twin-common\n\t */\n\tattestationObject: IJsonLdNodeObject;\n\n\t/**\n\t * The proof for the attested data.\n\t * @json-ld namespace:twin-attestation\n\t */\n\tproof?: IJsonLdNodeObject;\n\n\t/**\n\t * Whether the attestation has been verified.\n\t * @json-ld namespace:twin-common\n\t */\n\tverified?: boolean;\n\n\t/**\n\t * The verification failure message.\n\t * @json-ld type:schema:Text\n\t */\n\tverificationFailure?: string;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAttestationJwtProof.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAttestationJwtProof.js","sourceRoot":"","sources":["../../../src/models/IAttestationJwtProof.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionElement } from \"@twin.org/data-json-ld\";\nimport type { AttestationContexts } from \"./attestationContexts.js\";\nimport type { AttestationTypes } from \"./attestationTypes.js\";\n\n/**\n * Interface describing an attestation proof.\n */\nexport interface IAttestationJwtProof {\n\t/**\n\t * JSON-LD Context.\n\t */\n\t\"@context\":\n\t\t| typeof AttestationContexts.Context\n\t\t| [typeof AttestationContexts.Context, ...IJsonLdContextDefinitionElement[]];\n\n\t/**\n\t * The type of the proof.\n\t */\n\ttype: typeof AttestationTypes.JwtProof;\n\n\t/**\n\t * The value of the proof.\n\t * @json-ld type:schema:Text\n\t */\n\tvalue: string;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAttestationCreateRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAttestationCreateRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAttestationCreateRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\n\n/**\n * Attest the data and return the id of the attestation.\n */\nexport interface IAttestationCreateRequest {\n\t/**\n\t * The data to be used in the signing.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The data object to attest.\n\t\t */\n\t\tattestationObject: IJsonLdNodeObject;\n\n\t\t/**\n\t\t * The namespace of the connector to use for the attestation, defaults to component configured namespace.\n\t\t */\n\t\tnamespace?: string;\n\t};\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IAttestationDestroyRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAttestationDestroyRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAttestationDestroyRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Destroy the attestation.\n */\nexport interface IAttestationDestroyRequest {\n\t/**\n\t * The parameters to be used in the destruction.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The attestation id to destroy.\n\t\t */\n\t\tid: string;\n\t};\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAttestationGetRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAttestationGetRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAttestationGetRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes, MimeTypes } from \"@twin.org/web\";\n\n/**\n * Verify that the proof is valid for the attestation.\n */\nexport interface IAttestationGetRequest {\n\t/**\n\t * The headers which can be used to determine the response data type.\n\t */\n\theaders?: {\n\t\t[HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;\n\t};\n\n\t/**\n\t * The parameters to be used in the verification.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The attestation id to verify.\n\t\t */\n\t\tid: string;\n\t};\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAttestationGetResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAttestationGetResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IAttestationGetResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes, MimeTypes } from \"@twin.org/web\";\nimport type { IAttestationInformation } from \"../IAttestationInformation.js\";\n\n/**\n * The response to verifying the attestation.\n */\nexport interface IAttestationGetResponse {\n\t/**\n\t * The headers which can be used to determine the response data type.\n\t */\n\theaders?: {\n\t\t[HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;\n\t};\n\n\t/**\n\t * The data returned from the verification response.\n\t */\n\tbody: IAttestationInformation;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IAttestationTransferRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAttestationTransferRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IAttestationTransferRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Transfer the attestation to a new holder.\n */\nexport interface IAttestationTransferRequest {\n\t/**\n\t * The parameters to be used in the transfer.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The attestation id to transfer.\n\t\t */\n\t\tid: string;\n\t};\n\n\t/**\n\t * The parameters to be used in the transfer.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The new holder identity.\n\t\t */\n\t\tholderIdentity: string;\n\n\t\t/**\n\t\t * The new holder address.\n\t\t */\n\t\tholderAddress: string;\n\t};\n}\n"]}
@@ -0,0 +1,33 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /**
4
+ * The contexts of attestation data.
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ export const AttestationContexts = {
8
+ /**
9
+ * The canonical RDF namespace URI for Attestation.
10
+ */
11
+ Namespace: "https://schema.twindev.org/attestation/",
12
+ /**
13
+ * The value to use in context for Attestation.
14
+ */
15
+ Context: "https://schema.twindev.org/attestation/",
16
+ /**
17
+ * The JSON-LD Context URL for Attestation.
18
+ */
19
+ JsonLdContext: "https://schema.twindev.org/attestation/types.jsonld",
20
+ /**
21
+ * The canonical RDF namespace URI for TWIN Common.
22
+ */
23
+ NamespaceCommon: "https://schema.twindev.org/common/",
24
+ /**
25
+ * The value to use in JSON-LD context for TWIN Common.
26
+ */
27
+ ContextCommon: "https://schema.twindev.org/common/",
28
+ /**
29
+ * The JSON-LD Context URL for TWIN Common.
30
+ */
31
+ JsonLdContextCommon: "https://schema.twindev.org/common/types.jsonld"
32
+ };
33
+ //# sourceMappingURL=attestationContexts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attestationContexts.js","sourceRoot":"","sources":["../../../src/models/attestationContexts.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC;;OAEG;IACH,SAAS,EAAE,yCAAyC;IAEpD;;OAEG;IACH,OAAO,EAAE,yCAAyC;IAElD;;OAEG;IACH,aAAa,EAAE,qDAAqD;IAEpE;;OAEG;IACH,eAAe,EAAE,oCAAoC;IAErD;;OAEG;IACH,aAAa,EAAE,oCAAoC;IAEnD;;OAEG;IACH,mBAAmB,EAAE,gDAAgD;CAC5D,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The contexts of attestation data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const AttestationContexts = {\n\t/**\n\t * The canonical RDF namespace URI for Attestation.\n\t */\n\tNamespace: \"https://schema.twindev.org/attestation/\",\n\n\t/**\n\t * The value to use in context for Attestation.\n\t */\n\tContext: \"https://schema.twindev.org/attestation/\",\n\n\t/**\n\t * The JSON-LD Context URL for Attestation.\n\t */\n\tJsonLdContext: \"https://schema.twindev.org/attestation/types.jsonld\",\n\n\t/**\n\t * The canonical RDF namespace URI for TWIN Common.\n\t */\n\tNamespaceCommon: \"https://schema.twindev.org/common/\",\n\n\t/**\n\t * The value to use in JSON-LD context for TWIN Common.\n\t */\n\tContextCommon: \"https://schema.twindev.org/common/\",\n\n\t/**\n\t * The JSON-LD Context URL for TWIN Common.\n\t */\n\tJsonLdContextCommon: \"https://schema.twindev.org/common/types.jsonld\"\n} as const;\n\n/**\n * The contexts of attestation data.\n */\nexport type AttestationContexts = (typeof AttestationContexts)[keyof typeof AttestationContexts];\n"]}
@@ -0,0 +1,17 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /**
4
+ * The types of attestation data.
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ export const AttestationTypes = {
8
+ /**
9
+ * Represents attestation information.
10
+ */
11
+ Information: "Information",
12
+ /**
13
+ * Represents attestation JWT proof.
14
+ */
15
+ JwtProof: "JwtProof"
16
+ };
17
+ //# sourceMappingURL=attestationTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attestationTypes.js","sourceRoot":"","sources":["../../../src/models/attestationTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B;;OAEG;IACH,WAAW,EAAE,aAAa;IAE1B;;OAEG;IACH,QAAQ,EAAE,UAAU;CACX,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The types of attestation data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const AttestationTypes = {\n\t/**\n\t * Represents attestation information.\n\t */\n\tInformation: \"Information\",\n\n\t/**\n\t * Represents attestation JWT proof.\n\t */\n\tJwtProof: \"JwtProof\"\n} as const;\n\n/**\n * The types of attestation data.\n */\nexport type AttestationTypes = (typeof AttestationTypes)[keyof typeof AttestationTypes];\n"]}
@@ -0,0 +1,76 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.twindev.org/attestation/AttestationInformation",
4
+ "title": "AttestationInformation",
5
+ "description": "Interface describing the collated attestation information.",
6
+ "type": "object",
7
+ "properties": {
8
+ "@context": {
9
+ "type": "array",
10
+ "prefixItems": [
11
+ {
12
+ "const": "https://schema.org"
13
+ },
14
+ {
15
+ "const": "https://schema.twindev.org/attestation/"
16
+ },
17
+ {
18
+ "const": "https://schema.twindev.org/common/"
19
+ }
20
+ ],
21
+ "items": {
22
+ "$ref": "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
23
+ },
24
+ "minItems": 3,
25
+ "description": "JSON-LD Context."
26
+ },
27
+ "type": {
28
+ "const": "Information",
29
+ "description": "JSON-LD Type."
30
+ },
31
+ "id": {
32
+ "type": "string",
33
+ "description": "The unique identifier of the attestation."
34
+ },
35
+ "dateCreated": {
36
+ "type": "string",
37
+ "description": "Created date/time of the attestation in ISO format."
38
+ },
39
+ "dateTransferred": {
40
+ "type": "string",
41
+ "description": "Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner."
42
+ },
43
+ "ownerIdentity": {
44
+ "type": "string",
45
+ "description": "The identity of the owner."
46
+ },
47
+ "holderIdentity": {
48
+ "type": "string",
49
+ "description": "The identity of the current holder, can be undefined if owner is still the holder."
50
+ },
51
+ "attestationObject": {
52
+ "$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject",
53
+ "description": "The data that was attested."
54
+ },
55
+ "proof": {
56
+ "$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject",
57
+ "description": "The proof for the attested data."
58
+ },
59
+ "verified": {
60
+ "type": "boolean",
61
+ "description": "Whether the attestation has been verified."
62
+ },
63
+ "verificationFailure": {
64
+ "type": "string",
65
+ "description": "The verification failure message."
66
+ }
67
+ },
68
+ "required": [
69
+ "@context",
70
+ "type",
71
+ "id",
72
+ "dateCreated",
73
+ "ownerIdentity",
74
+ "attestationObject"
75
+ ]
76
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.twindev.org/attestation/AttestationJwtProof",
4
+ "title": "AttestationJwtProof",
5
+ "description": "Interface describing an attestation proof.",
6
+ "type": "object",
7
+ "properties": {
8
+ "@context": {
9
+ "anyOf": [
10
+ {
11
+ "const": "https://schema.twindev.org/attestation/"
12
+ },
13
+ {
14
+ "type": "array",
15
+ "prefixItems": [
16
+ {
17
+ "const": "https://schema.twindev.org/attestation/"
18
+ }
19
+ ],
20
+ "items": {
21
+ "$ref": "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
22
+ },
23
+ "minItems": 1
24
+ }
25
+ ],
26
+ "description": "JSON-LD Context."
27
+ },
28
+ "type": {
29
+ "const": "JwtProof",
30
+ "description": "The type of the proof."
31
+ },
32
+ "value": {
33
+ "type": "string",
34
+ "description": "The value of the proof."
35
+ }
36
+ },
37
+ "required": [
38
+ "@context",
39
+ "type",
40
+ "value"
41
+ ]
42
+ }
@@ -1,5 +1,5 @@
1
1
  import { Factory } from "@twin.org/core";
2
- import type { IAttestationConnector } from "../models/IAttestationConnector";
2
+ import type { IAttestationConnector } from "../models/IAttestationConnector.js";
3
3
  /**
4
4
  * Factory for creating attestation connectors.
5
5
  */
@@ -1,13 +1,13 @@
1
- export * from "./dataTypes/attestationDataTypes";
2
- export * from "./factories/attestationConnectorFactory";
3
- export * from "./models/api/IAttestationCreateRequest";
4
- export * from "./models/api/IAttestationDestroyRequest";
5
- export * from "./models/api/IAttestationGetRequest";
6
- export * from "./models/api/IAttestationGetResponse";
7
- export * from "./models/api/IAttestationTransferRequest";
8
- export * from "./models/attestationContexts";
9
- export * from "./models/attestationTypes";
10
- export * from "./models/IAttestationComponent";
11
- export * from "./models/IAttestationConnector";
12
- export * from "./models/IAttestationInformation";
13
- export * from "./models/IAttestationJwtProof";
1
+ export * from "./dataTypes/attestationDataTypes.js";
2
+ export * from "./factories/attestationConnectorFactory.js";
3
+ export * from "./models/api/IAttestationCreateRequest.js";
4
+ export * from "./models/api/IAttestationDestroyRequest.js";
5
+ export * from "./models/api/IAttestationGetRequest.js";
6
+ export * from "./models/api/IAttestationGetResponse.js";
7
+ export * from "./models/api/IAttestationTransferRequest.js";
8
+ export * from "./models/attestationContexts.js";
9
+ export * from "./models/attestationTypes.js";
10
+ export * from "./models/IAttestationComponent.js";
11
+ export * from "./models/IAttestationConnector.js";
12
+ export * from "./models/IAttestationInformation.js";
13
+ export * from "./models/IAttestationJwtProof.js";
@@ -1,6 +1,6 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
2
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
- import type { IAttestationInformation } from "./IAttestationInformation";
3
+ import type { IAttestationInformation } from "./IAttestationInformation.js";
4
4
  /**
5
5
  * Interface describing an attestation contract.
6
6
  */
@@ -9,11 +9,9 @@ export interface IAttestationComponent extends IComponent {
9
9
  * Attest the data and return the collated information.
10
10
  * @param attestationObject The data to attest.
11
11
  * @param namespace The namespace of the connector to use for the attestation, defaults to component configured namespace.
12
- * @param identity The identity to perform the attestation operation with.
13
- * @param nodeIdentity The node identity to include in the attestation.
14
12
  * @returns The id of the attestation.
15
13
  */
16
- create(attestationObject: IJsonLdNodeObject, namespace?: string, identity?: string, nodeIdentity?: string): Promise<string>;
14
+ create(attestationObject: IJsonLdNodeObject, namespace?: string): Promise<string>;
17
15
  /**
18
16
  * Resolve and verify the attestation id.
19
17
  * @param id The attestation id to verify.
@@ -25,15 +23,13 @@ export interface IAttestationComponent extends IComponent {
25
23
  * @param attestationId The attestation to transfer.
26
24
  * @param holderIdentity The identity to transfer the attestation to.
27
25
  * @param holderAddress The address to transfer the attestation to.
28
- * @param identity The identity to perform the attestation operation with.
29
26
  * @returns Nothing.
30
27
  */
31
- transfer(attestationId: string, holderIdentity: string, holderAddress: string, identity?: string): Promise<void>;
28
+ transfer(attestationId: string, holderIdentity: string, holderAddress: string): Promise<void>;
32
29
  /**
33
30
  * Destroy the attestation.
34
31
  * @param attestationId The attestation to transfer.
35
- * @param identity The identity to perform the attestation operation with.
36
32
  * @returns Nothing.
37
33
  */
38
- destroy(attestationId: string, identity?: string): Promise<void>;
34
+ destroy(attestationId: string): Promise<void>;
39
35
  }
@@ -1,6 +1,6 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
2
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
- import type { IAttestationInformation } from "./IAttestationInformation";
3
+ import type { IAttestationInformation } from "./IAttestationInformation.js";
4
4
  /**
5
5
  * Interface describing an attestation connector.
6
6
  */
@@ -1,7 +1,7 @@
1
1
  import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
2
  import type { SchemaOrgContexts } from "@twin.org/standards-schema-org";
3
- import type { AttestationContexts } from "./attestationContexts";
4
- import type { AttestationTypes } from "./attestationTypes";
3
+ import type { AttestationContexts } from "./attestationContexts.js";
4
+ import type { AttestationTypes } from "./attestationTypes.js";
5
5
  /**
6
6
  * Interface describing the collated attestation information.
7
7
  */
@@ -10,9 +10,9 @@ export interface IAttestationInformation {
10
10
  * JSON-LD Context.
11
11
  */
12
12
  "@context": [
13
- typeof AttestationContexts.ContextRoot,
14
- typeof AttestationContexts.ContextRootCommon,
15
- typeof SchemaOrgContexts.ContextRoot,
13
+ typeof SchemaOrgContexts.Context,
14
+ typeof AttestationContexts.Context,
15
+ typeof AttestationContexts.ContextCommon,
16
16
  ...IJsonLdContextDefinitionElement[]
17
17
  ];
18
18
  /**
@@ -25,34 +25,42 @@ export interface IAttestationInformation {
25
25
  id: string;
26
26
  /**
27
27
  * Created date/time of the attestation in ISO format.
28
+ * @json-ld namespace:schema
28
29
  */
29
30
  dateCreated: string;
30
31
  /**
31
32
  * Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner.
33
+ * @json-ld type:schema:Date
32
34
  */
33
35
  dateTransferred?: string;
34
36
  /**
35
37
  * The identity of the owner.
38
+ * @json-ld type:schema:identifier
36
39
  */
37
40
  ownerIdentity: string;
38
41
  /**
39
42
  * The identity of the current holder, can be undefined if owner is still the holder.
43
+ * @json-ld type:schema:identifier
40
44
  */
41
45
  holderIdentity?: string;
42
46
  /**
43
47
  * The data that was attested.
48
+ * @json-ld namespace:twin-common
44
49
  */
45
50
  attestationObject: IJsonLdNodeObject;
46
51
  /**
47
52
  * The proof for the attested data.
53
+ * @json-ld namespace:twin-attestation
48
54
  */
49
55
  proof?: IJsonLdNodeObject;
50
56
  /**
51
57
  * Whether the attestation has been verified.
58
+ * @json-ld namespace:twin-common
52
59
  */
53
60
  verified?: boolean;
54
61
  /**
55
62
  * The verification failure message.
63
+ * @json-ld type:schema:Text
56
64
  */
57
65
  verificationFailure?: string;
58
66
  }
@@ -1,6 +1,6 @@
1
1
  import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
2
- import type { AttestationContexts } from "./attestationContexts";
3
- import type { AttestationTypes } from "./attestationTypes";
2
+ import type { AttestationContexts } from "./attestationContexts.js";
3
+ import type { AttestationTypes } from "./attestationTypes.js";
4
4
  /**
5
5
  * Interface describing an attestation proof.
6
6
  */
@@ -8,13 +8,14 @@ export interface IAttestationJwtProof {
8
8
  /**
9
9
  * JSON-LD Context.
10
10
  */
11
- "@context": typeof AttestationContexts.ContextRoot | [typeof AttestationContexts.ContextRoot, ...IJsonLdContextDefinitionElement[]];
11
+ "@context": typeof AttestationContexts.Context | [typeof AttestationContexts.Context, ...IJsonLdContextDefinitionElement[]];
12
12
  /**
13
13
  * The type of the proof.
14
14
  */
15
15
  type: typeof AttestationTypes.JwtProof;
16
16
  /**
17
17
  * The value of the proof.
18
+ * @json-ld type:schema:Text
18
19
  */
19
20
  value: string;
20
21
  }
@@ -1,5 +1,5 @@
1
1
  import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
- import type { IAttestationInformation } from "../IAttestationInformation";
2
+ import type { IAttestationInformation } from "../IAttestationInformation.js";
3
3
  /**
4
4
  * The response to verifying the attestation.
5
5
  */
@@ -3,13 +3,29 @@
3
3
  */
4
4
  export declare const AttestationContexts: {
5
5
  /**
6
- * The context root for the attestation types.
6
+ * The canonical RDF namespace URI for Attestation.
7
7
  */
8
- readonly ContextRoot: "https://schema.twindev.org/attestation/";
8
+ readonly Namespace: "https://schema.twindev.org/attestation/";
9
9
  /**
10
- * The context root for the common types.
10
+ * The value to use in context for Attestation.
11
11
  */
12
- readonly ContextRootCommon: "https://schema.twindev.org/common/";
12
+ readonly Context: "https://schema.twindev.org/attestation/";
13
+ /**
14
+ * The JSON-LD Context URL for Attestation.
15
+ */
16
+ readonly JsonLdContext: "https://schema.twindev.org/attestation/types.jsonld";
17
+ /**
18
+ * The canonical RDF namespace URI for TWIN Common.
19
+ */
20
+ readonly NamespaceCommon: "https://schema.twindev.org/common/";
21
+ /**
22
+ * The value to use in JSON-LD context for TWIN Common.
23
+ */
24
+ readonly ContextCommon: "https://schema.twindev.org/common/";
25
+ /**
26
+ * The JSON-LD Context URL for TWIN Common.
27
+ */
28
+ readonly JsonLdContextCommon: "https://schema.twindev.org/common/types.jsonld";
13
29
  };
14
30
  /**
15
31
  * The contexts of attestation data.