@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
@@ -0,0 +1,21 @@
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
+ /**
3
+ * Verify that the proof is valid for the attestation.
4
+ */
5
+ export interface IAttestationGetRequest {
6
+ /**
7
+ * The headers which can be used to determine the response data type.
8
+ */
9
+ headers?: {
10
+ [HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
11
+ };
12
+ /**
13
+ * The parameters to be used in the verification.
14
+ */
15
+ pathParams: {
16
+ /**
17
+ * The attestation id to verify.
18
+ */
19
+ id: string;
20
+ };
21
+ }
@@ -0,0 +1,17 @@
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
+ import type { IAttestationInformation } from "../IAttestationInformation";
3
+ /**
4
+ * The response to verifying the attestation.
5
+ */
6
+ export interface IAttestationGetResponse {
7
+ /**
8
+ * The headers which can be used to determine the response data type.
9
+ */
10
+ headers?: {
11
+ [HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
12
+ };
13
+ /**
14
+ * The data returned from the verification response.
15
+ */
16
+ body: IAttestationInformation;
17
+ }
@@ -7,7 +7,7 @@ export interface IAttestationTransferRequest {
7
7
  */
8
8
  pathParams: {
9
9
  /**
10
- * The attestation id to verify.
10
+ * The attestation id to transfer.
11
11
  */
12
12
  id: string;
13
13
  };
@@ -19,5 +19,9 @@ export interface IAttestationTransferRequest {
19
19
  * The new holder identity.
20
20
  */
21
21
  holderIdentity: string;
22
+ /**
23
+ * The new holder address.
24
+ */
25
+ holderAddress: string;
22
26
  };
23
27
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The contexts of attestation data.
3
+ */
4
+ export declare const AttestationContexts: {
5
+ /**
6
+ * The context root for the attestation types.
7
+ */
8
+ readonly ContextRoot: "https://schema.twindev.org/attestation/";
9
+ /**
10
+ * The context root for the common types.
11
+ */
12
+ readonly ContextRootCommon: "https://schema.twindev.org/common/";
13
+ };
14
+ /**
15
+ * The contexts of attestation data.
16
+ */
17
+ export type AttestationContexts = (typeof AttestationContexts)[keyof typeof AttestationContexts];
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The types of attestation data.
3
+ */
4
+ export declare const AttestationTypes: {
5
+ /**
6
+ * Represents attestation information.
7
+ */
8
+ readonly Information: "Information";
9
+ /**
10
+ * Represents attestation JWT proof.
11
+ */
12
+ readonly JwtProof: "JwtProof";
13
+ };
14
+ /**
15
+ * The types of attestation data.
16
+ */
17
+ export type AttestationTypes = (typeof AttestationTypes)[keyof typeof AttestationTypes];
package/docs/changelog.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # @twin.org/attestation-models - Changelog
2
2
 
3
- ## v0.0.1-next.3
3
+ ## [0.0.1-next.30](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.29...attestation-models-v0.0.1-next.30) (2025-06-12)
4
+
5
+
6
+ ### Features
7
+
8
+ * update dependencies ([1d96d2e](https://github.com/twinfoundation/attestation/commit/1d96d2ee6e81a30396980f6f5e16e9658710d32d))
9
+
10
+ ## [0.0.1-next.29](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.28...attestation-models-v0.0.1-next.29) (2025-06-03)
11
+
12
+
13
+ ### Features
14
+
15
+ * update ts-to-schema generation ([0f23298](https://github.com/twinfoundation/attestation/commit/0f23298f6e8accb19c0faaf74220cce02155b48a))
16
+
17
+ ## [0.0.1-next.28](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.27...attestation-models-v0.0.1-next.28) (2025-05-28)
18
+
19
+
20
+ ### Features
21
+
22
+ * update data type registration with fully qualified names ([5982245](https://github.com/twinfoundation/attestation/commit/59822454a027a9c6dfa72ffa9aabb9622b925929))
23
+
24
+ ## [0.0.1-next.27](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.26...attestation-models-v0.0.1-next.27) (2025-05-06)
25
+
26
+
27
+ ### Miscellaneous Chores
28
+
29
+ * **attestation-models:** Synchronize repo versions
30
+
31
+ ## [0.0.1-next.26](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.25...attestation-models-v0.0.1-next.26) (2025-04-17)
32
+
33
+
34
+ ### Features
35
+
36
+ * use shared store mechanism ([#5](https://github.com/twinfoundation/attestation/issues/5)) ([3768cf7](https://github.com/twinfoundation/attestation/commit/3768cf7214d30a5429b7b08190539b517d7fafa0))
37
+
38
+ ## [0.0.1-next.25](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.24...attestation-models-v0.0.1-next.25) (2025-03-28)
39
+
40
+
41
+ ### Miscellaneous Chores
42
+
43
+ * **attestation-models:** Synchronize repo versions
44
+
45
+ ## v0.0.1-next.24
4
46
 
5
47
  - Initial Release
@@ -0,0 +1,25 @@
1
+ # Class: AttestationDataTypes
2
+
3
+ Handle all the data types for attestation.
4
+
5
+ ## Constructors
6
+
7
+ ### Constructor
8
+
9
+ > **new AttestationDataTypes**(): `AttestationDataTypes`
10
+
11
+ #### Returns
12
+
13
+ `AttestationDataTypes`
14
+
15
+ ## Methods
16
+
17
+ ### registerTypes()
18
+
19
+ > `static` **registerTypes**(): `void`
20
+
21
+ Register all the data types.
22
+
23
+ #### Returns
24
+
25
+ `void`
@@ -1,19 +1,28 @@
1
1
  # @twin.org/attestation-models
2
2
 
3
+ ## Classes
4
+
5
+ - [AttestationDataTypes](classes/AttestationDataTypes.md)
6
+
3
7
  ## Interfaces
4
8
 
5
9
  - [IAttestationComponent](interfaces/IAttestationComponent.md)
6
10
  - [IAttestationConnector](interfaces/IAttestationConnector.md)
7
11
  - [IAttestationInformation](interfaces/IAttestationInformation.md)
8
- - [IAttestationProof](interfaces/IAttestationProof.md)
9
- - [IAttestationAttestRequest](interfaces/IAttestationAttestRequest.md)
10
- - [IAttestationAttestResponse](interfaces/IAttestationAttestResponse.md)
12
+ - [IAttestationJwtProof](interfaces/IAttestationJwtProof.md)
13
+ - [IAttestationCreateRequest](interfaces/IAttestationCreateRequest.md)
11
14
  - [IAttestationDestroyRequest](interfaces/IAttestationDestroyRequest.md)
15
+ - [IAttestationGetRequest](interfaces/IAttestationGetRequest.md)
16
+ - [IAttestationGetResponse](interfaces/IAttestationGetResponse.md)
12
17
  - [IAttestationTransferRequest](interfaces/IAttestationTransferRequest.md)
13
- - [IAttestationTransferResponse](interfaces/IAttestationTransferResponse.md)
14
- - [IAttestationVerifyRequest](interfaces/IAttestationVerifyRequest.md)
15
- - [IAttestationVerifyResponse](interfaces/IAttestationVerifyResponse.md)
18
+
19
+ ## Type Aliases
20
+
21
+ - [AttestationContexts](type-aliases/AttestationContexts.md)
22
+ - [AttestationTypes](type-aliases/AttestationTypes.md)
16
23
 
17
24
  ## Variables
18
25
 
19
26
  - [AttestationConnectorFactory](variables/AttestationConnectorFactory.md)
27
+ - [AttestationContexts](variables/AttestationContexts.md)
28
+ - [AttestationTypes](variables/AttestationTypes.md)
@@ -8,127 +8,125 @@ Interface describing an attestation contract.
8
8
 
9
9
  ## Methods
10
10
 
11
- ### attest()
11
+ ### create()
12
12
 
13
- > **attest**\<`T`\>(`verificationMethodId`, `data`, `namespace`?, `identity`?, `nodeIdentity`?): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
13
+ > **create**(`attestationObject`, `namespace?`, `identity?`, `nodeIdentity?`): `Promise`\<`string`\>
14
14
 
15
15
  Attest the data and return the collated information.
16
16
 
17
- #### Type Parameters
18
-
19
- • **T** = `unknown`
20
-
21
17
  #### Parameters
22
18
 
23
- **verificationMethodId**: `string`
19
+ ##### attestationObject
24
20
 
25
- The identity verification method to use for attesting the data.
26
-
27
- • **data**: `T`
21
+ `IJsonLdNodeObject`
28
22
 
29
23
  The data to attest.
30
24
 
31
- **namespace?**: `string`
25
+ ##### namespace?
26
+
27
+ `string`
32
28
 
33
29
  The namespace of the connector to use for the attestation, defaults to component configured namespace.
34
30
 
35
- **identity?**: `string`
31
+ ##### identity?
32
+
33
+ `string`
36
34
 
37
35
  The identity to perform the attestation operation with.
38
36
 
39
- **nodeIdentity?**: `string`
37
+ ##### nodeIdentity?
38
+
39
+ `string`
40
40
 
41
41
  The node identity to include in the attestation.
42
42
 
43
43
  #### Returns
44
44
 
45
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
45
+ `Promise`\<`string`\>
46
46
 
47
- The collated attestation data.
47
+ The id of the attestation.
48
48
 
49
49
  ***
50
50
 
51
- ### verify()
51
+ ### get()
52
52
 
53
- > **verify**\<`T`\>(`attestationId`): `Promise`\<`object`\>
53
+ > **get**(`id`): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
54
54
 
55
55
  Resolve and verify the attestation id.
56
56
 
57
- #### Type Parameters
58
-
59
- • **T** = `unknown`
60
-
61
57
  #### Parameters
62
58
 
63
- **attestationId**: `string`
59
+ ##### id
60
+
61
+ `string`
64
62
 
65
63
  The attestation id to verify.
66
64
 
67
65
  #### Returns
68
66
 
69
- `Promise`\<`object`\>
67
+ `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
70
68
 
71
69
  The verified attestation details.
72
70
 
73
- ##### verified
74
-
75
- > **verified**: `boolean`
76
-
77
- ##### failure?
78
-
79
- > `optional` **failure**: `string`
80
-
81
- ##### information?
82
-
83
- > `optional` **information**: `Partial`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
84
-
85
71
  ***
86
72
 
87
73
  ### transfer()
88
74
 
89
- > **transfer**\<`T`\>(`attestationId`, `holderIdentity`, `identity`?): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
75
+ > **transfer**(`attestationId`, `holderIdentity`, `holderAddress`, `identity?`): `Promise`\<`void`\>
90
76
 
91
77
  Transfer the attestation to a new holder.
92
78
 
93
- #### Type Parameters
94
-
95
- • **T** = `unknown`
96
-
97
79
  #### Parameters
98
80
 
99
- **attestationId**: `string`
81
+ ##### attestationId
82
+
83
+ `string`
100
84
 
101
85
  The attestation to transfer.
102
86
 
103
- **holderIdentity**: `string`
87
+ ##### holderIdentity
88
+
89
+ `string`
104
90
 
105
91
  The identity to transfer the attestation to.
106
92
 
107
- **identity?**: `string`
93
+ ##### holderAddress
94
+
95
+ `string`
96
+
97
+ The address to transfer the attestation to.
98
+
99
+ ##### identity?
100
+
101
+ `string`
108
102
 
109
103
  The identity to perform the attestation operation with.
110
104
 
111
105
  #### Returns
112
106
 
113
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
107
+ `Promise`\<`void`\>
114
108
 
115
- The updated attestation details.
109
+ Nothing.
116
110
 
117
111
  ***
118
112
 
119
113
  ### destroy()
120
114
 
121
- > **destroy**(`attestationId`, `identity`?): `Promise`\<`void`\>
115
+ > **destroy**(`attestationId`, `identity?`): `Promise`\<`void`\>
122
116
 
123
117
  Destroy the attestation.
124
118
 
125
119
  #### Parameters
126
120
 
127
- **attestationId**: `string`
121
+ ##### attestationId
122
+
123
+ `string`
128
124
 
129
125
  The attestation to transfer.
130
126
 
131
- **identity?**: `string`
127
+ ##### identity?
128
+
129
+ `string`
132
130
 
133
131
  The identity to perform the attestation operation with.
134
132
 
@@ -136,4 +134,4 @@ The identity to perform the attestation operation with.
136
134
 
137
135
  `Promise`\<`void`\>
138
136
 
139
- The updated attestation details.
137
+ Nothing.
@@ -8,111 +8,99 @@ Interface describing an attestation connector.
8
8
 
9
9
  ## Methods
10
10
 
11
- ### attest()
11
+ ### create()
12
12
 
13
- > **attest**\<`T`\>(`controller`, `address`, `verificationMethodId`, `data`): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
13
+ > **create**(`controller`, `verificationMethodId`, `attestationObject`): `Promise`\<`string`\>
14
14
 
15
15
  Attest the data and return the collated information.
16
16
 
17
- #### Type Parameters
18
-
19
- • **T** = `unknown`
20
-
21
17
  #### Parameters
22
18
 
23
- **controller**: `string`
19
+ ##### controller
24
20
 
25
- The controller identity of the user to access the vault keys.
21
+ `string`
26
22
 
27
- **address**: `string`
23
+ The controller identity of the user to access the vault keys.
28
24
 
29
- The controller address for the attestation.
25
+ ##### verificationMethodId
30
26
 
31
- • **verificationMethodId**: `string`
27
+ `string`
32
28
 
33
29
  The identity verification method to use for attesting the data.
34
30
 
35
- **data**: `T`
31
+ ##### attestationObject
32
+
33
+ `IJsonLdNodeObject`
36
34
 
37
35
  The data to attest.
38
36
 
39
37
  #### Returns
40
38
 
41
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
39
+ `Promise`\<`string`\>
42
40
 
43
41
  The collated attestation data.
44
42
 
45
43
  ***
46
44
 
47
- ### verify()
45
+ ### get()
48
46
 
49
- > **verify**\<`T`\>(`attestationId`): `Promise`\<`object`\>
47
+ > **get**(`id`): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
50
48
 
51
49
  Resolve and verify the attestation id.
52
50
 
53
- #### Type Parameters
54
-
55
- • **T** = `unknown`
56
-
57
51
  #### Parameters
58
52
 
59
- **attestationId**: `string`
53
+ ##### id
54
+
55
+ `string`
60
56
 
61
57
  The attestation id to verify.
62
58
 
63
59
  #### Returns
64
60
 
65
- `Promise`\<`object`\>
61
+ `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
66
62
 
67
63
  The verified attestation details.
68
64
 
69
- ##### verified
70
-
71
- > **verified**: `boolean`
72
-
73
- ##### failure?
74
-
75
- > `optional` **failure**: `string`
76
-
77
- ##### information?
78
-
79
- > `optional` **information**: `Partial`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
80
-
81
65
  ***
82
66
 
83
67
  ### transfer()
84
68
 
85
- > **transfer**\<`T`\>(`controller`, `attestationId`, `holderIdentity`, `holderAddress`): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
69
+ > **transfer**(`controller`, `attestationId`, `holderIdentity`, `holderAddress`): `Promise`\<`void`\>
86
70
 
87
71
  Transfer the attestation to a new holder.
88
72
 
89
- #### Type Parameters
90
-
91
- • **T** = `unknown`
92
-
93
73
  #### Parameters
94
74
 
95
- **controller**: `string`
75
+ ##### controller
76
+
77
+ `string`
96
78
 
97
79
  The controller identity of the user to access the vault keys.
98
80
 
99
- **attestationId**: `string`
81
+ ##### attestationId
82
+
83
+ `string`
100
84
 
101
85
  The attestation to transfer.
102
86
 
103
- **holderIdentity**: `string`
87
+ ##### holderIdentity
88
+
89
+ `string`
104
90
 
105
91
  The holder identity of the attestation.
106
92
 
107
- **holderAddress**: `string`
93
+ ##### holderAddress
94
+
95
+ `string`
108
96
 
109
97
  The new controller address of the attestation belonging to the holder.
110
98
 
111
99
  #### Returns
112
100
 
113
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
101
+ `Promise`\<`void`\>
114
102
 
115
- The updated attestation details.
103
+ Nothing.
116
104
 
117
105
  ***
118
106
 
@@ -124,11 +112,15 @@ Destroy the attestation.
124
112
 
125
113
  #### Parameters
126
114
 
127
- **controller**: `string`
115
+ ##### controller
116
+
117
+ `string`
128
118
 
129
119
  The controller identity of the user to access the vault keys.
130
120
 
131
- **attestationId**: `string`
121
+ ##### attestationId
122
+
123
+ `string`
132
124
 
133
125
  The attestation to destroy.
134
126
 
@@ -1,6 +1,6 @@
1
- # Interface: IAttestationAttestRequest
1
+ # Interface: IAttestationCreateRequest
2
2
 
3
- Attest the data and return the collated attestation details.
3
+ Attest the data and return the id of the attestation.
4
4
 
5
5
  ## Properties
6
6
 
@@ -10,15 +10,9 @@ Attest the data and return the collated attestation details.
10
10
 
11
11
  The data to be used in the signing.
12
12
 
13
- #### verificationMethodId
13
+ #### attestationObject
14
14
 
15
- > **verificationMethodId**: `string`
16
-
17
- The identity verification method to use for attesting the data.
18
-
19
- #### data
20
-
21
- > **data**: `unknown`
15
+ > **attestationObject**: `IJsonLdNodeObject`
22
16
 
23
17
  The data object to attest.
24
18
 
@@ -0,0 +1,29 @@
1
+ # Interface: IAttestationGetRequest
2
+
3
+ Verify that the proof is valid for the attestation.
4
+
5
+ ## Properties
6
+
7
+ ### headers?
8
+
9
+ > `optional` **headers**: `object`
10
+
11
+ The headers which can be used to determine the response data type.
12
+
13
+ #### accept
14
+
15
+ > **accept**: `"application/json"` \| `"application/ld+json"`
16
+
17
+ ***
18
+
19
+ ### pathParams
20
+
21
+ > **pathParams**: `object`
22
+
23
+ The parameters to be used in the verification.
24
+
25
+ #### id
26
+
27
+ > **id**: `string`
28
+
29
+ The attestation id to verify.
@@ -0,0 +1,23 @@
1
+ # Interface: IAttestationGetResponse
2
+
3
+ The response to verifying the attestation.
4
+
5
+ ## Properties
6
+
7
+ ### headers?
8
+
9
+ > `optional` **headers**: `object`
10
+
11
+ The headers which can be used to determine the response data type.
12
+
13
+ #### content-type
14
+
15
+ > **content-type**: `"application/json"` \| `"application/ld+json"`
16
+
17
+ ***
18
+
19
+ ### body
20
+
21
+ > **body**: [`IAttestationInformation`](IAttestationInformation.md)
22
+
23
+ The data returned from the verification response.