@twin.org/attestation-models 0.0.1-next.6 → 0.0.1-next.8

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 (35) hide show
  1. package/dist/cjs/index.cjs +180 -0
  2. package/dist/esm/index.mjs +179 -1
  3. package/dist/types/dataTypes/attestationDataTypes.d.ts +9 -0
  4. package/dist/types/index.d.ts +8 -8
  5. package/dist/types/models/IAttestationComponent.d.ts +8 -12
  6. package/dist/types/models/IAttestationConnector.d.ts +6 -10
  7. package/dist/types/models/IAttestationInformation.d.ts +25 -9
  8. package/dist/types/models/IAttestationJwtProof.d.ts +18 -0
  9. package/dist/types/models/api/{IAttestationAttestRequest.d.ts → IAttestationCreateRequest.d.ts} +3 -3
  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/attestationTypes.d.ts +21 -0
  13. package/docs/changelog.md +1 -1
  14. package/docs/reference/classes/AttestationDataTypes.md +25 -0
  15. package/docs/reference/index.md +13 -6
  16. package/docs/reference/interfaces/IAttestationComponent.md +13 -37
  17. package/docs/reference/interfaces/IAttestationConnector.md +11 -35
  18. package/docs/reference/interfaces/{IAttestationAttestRequest.md → IAttestationCreateRequest.md} +4 -4
  19. package/docs/reference/interfaces/IAttestationGetRequest.md +29 -0
  20. package/docs/reference/interfaces/IAttestationGetResponse.md +23 -0
  21. package/docs/reference/interfaces/IAttestationInformation.md +44 -16
  22. package/docs/reference/interfaces/IAttestationJwtProof.md +27 -0
  23. package/docs/reference/type-aliases/AttestationTypes.md +5 -0
  24. package/docs/reference/variables/AttestationTypes.md +25 -0
  25. package/package.json +4 -2
  26. package/dist/types/models/IAttestationProof.d.ts +0 -13
  27. package/dist/types/models/api/IAttestationAttestResponse.d.ts +0 -12
  28. package/dist/types/models/api/IAttestationTransferResponse.d.ts +0 -15
  29. package/dist/types/models/api/IAttestationVerifyRequest.d.ts +0 -14
  30. package/dist/types/models/api/IAttestationVerifyResponse.d.ts +0 -23
  31. package/docs/reference/interfaces/IAttestationAttestResponse.md +0 -15
  32. package/docs/reference/interfaces/IAttestationProof.md +0 -19
  33. package/docs/reference/interfaces/IAttestationTransferResponse.md +0 -17
  34. package/docs/reference/interfaces/IAttestationVerifyRequest.md +0 -17
  35. package/docs/reference/interfaces/IAttestationVerifyResponse.md +0 -29
@@ -0,0 +1,25 @@
1
+ # Class: AttestationDataTypes
2
+
3
+ Handle all the data types for attestation.
4
+
5
+ ## Constructors
6
+
7
+ ### new AttestationDataTypes()
8
+
9
+ > **new AttestationDataTypes**(): [`AttestationDataTypes`](AttestationDataTypes.md)
10
+
11
+ #### Returns
12
+
13
+ [`AttestationDataTypes`](AttestationDataTypes.md)
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,26 @@
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
+ - [AttestationTypes](type-aliases/AttestationTypes.md)
16
22
 
17
23
  ## Variables
18
24
 
19
25
  - [AttestationConnectorFactory](variables/AttestationConnectorFactory.md)
26
+ - [AttestationTypes](variables/AttestationTypes.md)
@@ -8,23 +8,19 @@ 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**(`verificationMethodId`, `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** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
20
-
21
17
  #### Parameters
22
18
 
23
19
  • **verificationMethodId**: `string`
24
20
 
25
21
  The identity verification method to use for attesting the data.
26
22
 
27
- • **data**: `T`
23
+ • **attestationObject**: `IJsonLdNodeObject`
28
24
 
29
25
  The data to attest.
30
26
 
@@ -42,58 +38,38 @@ The node identity to include in the attestation.
42
38
 
43
39
  #### Returns
44
40
 
45
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
41
+ `Promise`\<`string`\>
46
42
 
47
- The collated attestation data.
43
+ The id of the attestation.
48
44
 
49
45
  ***
50
46
 
51
- ### verify()
47
+ ### get()
52
48
 
53
- > **verify**\<`T`\>(`attestationId`): `Promise`\<`object`\>
49
+ > **get**(`id`): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
54
50
 
55
51
  Resolve and verify the attestation id.
56
52
 
57
- #### Type Parameters
58
-
59
- • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
60
-
61
53
  #### Parameters
62
54
 
63
- • **attestationId**: `string`
55
+ • **id**: `string`
64
56
 
65
57
  The attestation id to verify.
66
58
 
67
59
  #### Returns
68
60
 
69
- `Promise`\<`object`\>
61
+ `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
70
62
 
71
63
  The verified attestation details.
72
64
 
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
65
  ***
86
66
 
87
67
  ### transfer()
88
68
 
89
- > **transfer**\<`T`\>(`attestationId`, `holderIdentity`, `identity`?): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
69
+ > **transfer**(`attestationId`, `holderIdentity`, `identity`?): `Promise`\<`void`\>
90
70
 
91
71
  Transfer the attestation to a new holder.
92
72
 
93
- #### Type Parameters
94
-
95
- • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
96
-
97
73
  #### Parameters
98
74
 
99
75
  • **attestationId**: `string`
@@ -110,9 +86,9 @@ The identity to perform the attestation operation with.
110
86
 
111
87
  #### Returns
112
88
 
113
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
89
+ `Promise`\<`void`\>
114
90
 
115
- The updated attestation details.
91
+ Nothing.
116
92
 
117
93
  ***
118
94
 
@@ -136,4 +112,4 @@ The identity to perform the attestation operation with.
136
112
 
137
113
  `Promise`\<`void`\>
138
114
 
139
- The updated attestation details.
115
+ Nothing.
@@ -8,16 +8,12 @@ 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`, `address`, `verificationMethodId`, `attestationObject`): `Promise`\<`string`\>
14
14
 
15
15
  Attest the data and return the collated information.
16
16
 
17
- #### Type Parameters
18
-
19
- • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
20
-
21
17
  #### Parameters
22
18
 
23
19
  • **controller**: `string`
@@ -32,64 +28,44 @@ The controller address for the attestation.
32
28
 
33
29
  The identity verification method to use for attesting the data.
34
30
 
35
- • **data**: `T`
31
+ • **attestationObject**: `IJsonLdNodeObject`
36
32
 
37
33
  The data to attest.
38
34
 
39
35
  #### Returns
40
36
 
41
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
37
+ `Promise`\<`string`\>
42
38
 
43
39
  The collated attestation data.
44
40
 
45
41
  ***
46
42
 
47
- ### verify()
43
+ ### get()
48
44
 
49
- > **verify**\<`T`\>(`attestationId`): `Promise`\<`object`\>
45
+ > **get**(`id`): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
50
46
 
51
47
  Resolve and verify the attestation id.
52
48
 
53
- #### Type Parameters
54
-
55
- • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
56
-
57
49
  #### Parameters
58
50
 
59
- • **attestationId**: `string`
51
+ • **id**: `string`
60
52
 
61
53
  The attestation id to verify.
62
54
 
63
55
  #### Returns
64
56
 
65
- `Promise`\<`object`\>
57
+ `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
66
58
 
67
59
  The verified attestation details.
68
60
 
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
61
  ***
82
62
 
83
63
  ### transfer()
84
64
 
85
- > **transfer**\<`T`\>(`controller`, `attestationId`, `holderIdentity`, `holderAddress`): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
65
+ > **transfer**(`controller`, `attestationId`, `holderIdentity`, `holderAddress`): `Promise`\<`void`\>
86
66
 
87
67
  Transfer the attestation to a new holder.
88
68
 
89
- #### Type Parameters
90
-
91
- • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
92
-
93
69
  #### Parameters
94
70
 
95
71
  • **controller**: `string`
@@ -110,9 +86,9 @@ The new controller address of the attestation belonging to the holder.
110
86
 
111
87
  #### Returns
112
88
 
113
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
89
+ `Promise`\<`void`\>
114
90
 
115
- The updated attestation details.
91
+ Nothing.
116
92
 
117
93
  ***
118
94
 
@@ -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
 
@@ -16,9 +16,9 @@ The data to be used in the signing.
16
16
 
17
17
  The identity verification method to use for attesting the data.
18
18
 
19
- #### data
19
+ #### attestationObject
20
20
 
21
- > **data**: `IJsonLdNodeObject`
21
+ > **attestationObject**: `IJsonLdNodeObject`
22
22
 
23
23
  The data object to attest.
24
24
 
@@ -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.
@@ -1,12 +1,24 @@
1
- # Interface: IAttestationInformation\<T\>
1
+ # Interface: IAttestationInformation
2
2
 
3
3
  Interface describing the collated attestation information.
4
4
 
5
- ## Type Parameters
5
+ ## Properties
6
6
 
7
- **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
7
+ ### @context
8
8
 
9
- ## Properties
9
+ > **@context**: `"https://schema.twindev.org/attestation/"` \| [`"https://schema.twindev.org/attestation/"`, `...string[]`]
10
+
11
+ JSON-LD Context.
12
+
13
+ ***
14
+
15
+ ### type
16
+
17
+ > **type**: `"Information"`
18
+
19
+ JSON-LD Type.
20
+
21
+ ***
10
22
 
11
23
  ### id
12
24
 
@@ -16,27 +28,27 @@ The unique identifier of the attestation.
16
28
 
17
29
  ***
18
30
 
19
- ### created
31
+ ### dateCreated
20
32
 
21
- > **created**: `string`
33
+ > **dateCreated**: `string`
22
34
 
23
35
  Created date/time of the attestation in ISO format.
24
36
 
25
37
  ***
26
38
 
27
- ### ownerIdentity
39
+ ### dateTransferred?
28
40
 
29
- > **ownerIdentity**: `string`
41
+ > `optional` **dateTransferred**: `string`
30
42
 
31
- The identity of the owner.
43
+ Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner.
32
44
 
33
45
  ***
34
46
 
35
- ### transferred?
47
+ ### ownerIdentity
36
48
 
37
- > `optional` **transferred**: `string`
49
+ > **ownerIdentity**: `string`
38
50
 
39
- Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner.
51
+ The identity of the owner.
40
52
 
41
53
  ***
42
54
 
@@ -48,16 +60,32 @@ The identity of the current holder, can be undefined if owner is still the holde
48
60
 
49
61
  ***
50
62
 
51
- ### data
63
+ ### attestationObject
52
64
 
53
- > **data**: `T`
65
+ > **attestationObject**: `IJsonLdNodeObject`
54
66
 
55
67
  The data that was attested.
56
68
 
57
69
  ***
58
70
 
59
- ### proof
71
+ ### proof?
60
72
 
61
- > **proof**: [`IAttestationProof`](IAttestationProof.md)
73
+ > `optional` **proof**: `IJsonLdNodeObject`
62
74
 
63
75
  The proof for the attested data.
76
+
77
+ ***
78
+
79
+ ### verified?
80
+
81
+ > `optional` **verified**: `boolean`
82
+
83
+ Whether the attestation has been verified.
84
+
85
+ ***
86
+
87
+ ### verificationFailure?
88
+
89
+ > `optional` **verificationFailure**: `string`
90
+
91
+ The verification failure message.
@@ -0,0 +1,27 @@
1
+ # Interface: IAttestationJwtProof
2
+
3
+ Interface describing an attestation proof.
4
+
5
+ ## Properties
6
+
7
+ ### @context
8
+
9
+ > **@context**: `"https://schema.twindev.org/attestation/"` \| [`"https://schema.twindev.org/attestation/"`, `...string[]`]
10
+
11
+ JSON-LD Context.
12
+
13
+ ***
14
+
15
+ ### type
16
+
17
+ > **type**: `"JwtProof"`
18
+
19
+ The type of the proof.
20
+
21
+ ***
22
+
23
+ ### value
24
+
25
+ > **value**: `string`
26
+
27
+ The value of the proof.
@@ -0,0 +1,5 @@
1
+ # Type Alias: AttestationTypes
2
+
3
+ > **AttestationTypes**: *typeof* [`AttestationTypes`](../variables/AttestationTypes.md)\[keyof *typeof* [`AttestationTypes`](../variables/AttestationTypes.md)\]
4
+
5
+ The types of attestation data.
@@ -0,0 +1,25 @@
1
+ # Variable: AttestationTypes
2
+
3
+ > `const` **AttestationTypes**: `object`
4
+
5
+ The types of attestation data.
6
+
7
+ ## Type declaration
8
+
9
+ ### ContextRoot
10
+
11
+ > `readonly` **ContextRoot**: `"https://schema.twindev.org/attestation/"` = `"https://schema.twindev.org/attestation/"`
12
+
13
+ The context root for the attestation types.
14
+
15
+ ### Information
16
+
17
+ > `readonly` **Information**: `"Information"` = `"Information"`
18
+
19
+ Represents attestation information.
20
+
21
+ ### JwtProof
22
+
23
+ > `readonly` **JwtProof**: `"JwtProof"` = `"JwtProof"`
24
+
25
+ Represents attestation JWT proof.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/attestation-models",
3
- "version": "0.0.1-next.6",
3
+ "version": "0.0.1-next.8",
4
4
  "description": "Models which define the structure of the attestation connectors and services",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,10 +15,12 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
+ "@twin.org/data-core": "next",
18
19
  "@twin.org/data-json-ld": "next",
19
20
  "@twin.org/entity": "next",
20
21
  "@twin.org/nameof": "next",
21
- "@twin.org/standards-w3c-did": "next"
22
+ "@twin.org/standards-w3c-did": "next",
23
+ "@twin.org/web": "next"
22
24
  },
23
25
  "main": "./dist/cjs/index.cjs",
24
26
  "module": "./dist/esm/index.mjs",
@@ -1,13 +0,0 @@
1
- /**
2
- * Interface describing an attestation proof.
3
- */
4
- export interface IAttestationProof {
5
- /**
6
- * The type of the proof.
7
- */
8
- type: string;
9
- /**
10
- * The value of the proof.
11
- */
12
- value: string;
13
- }
@@ -1,12 +0,0 @@
1
- import type { IAttestationInformation } from "../IAttestationInformation";
2
- /**
3
- * The response when creating the attestation for some data.
4
- */
5
- export interface IAttestationAttestResponse {
6
- /**
7
- * The result of the attestation process.
8
- */
9
- body: {
10
- information: IAttestationInformation;
11
- };
12
- }
@@ -1,15 +0,0 @@
1
- import type { IAttestationInformation } from "../IAttestationInformation";
2
- /**
3
- * The response to transferring the attestation.
4
- */
5
- export interface IAttestationTransferResponse {
6
- /**
7
- * The data returned from the transfer response.
8
- */
9
- body: {
10
- /**
11
- * The updated attestation information.
12
- */
13
- information: IAttestationInformation;
14
- };
15
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * Verify that the proof is valid for the attestation.
3
- */
4
- export interface IAttestationVerifyRequest {
5
- /**
6
- * The parameters to be used in the verification.
7
- */
8
- pathParams: {
9
- /**
10
- * The attestation id to verify.
11
- */
12
- id: string;
13
- };
14
- }
@@ -1,23 +0,0 @@
1
- import type { IAttestationInformation } from "../IAttestationInformation";
2
- /**
3
- * The response to verifying the attestation.
4
- */
5
- export interface IAttestationVerifyResponse {
6
- /**
7
- * The data returned from the verification response.
8
- */
9
- body: {
10
- /**
11
- * Whether the attestation is verified.
12
- */
13
- verified: boolean;
14
- /**
15
- * The failure message if the attestation is not verified.
16
- */
17
- failure?: string;
18
- /**
19
- * The attestation information.
20
- */
21
- information?: Partial<IAttestationInformation>;
22
- };
23
- }
@@ -1,15 +0,0 @@
1
- # Interface: IAttestationAttestResponse
2
-
3
- The response when creating the attestation for some data.
4
-
5
- ## Properties
6
-
7
- ### body
8
-
9
- > **body**: `object`
10
-
11
- The result of the attestation process.
12
-
13
- #### information
14
-
15
- > **information**: [`IAttestationInformation`](IAttestationInformation.md)\<`IJsonLdNodeObject`\>
@@ -1,19 +0,0 @@
1
- # Interface: IAttestationProof
2
-
3
- Interface describing an attestation proof.
4
-
5
- ## Properties
6
-
7
- ### type
8
-
9
- > **type**: `string`
10
-
11
- The type of the proof.
12
-
13
- ***
14
-
15
- ### value
16
-
17
- > **value**: `string`
18
-
19
- The value of the proof.
@@ -1,17 +0,0 @@
1
- # Interface: IAttestationTransferResponse
2
-
3
- The response to transferring the attestation.
4
-
5
- ## Properties
6
-
7
- ### body
8
-
9
- > **body**: `object`
10
-
11
- The data returned from the transfer response.
12
-
13
- #### information
14
-
15
- > **information**: [`IAttestationInformation`](IAttestationInformation.md)\<`IJsonLdNodeObject`\>
16
-
17
- The updated attestation information.