@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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/attestation-models",
3
- "version": "0.0.2-next.4",
4
- "description": "Models which define the structure of the attestation connectors and services",
3
+ "version": "0.0.3-next.10",
4
+ "description": "Shared models and data types for attestation connectors and services.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/attestation.git",
7
+ "url": "git+https://github.com/iotaledger/attestation.git",
8
8
  "directory": "packages/attestation-models"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
@@ -23,20 +23,18 @@
23
23
  "@twin.org/standards-w3c-did": "next",
24
24
  "@twin.org/web": "next"
25
25
  },
26
- "main": "./dist/cjs/index.cjs",
27
- "module": "./dist/esm/index.mjs",
26
+ "main": "./dist/es/index.js",
28
27
  "types": "./dist/types/index.d.ts",
29
28
  "exports": {
30
29
  ".": {
31
30
  "types": "./dist/types/index.d.ts",
32
- "require": "./dist/cjs/index.cjs",
33
- "import": "./dist/esm/index.mjs"
31
+ "import": "./dist/es/index.js",
32
+ "default": "./dist/es/index.js"
34
33
  },
35
34
  "./locales/*.json": "./locales/*.json"
36
35
  },
37
36
  "files": [
38
- "dist/cjs",
39
- "dist/esm",
37
+ "dist/es",
40
38
  "dist/types",
41
39
  "locales",
42
40
  "docs"
@@ -56,7 +54,7 @@
56
54
  "schemas"
57
55
  ],
58
56
  "bugs": {
59
- "url": "git+https://github.com/twinfoundation/attestation/issues"
57
+ "url": "git+https://github.com/iotaledger/attestation/issues"
60
58
  },
61
59
  "homepage": "https://twindev.org"
62
60
  }
@@ -1,217 +0,0 @@
1
- 'use strict';
2
-
3
- var dataCore = require('@twin.org/data-core');
4
- var core = require('@twin.org/core');
5
-
6
- // Copyright 2024 IOTA Stiftung.
7
- // SPDX-License-Identifier: Apache-2.0.
8
- /**
9
- * The contexts of attestation data.
10
- */
11
- // eslint-disable-next-line @typescript-eslint/naming-convention
12
- const AttestationContexts = {
13
- /**
14
- * The context root for the attestation types.
15
- */
16
- ContextRoot: "https://schema.twindev.org/attestation/",
17
- /**
18
- * The context root for the common types.
19
- */
20
- ContextRootCommon: "https://schema.twindev.org/common/"
21
- };
22
-
23
- // Copyright 2024 IOTA Stiftung.
24
- // SPDX-License-Identifier: Apache-2.0.
25
- /**
26
- * The types of attestation data.
27
- */
28
- // eslint-disable-next-line @typescript-eslint/naming-convention
29
- const AttestationTypes = {
30
- /**
31
- * Represents attestation information.
32
- */
33
- Information: "Information",
34
- /**
35
- * Represents attestation JWT proof.
36
- */
37
- JwtProof: "JwtProof"
38
- };
39
-
40
- var $schema$1 = "https://json-schema.org/draft/2020-12/schema";
41
- var $id$1 = "https://schema.twindev.org/attestation/AttestationInformation";
42
- var description$1 = "Interface describing the collated attestation information.";
43
- var type$1 = "object";
44
- var properties$1 = {
45
- "@context": {
46
- type: "array",
47
- minItems: 3,
48
- items: {
49
- $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
50
- },
51
- description: "JSON-LD Context.",
52
- prefixItems: [
53
- {
54
- type: "string",
55
- "const": "https://schema.twindev.org/attestation/"
56
- },
57
- {
58
- type: "string",
59
- "const": "https://schema.twindev.org/common/"
60
- },
61
- {
62
- type: "string",
63
- "const": "https://schema.org"
64
- }
65
- ]
66
- },
67
- type: {
68
- type: "string",
69
- "const": "Information",
70
- description: "JSON-LD Type."
71
- },
72
- id: {
73
- type: "string",
74
- description: "The unique identifier of the attestation."
75
- },
76
- dateCreated: {
77
- type: "string",
78
- description: "Created date/time of the attestation in ISO format."
79
- },
80
- dateTransferred: {
81
- type: "string",
82
- description: "Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner."
83
- },
84
- ownerIdentity: {
85
- type: "string",
86
- description: "The identity of the owner."
87
- },
88
- holderIdentity: {
89
- type: "string",
90
- description: "The identity of the current holder, can be undefined if owner is still the holder."
91
- },
92
- attestationObject: {
93
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
94
- description: "The data that was attested."
95
- },
96
- proof: {
97
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
98
- description: "The proof for the attested data."
99
- },
100
- verified: {
101
- type: "boolean",
102
- description: "Whether the attestation has been verified."
103
- },
104
- verificationFailure: {
105
- type: "string",
106
- description: "The verification failure message."
107
- }
108
- };
109
- var required$1 = [
110
- "@context",
111
- "type",
112
- "id",
113
- "dateCreated",
114
- "ownerIdentity",
115
- "attestationObject"
116
- ];
117
- var additionalProperties$1 = false;
118
- var AttestationInformationSchema = {
119
- $schema: $schema$1,
120
- $id: $id$1,
121
- description: description$1,
122
- type: type$1,
123
- properties: properties$1,
124
- required: required$1,
125
- additionalProperties: additionalProperties$1
126
- };
127
-
128
- var $schema = "https://json-schema.org/draft/2020-12/schema";
129
- var $id = "https://schema.twindev.org/attestation/AttestationJwtProof";
130
- var description = "Interface describing an attestation proof.";
131
- var type = "object";
132
- var properties = {
133
- "@context": {
134
- anyOf: [
135
- {
136
- type: "string",
137
- "const": "https://schema.twindev.org/attestation/"
138
- },
139
- {
140
- type: "array",
141
- minItems: 1,
142
- items: {
143
- $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
144
- },
145
- prefixItems: [
146
- {
147
- type: "string",
148
- "const": "https://schema.twindev.org/attestation/"
149
- }
150
- ]
151
- }
152
- ],
153
- description: "JSON-LD Context."
154
- },
155
- type: {
156
- type: "string",
157
- "const": "JwtProof",
158
- description: "The type of the proof."
159
- },
160
- value: {
161
- type: "string",
162
- description: "The value of the proof."
163
- }
164
- };
165
- var required = [
166
- "@context",
167
- "type",
168
- "value"
169
- ];
170
- var additionalProperties = false;
171
- var AttestationJwtProofSchema = {
172
- $schema: $schema,
173
- $id: $id,
174
- description: description,
175
- type: type,
176
- properties: properties,
177
- required: required,
178
- additionalProperties: additionalProperties
179
- };
180
-
181
- // Copyright 2024 IOTA Stiftung.
182
- // SPDX-License-Identifier: Apache-2.0.
183
- /**
184
- * Handle all the data types for attestation.
185
- */
186
- class AttestationDataTypes {
187
- /**
188
- * Register all the data types.
189
- */
190
- static registerTypes() {
191
- dataCore.DataTypeHandlerFactory.register(`${AttestationContexts.ContextRoot}${AttestationTypes.Information}`, () => ({
192
- context: AttestationContexts.ContextRoot,
193
- type: AttestationTypes.Information,
194
- defaultValue: {},
195
- jsonSchema: async () => AttestationInformationSchema
196
- }));
197
- dataCore.DataTypeHandlerFactory.register(`${AttestationContexts.ContextRoot}${AttestationTypes.JwtProof}`, () => ({
198
- context: AttestationContexts.ContextRoot,
199
- type: AttestationTypes.JwtProof,
200
- defaultValue: {},
201
- jsonSchema: async () => AttestationJwtProofSchema
202
- }));
203
- }
204
- }
205
-
206
- // Copyright 2024 IOTA Stiftung.
207
- // SPDX-License-Identifier: Apache-2.0.
208
- /**
209
- * Factory for creating attestation connectors.
210
- */
211
- // eslint-disable-next-line @typescript-eslint/naming-convention
212
- const AttestationConnectorFactory = core.Factory.createFactory("attestation");
213
-
214
- exports.AttestationConnectorFactory = AttestationConnectorFactory;
215
- exports.AttestationContexts = AttestationContexts;
216
- exports.AttestationDataTypes = AttestationDataTypes;
217
- exports.AttestationTypes = AttestationTypes;
@@ -1,212 +0,0 @@
1
- import { DataTypeHandlerFactory } from '@twin.org/data-core';
2
- import { Factory } from '@twin.org/core';
3
-
4
- // Copyright 2024 IOTA Stiftung.
5
- // SPDX-License-Identifier: Apache-2.0.
6
- /**
7
- * The contexts of attestation data.
8
- */
9
- // eslint-disable-next-line @typescript-eslint/naming-convention
10
- const AttestationContexts = {
11
- /**
12
- * The context root for the attestation types.
13
- */
14
- ContextRoot: "https://schema.twindev.org/attestation/",
15
- /**
16
- * The context root for the common types.
17
- */
18
- ContextRootCommon: "https://schema.twindev.org/common/"
19
- };
20
-
21
- // Copyright 2024 IOTA Stiftung.
22
- // SPDX-License-Identifier: Apache-2.0.
23
- /**
24
- * The types of attestation data.
25
- */
26
- // eslint-disable-next-line @typescript-eslint/naming-convention
27
- const AttestationTypes = {
28
- /**
29
- * Represents attestation information.
30
- */
31
- Information: "Information",
32
- /**
33
- * Represents attestation JWT proof.
34
- */
35
- JwtProof: "JwtProof"
36
- };
37
-
38
- var $schema$1 = "https://json-schema.org/draft/2020-12/schema";
39
- var $id$1 = "https://schema.twindev.org/attestation/AttestationInformation";
40
- var description$1 = "Interface describing the collated attestation information.";
41
- var type$1 = "object";
42
- var properties$1 = {
43
- "@context": {
44
- type: "array",
45
- minItems: 3,
46
- items: {
47
- $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
48
- },
49
- description: "JSON-LD Context.",
50
- prefixItems: [
51
- {
52
- type: "string",
53
- "const": "https://schema.twindev.org/attestation/"
54
- },
55
- {
56
- type: "string",
57
- "const": "https://schema.twindev.org/common/"
58
- },
59
- {
60
- type: "string",
61
- "const": "https://schema.org"
62
- }
63
- ]
64
- },
65
- type: {
66
- type: "string",
67
- "const": "Information",
68
- description: "JSON-LD Type."
69
- },
70
- id: {
71
- type: "string",
72
- description: "The unique identifier of the attestation."
73
- },
74
- dateCreated: {
75
- type: "string",
76
- description: "Created date/time of the attestation in ISO format."
77
- },
78
- dateTransferred: {
79
- type: "string",
80
- description: "Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner."
81
- },
82
- ownerIdentity: {
83
- type: "string",
84
- description: "The identity of the owner."
85
- },
86
- holderIdentity: {
87
- type: "string",
88
- description: "The identity of the current holder, can be undefined if owner is still the holder."
89
- },
90
- attestationObject: {
91
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
92
- description: "The data that was attested."
93
- },
94
- proof: {
95
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
96
- description: "The proof for the attested data."
97
- },
98
- verified: {
99
- type: "boolean",
100
- description: "Whether the attestation has been verified."
101
- },
102
- verificationFailure: {
103
- type: "string",
104
- description: "The verification failure message."
105
- }
106
- };
107
- var required$1 = [
108
- "@context",
109
- "type",
110
- "id",
111
- "dateCreated",
112
- "ownerIdentity",
113
- "attestationObject"
114
- ];
115
- var additionalProperties$1 = false;
116
- var AttestationInformationSchema = {
117
- $schema: $schema$1,
118
- $id: $id$1,
119
- description: description$1,
120
- type: type$1,
121
- properties: properties$1,
122
- required: required$1,
123
- additionalProperties: additionalProperties$1
124
- };
125
-
126
- var $schema = "https://json-schema.org/draft/2020-12/schema";
127
- var $id = "https://schema.twindev.org/attestation/AttestationJwtProof";
128
- var description = "Interface describing an attestation proof.";
129
- var type = "object";
130
- var properties = {
131
- "@context": {
132
- anyOf: [
133
- {
134
- type: "string",
135
- "const": "https://schema.twindev.org/attestation/"
136
- },
137
- {
138
- type: "array",
139
- minItems: 1,
140
- items: {
141
- $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
142
- },
143
- prefixItems: [
144
- {
145
- type: "string",
146
- "const": "https://schema.twindev.org/attestation/"
147
- }
148
- ]
149
- }
150
- ],
151
- description: "JSON-LD Context."
152
- },
153
- type: {
154
- type: "string",
155
- "const": "JwtProof",
156
- description: "The type of the proof."
157
- },
158
- value: {
159
- type: "string",
160
- description: "The value of the proof."
161
- }
162
- };
163
- var required = [
164
- "@context",
165
- "type",
166
- "value"
167
- ];
168
- var additionalProperties = false;
169
- var AttestationJwtProofSchema = {
170
- $schema: $schema,
171
- $id: $id,
172
- description: description,
173
- type: type,
174
- properties: properties,
175
- required: required,
176
- additionalProperties: additionalProperties
177
- };
178
-
179
- // Copyright 2024 IOTA Stiftung.
180
- // SPDX-License-Identifier: Apache-2.0.
181
- /**
182
- * Handle all the data types for attestation.
183
- */
184
- class AttestationDataTypes {
185
- /**
186
- * Register all the data types.
187
- */
188
- static registerTypes() {
189
- DataTypeHandlerFactory.register(`${AttestationContexts.ContextRoot}${AttestationTypes.Information}`, () => ({
190
- context: AttestationContexts.ContextRoot,
191
- type: AttestationTypes.Information,
192
- defaultValue: {},
193
- jsonSchema: async () => AttestationInformationSchema
194
- }));
195
- DataTypeHandlerFactory.register(`${AttestationContexts.ContextRoot}${AttestationTypes.JwtProof}`, () => ({
196
- context: AttestationContexts.ContextRoot,
197
- type: AttestationTypes.JwtProof,
198
- defaultValue: {},
199
- jsonSchema: async () => AttestationJwtProofSchema
200
- }));
201
- }
202
- }
203
-
204
- // Copyright 2024 IOTA Stiftung.
205
- // SPDX-License-Identifier: Apache-2.0.
206
- /**
207
- * Factory for creating attestation connectors.
208
- */
209
- // eslint-disable-next-line @typescript-eslint/naming-convention
210
- const AttestationConnectorFactory = Factory.createFactory("attestation");
211
-
212
- export { AttestationConnectorFactory, AttestationContexts, AttestationDataTypes, AttestationTypes };