@twin.org/attestation-models 0.0.1-next.3 → 0.0.1-next.30

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 (40) hide show
  1. package/dist/cjs/index.cjs +204 -0
  2. package/dist/esm/index.mjs +202 -1
  3. package/dist/types/dataTypes/attestationDataTypes.d.ts +9 -0
  4. package/dist/types/index.d.ts +9 -8
  5. package/dist/types/models/IAttestationComponent.d.ts +10 -13
  6. package/dist/types/models/IAttestationConnector.d.ts +7 -11
  7. package/dist/types/models/IAttestationInformation.d.ts +33 -9
  8. package/dist/types/models/IAttestationJwtProof.d.ts +20 -0
  9. package/dist/types/models/api/{IAttestationAttestRequest.d.ts → IAttestationCreateRequest.d.ts} +4 -7
  10. package/dist/types/models/api/IAttestationGetRequest.d.ts +21 -0
  11. package/dist/types/models/api/IAttestationGetResponse.d.ts +17 -0
  12. package/dist/types/models/api/IAttestationTransferRequest.d.ts +5 -1
  13. package/dist/types/models/attestationContexts.d.ts +17 -0
  14. package/dist/types/models/attestationTypes.d.ts +17 -0
  15. package/docs/changelog.md +43 -1
  16. package/docs/reference/classes/AttestationDataTypes.md +25 -0
  17. package/docs/reference/index.md +15 -6
  18. package/docs/reference/interfaces/IAttestationComponent.md +47 -49
  19. package/docs/reference/interfaces/IAttestationConnector.md +38 -46
  20. package/docs/reference/interfaces/{IAttestationAttestRequest.md → IAttestationCreateRequest.md} +4 -10
  21. package/docs/reference/interfaces/IAttestationGetRequest.md +29 -0
  22. package/docs/reference/interfaces/IAttestationGetResponse.md +23 -0
  23. package/docs/reference/interfaces/IAttestationInformation.md +44 -16
  24. package/docs/reference/interfaces/IAttestationJwtProof.md +27 -0
  25. package/docs/reference/interfaces/IAttestationTransferRequest.md +7 -1
  26. package/docs/reference/type-aliases/AttestationContexts.md +5 -0
  27. package/docs/reference/type-aliases/AttestationTypes.md +5 -0
  28. package/docs/reference/variables/AttestationContexts.md +19 -0
  29. package/docs/reference/variables/AttestationTypes.md +19 -0
  30. package/package.json +9 -31
  31. package/dist/types/models/IAttestationProof.d.ts +0 -13
  32. package/dist/types/models/api/IAttestationAttestResponse.d.ts +0 -12
  33. package/dist/types/models/api/IAttestationTransferResponse.d.ts +0 -15
  34. package/dist/types/models/api/IAttestationVerifyRequest.d.ts +0 -14
  35. package/dist/types/models/api/IAttestationVerifyResponse.d.ts +0 -23
  36. package/docs/reference/interfaces/IAttestationAttestResponse.md +0 -15
  37. package/docs/reference/interfaces/IAttestationProof.md +0 -19
  38. package/docs/reference/interfaces/IAttestationTransferResponse.md +0 -17
  39. package/docs/reference/interfaces/IAttestationVerifyRequest.md +0 -17
  40. package/docs/reference/interfaces/IAttestationVerifyResponse.md +0 -29
@@ -1,7 +1,208 @@
1
1
  'use strict';
2
2
 
3
+ var dataCore = require('@twin.org/data-core');
3
4
  var core = require('@twin.org/core');
4
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
+
5
206
  // Copyright 2024 IOTA Stiftung.
6
207
  // SPDX-License-Identifier: Apache-2.0.
7
208
  /**
@@ -11,3 +212,6 @@ var core = require('@twin.org/core');
11
212
  const AttestationConnectorFactory = core.Factory.createFactory("attestation");
12
213
 
13
214
  exports.AttestationConnectorFactory = AttestationConnectorFactory;
215
+ exports.AttestationContexts = AttestationContexts;
216
+ exports.AttestationDataTypes = AttestationDataTypes;
217
+ exports.AttestationTypes = AttestationTypes;
@@ -1,5 +1,206 @@
1
+ import { DataTypeHandlerFactory } from '@twin.org/data-core';
1
2
  import { Factory } from '@twin.org/core';
2
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
+
3
204
  // Copyright 2024 IOTA Stiftung.
4
205
  // SPDX-License-Identifier: Apache-2.0.
5
206
  /**
@@ -8,4 +209,4 @@ import { Factory } from '@twin.org/core';
8
209
  // eslint-disable-next-line @typescript-eslint/naming-convention
9
210
  const AttestationConnectorFactory = Factory.createFactory("attestation");
10
211
 
11
- export { AttestationConnectorFactory };
212
+ export { AttestationConnectorFactory, AttestationContexts, AttestationDataTypes, AttestationTypes };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Handle all the data types for attestation.
3
+ */
4
+ export declare class AttestationDataTypes {
5
+ /**
6
+ * Register all the data types.
7
+ */
8
+ static registerTypes(): void;
9
+ }
@@ -1,12 +1,13 @@
1
+ export * from "./dataTypes/attestationDataTypes";
1
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";
2
10
  export * from "./models/IAttestationComponent";
3
11
  export * from "./models/IAttestationConnector";
4
12
  export * from "./models/IAttestationInformation";
5
- export * from "./models/IAttestationProof";
6
- export * from "./models/api/IAttestationAttestRequest";
7
- export * from "./models/api/IAttestationAttestResponse";
8
- export * from "./models/api/IAttestationDestroyRequest";
9
- export * from "./models/api/IAttestationTransferRequest";
10
- export * from "./models/api/IAttestationTransferResponse";
11
- export * from "./models/api/IAttestationVerifyRequest";
12
- export * from "./models/api/IAttestationVerifyResponse";
13
+ export * from "./models/IAttestationJwtProof";
@@ -1,4 +1,5 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
3
  import type { IAttestationInformation } from "./IAttestationInformation";
3
4
  /**
4
5
  * Interface describing an attestation contract.
@@ -6,37 +7,33 @@ import type { IAttestationInformation } from "./IAttestationInformation";
6
7
  export interface IAttestationComponent extends IComponent {
7
8
  /**
8
9
  * Attest the data and return the collated information.
9
- * @param verificationMethodId The identity verification method to use for attesting the data.
10
- * @param data The data to attest.
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
12
  * @param identity The identity to perform the attestation operation with.
13
13
  * @param nodeIdentity The node identity to include in the attestation.
14
- * @returns The collated attestation data.
14
+ * @returns The id of the attestation.
15
15
  */
16
- attest<T = unknown>(verificationMethodId: string, data: T, namespace?: string, identity?: string, nodeIdentity?: string): Promise<IAttestationInformation<T>>;
16
+ create(attestationObject: IJsonLdNodeObject, namespace?: string, identity?: string, nodeIdentity?: string): Promise<string>;
17
17
  /**
18
18
  * Resolve and verify the attestation id.
19
- * @param attestationId The attestation id to verify.
19
+ * @param id The attestation id to verify.
20
20
  * @returns The verified attestation details.
21
21
  */
22
- verify<T = unknown>(attestationId: string): Promise<{
23
- verified: boolean;
24
- failure?: string;
25
- information?: Partial<IAttestationInformation<T>>;
26
- }>;
22
+ get(id: string): Promise<IAttestationInformation>;
27
23
  /**
28
24
  * Transfer the attestation to a new holder.
29
25
  * @param attestationId The attestation to transfer.
30
26
  * @param holderIdentity The identity to transfer the attestation to.
27
+ * @param holderAddress The address to transfer the attestation to.
31
28
  * @param identity The identity to perform the attestation operation with.
32
- * @returns The updated attestation details.
29
+ * @returns Nothing.
33
30
  */
34
- transfer<T = unknown>(attestationId: string, holderIdentity: string, identity?: string): Promise<IAttestationInformation<T>>;
31
+ transfer(attestationId: string, holderIdentity: string, holderAddress: string, identity?: string): Promise<void>;
35
32
  /**
36
33
  * Destroy the attestation.
37
34
  * @param attestationId The attestation to transfer.
38
35
  * @param identity The identity to perform the attestation operation with.
39
- * @returns The updated attestation details.
36
+ * @returns Nothing.
40
37
  */
41
38
  destroy(attestationId: string, identity?: string): Promise<void>;
42
39
  }
@@ -1,4 +1,5 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
3
  import type { IAttestationInformation } from "./IAttestationInformation";
3
4
  /**
4
5
  * Interface describing an attestation connector.
@@ -7,31 +8,26 @@ export interface IAttestationConnector extends IComponent {
7
8
  /**
8
9
  * Attest the data and return the collated information.
9
10
  * @param controller The controller identity of the user to access the vault keys.
10
- * @param address The controller address for the attestation.
11
11
  * @param verificationMethodId The identity verification method to use for attesting the data.
12
- * @param data The data to attest.
12
+ * @param attestationObject The data to attest.
13
13
  * @returns The collated attestation data.
14
14
  */
15
- attest<T = unknown>(controller: string, address: string, verificationMethodId: string, data: T): Promise<IAttestationInformation<T>>;
15
+ create(controller: string, verificationMethodId: string, attestationObject: IJsonLdNodeObject): Promise<string>;
16
16
  /**
17
17
  * Resolve and verify the attestation id.
18
- * @param attestationId The attestation id to verify.
18
+ * @param id The attestation id to verify.
19
19
  * @returns The verified attestation details.
20
20
  */
21
- verify<T = unknown>(attestationId: string): Promise<{
22
- verified: boolean;
23
- failure?: string;
24
- information?: Partial<IAttestationInformation<T>>;
25
- }>;
21
+ get(id: string): Promise<IAttestationInformation>;
26
22
  /**
27
23
  * Transfer the attestation to a new holder.
28
24
  * @param controller The controller identity of the user to access the vault keys.
29
25
  * @param attestationId The attestation to transfer.
30
26
  * @param holderIdentity The holder identity of the attestation.
31
27
  * @param holderAddress The new controller address of the attestation belonging to the holder.
32
- * @returns The updated attestation details.
28
+ * @returns Nothing.
33
29
  */
34
- transfer<T = unknown>(controller: string, attestationId: string, holderIdentity: string, holderAddress: string): Promise<IAttestationInformation<T>>;
30
+ transfer(controller: string, attestationId: string, holderIdentity: string, holderAddress: string): Promise<void>;
35
31
  /**
36
32
  * Destroy the attestation.
37
33
  * @param controller The controller identity of the user to access the vault keys.
@@ -1,8 +1,24 @@
1
- import type { IAttestationProof } from "./IAttestationProof";
1
+ import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { SchemaOrgContexts } from "@twin.org/standards-schema-org";
3
+ import type { AttestationContexts } from "./attestationContexts";
4
+ import type { AttestationTypes } from "./attestationTypes";
2
5
  /**
3
6
  * Interface describing the collated attestation information.
4
7
  */
5
- export interface IAttestationInformation<T = unknown> {
8
+ export interface IAttestationInformation {
9
+ /**
10
+ * JSON-LD Context.
11
+ */
12
+ "@context": [
13
+ typeof AttestationContexts.ContextRoot,
14
+ typeof AttestationContexts.ContextRootCommon,
15
+ typeof SchemaOrgContexts.ContextRoot,
16
+ ...IJsonLdContextDefinitionElement[]
17
+ ];
18
+ /**
19
+ * JSON-LD Type.
20
+ */
21
+ type: typeof AttestationTypes.Information;
6
22
  /**
7
23
  * The unique identifier of the attestation.
8
24
  */
@@ -10,15 +26,15 @@ export interface IAttestationInformation<T = unknown> {
10
26
  /**
11
27
  * Created date/time of the attestation in ISO format.
12
28
  */
13
- created: string;
29
+ dateCreated: string;
14
30
  /**
15
- * The identity of the owner.
31
+ * Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner.
16
32
  */
17
- ownerIdentity: string;
33
+ dateTransferred?: string;
18
34
  /**
19
- * Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner.
35
+ * The identity of the owner.
20
36
  */
21
- transferred?: string;
37
+ ownerIdentity: string;
22
38
  /**
23
39
  * The identity of the current holder, can be undefined if owner is still the holder.
24
40
  */
@@ -26,9 +42,17 @@ export interface IAttestationInformation<T = unknown> {
26
42
  /**
27
43
  * The data that was attested.
28
44
  */
29
- data: T;
45
+ attestationObject: IJsonLdNodeObject;
30
46
  /**
31
47
  * The proof for the attested data.
32
48
  */
33
- proof: IAttestationProof;
49
+ proof?: IJsonLdNodeObject;
50
+ /**
51
+ * Whether the attestation has been verified.
52
+ */
53
+ verified?: boolean;
54
+ /**
55
+ * The verification failure message.
56
+ */
57
+ verificationFailure?: string;
34
58
  }
@@ -0,0 +1,20 @@
1
+ import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
2
+ import type { AttestationContexts } from "./attestationContexts";
3
+ import type { AttestationTypes } from "./attestationTypes";
4
+ /**
5
+ * Interface describing an attestation proof.
6
+ */
7
+ export interface IAttestationJwtProof {
8
+ /**
9
+ * JSON-LD Context.
10
+ */
11
+ "@context": typeof AttestationContexts.ContextRoot | [typeof AttestationContexts.ContextRoot, ...IJsonLdContextDefinitionElement[]];
12
+ /**
13
+ * The type of the proof.
14
+ */
15
+ type: typeof AttestationTypes.JwtProof;
16
+ /**
17
+ * The value of the proof.
18
+ */
19
+ value: string;
20
+ }
@@ -1,19 +1,16 @@
1
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
1
2
  /**
2
- * Attest the data and return the collated attestation details.
3
+ * Attest the data and return the id of the attestation.
3
4
  */
4
- export interface IAttestationAttestRequest {
5
+ export interface IAttestationCreateRequest {
5
6
  /**
6
7
  * The data to be used in the signing.
7
8
  */
8
9
  body: {
9
- /**
10
- * The identity verification method to use for attesting the data.
11
- */
12
- verificationMethodId: string;
13
10
  /**
14
11
  * The data object to attest.
15
12
  */
16
- data: unknown;
13
+ attestationObject: IJsonLdNodeObject;
17
14
  /**
18
15
  * The namespace of the connector to use for the attestation, defaults to component configured namespace.
19
16
  */