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

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.
@@ -14,16 +14,16 @@ export interface IAttestationComponent extends IComponent {
14
14
  * @param nodeIdentity The node identity to include in the attestation.
15
15
  * @returns The collated attestation data.
16
16
  */
17
- attest(verificationMethodId: string, data: IJsonLdNodeObject, namespace?: string, identity?: string, nodeIdentity?: string): Promise<IAttestationInformation>;
17
+ attest<T extends IJsonLdNodeObject = IJsonLdNodeObject>(verificationMethodId: string, data: T, namespace?: string, identity?: string, nodeIdentity?: string): Promise<IAttestationInformation<T>>;
18
18
  /**
19
19
  * Resolve and verify the attestation id.
20
20
  * @param attestationId The attestation id to verify.
21
21
  * @returns The verified attestation details.
22
22
  */
23
- verify(attestationId: string): Promise<{
23
+ verify<T extends IJsonLdNodeObject = IJsonLdNodeObject>(attestationId: string): Promise<{
24
24
  verified: boolean;
25
25
  failure?: string;
26
- information?: Partial<IAttestationInformation>;
26
+ information?: Partial<IAttestationInformation<T>>;
27
27
  }>;
28
28
  /**
29
29
  * Transfer the attestation to a new holder.
@@ -32,7 +32,7 @@ export interface IAttestationComponent extends IComponent {
32
32
  * @param identity The identity to perform the attestation operation with.
33
33
  * @returns The updated attestation details.
34
34
  */
35
- transfer(attestationId: string, holderIdentity: string, identity?: string): Promise<IAttestationInformation>;
35
+ transfer<T extends IJsonLdNodeObject = IJsonLdNodeObject>(attestationId: string, holderIdentity: string, identity?: string): Promise<IAttestationInformation<T>>;
36
36
  /**
37
37
  * Destroy the attestation.
38
38
  * @param attestationId The attestation to transfer.
@@ -13,16 +13,16 @@ export interface IAttestationConnector extends IComponent {
13
13
  * @param data The data to attest.
14
14
  * @returns The collated attestation data.
15
15
  */
16
- attest(controller: string, address: string, verificationMethodId: string, data: IJsonLdNodeObject): Promise<IAttestationInformation>;
16
+ attest<T extends IJsonLdNodeObject = IJsonLdNodeObject>(controller: string, address: string, verificationMethodId: string, data: T): Promise<IAttestationInformation<T>>;
17
17
  /**
18
18
  * Resolve and verify the attestation id.
19
19
  * @param attestationId The attestation id to verify.
20
20
  * @returns The verified attestation details.
21
21
  */
22
- verify(attestationId: string): Promise<{
22
+ verify<T extends IJsonLdNodeObject = IJsonLdNodeObject>(attestationId: string): Promise<{
23
23
  verified: boolean;
24
24
  failure?: string;
25
- information?: Partial<IAttestationInformation>;
25
+ information?: Partial<IAttestationInformation<T>>;
26
26
  }>;
27
27
  /**
28
28
  * Transfer the attestation to a new holder.
@@ -32,7 +32,7 @@ export interface IAttestationConnector extends IComponent {
32
32
  * @param holderAddress The new controller address of the attestation belonging to the holder.
33
33
  * @returns The updated attestation details.
34
34
  */
35
- transfer(controller: string, attestationId: string, holderIdentity: string, holderAddress: string): Promise<IAttestationInformation>;
35
+ transfer<T extends IJsonLdNodeObject = IJsonLdNodeObject>(controller: string, attestationId: string, holderIdentity: string, holderAddress: string): Promise<IAttestationInformation<T>>;
36
36
  /**
37
37
  * Destroy the attestation.
38
38
  * @param controller The controller identity of the user to access the vault keys.
@@ -3,7 +3,7 @@ import type { IAttestationProof } from "./IAttestationProof";
3
3
  /**
4
4
  * Interface describing the collated attestation information.
5
5
  */
6
- export interface IAttestationInformation {
6
+ export interface IAttestationInformation<T extends IJsonLdNodeObject = IJsonLdNodeObject> {
7
7
  /**
8
8
  * The unique identifier of the attestation.
9
9
  */
@@ -27,7 +27,7 @@ export interface IAttestationInformation {
27
27
  /**
28
28
  * The data that was attested.
29
29
  */
30
- data: IJsonLdNodeObject;
30
+ data: T;
31
31
  /**
32
32
  * The proof for the attested data.
33
33
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/attestation-models - Changelog
2
2
 
3
- ## v0.0.1-next.4
3
+ ## v0.0.1-next.6
4
4
 
5
5
  - Initial Release
@@ -12,4 +12,4 @@ The result of the attestation process.
12
12
 
13
13
  #### information
14
14
 
15
- > **information**: [`IAttestationInformation`](IAttestationInformation.md)
15
+ > **information**: [`IAttestationInformation`](IAttestationInformation.md)\<`IJsonLdNodeObject`\>
@@ -10,17 +10,21 @@ Interface describing an attestation contract.
10
10
 
11
11
  ### attest()
12
12
 
13
- > **attest**(`verificationMethodId`, `data`, `namespace`?, `identity`?, `nodeIdentity`?): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
13
+ > **attest**\<`T`\>(`verificationMethodId`, `data`, `namespace`?, `identity`?, `nodeIdentity`?): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
14
14
 
15
15
  Attest the data and return the collated information.
16
16
 
17
+ #### Type Parameters
18
+
19
+ • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
20
+
17
21
  #### Parameters
18
22
 
19
23
  • **verificationMethodId**: `string`
20
24
 
21
25
  The identity verification method to use for attesting the data.
22
26
 
23
- • **data**: `IJsonLdNodeObject`
27
+ • **data**: `T`
24
28
 
25
29
  The data to attest.
26
30
 
@@ -38,7 +42,7 @@ The node identity to include in the attestation.
38
42
 
39
43
  #### Returns
40
44
 
41
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
45
+ `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
42
46
 
43
47
  The collated attestation data.
44
48
 
@@ -46,10 +50,14 @@ The collated attestation data.
46
50
 
47
51
  ### verify()
48
52
 
49
- > **verify**(`attestationId`): `Promise`\<`object`\>
53
+ > **verify**\<`T`\>(`attestationId`): `Promise`\<`object`\>
50
54
 
51
55
  Resolve and verify the attestation id.
52
56
 
57
+ #### Type Parameters
58
+
59
+ • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
60
+
53
61
  #### Parameters
54
62
 
55
63
  • **attestationId**: `string`
@@ -72,16 +80,20 @@ The verified attestation details.
72
80
 
73
81
  ##### information?
74
82
 
75
- > `optional` **information**: `Partial`\<[`IAttestationInformation`](IAttestationInformation.md)\>
83
+ > `optional` **information**: `Partial`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
76
84
 
77
85
  ***
78
86
 
79
87
  ### transfer()
80
88
 
81
- > **transfer**(`attestationId`, `holderIdentity`, `identity`?): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
89
+ > **transfer**\<`T`\>(`attestationId`, `holderIdentity`, `identity`?): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
82
90
 
83
91
  Transfer the attestation to a new holder.
84
92
 
93
+ #### Type Parameters
94
+
95
+ • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
96
+
85
97
  #### Parameters
86
98
 
87
99
  • **attestationId**: `string`
@@ -98,7 +110,7 @@ The identity to perform the attestation operation with.
98
110
 
99
111
  #### Returns
100
112
 
101
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
113
+ `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
102
114
 
103
115
  The updated attestation details.
104
116
 
@@ -10,10 +10,14 @@ Interface describing an attestation connector.
10
10
 
11
11
  ### attest()
12
12
 
13
- > **attest**(`controller`, `address`, `verificationMethodId`, `data`): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
13
+ > **attest**\<`T`\>(`controller`, `address`, `verificationMethodId`, `data`): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
14
14
 
15
15
  Attest the data and return the collated information.
16
16
 
17
+ #### Type Parameters
18
+
19
+ • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
20
+
17
21
  #### Parameters
18
22
 
19
23
  • **controller**: `string`
@@ -28,13 +32,13 @@ The controller address for the attestation.
28
32
 
29
33
  The identity verification method to use for attesting the data.
30
34
 
31
- • **data**: `IJsonLdNodeObject`
35
+ • **data**: `T`
32
36
 
33
37
  The data to attest.
34
38
 
35
39
  #### Returns
36
40
 
37
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
41
+ `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
38
42
 
39
43
  The collated attestation data.
40
44
 
@@ -42,10 +46,14 @@ The collated attestation data.
42
46
 
43
47
  ### verify()
44
48
 
45
- > **verify**(`attestationId`): `Promise`\<`object`\>
49
+ > **verify**\<`T`\>(`attestationId`): `Promise`\<`object`\>
46
50
 
47
51
  Resolve and verify the attestation id.
48
52
 
53
+ #### Type Parameters
54
+
55
+ • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
56
+
49
57
  #### Parameters
50
58
 
51
59
  • **attestationId**: `string`
@@ -68,16 +76,20 @@ The verified attestation details.
68
76
 
69
77
  ##### information?
70
78
 
71
- > `optional` **information**: `Partial`\<[`IAttestationInformation`](IAttestationInformation.md)\>
79
+ > `optional` **information**: `Partial`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
72
80
 
73
81
  ***
74
82
 
75
83
  ### transfer()
76
84
 
77
- > **transfer**(`controller`, `attestationId`, `holderIdentity`, `holderAddress`): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
85
+ > **transfer**\<`T`\>(`controller`, `attestationId`, `holderIdentity`, `holderAddress`): `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
78
86
 
79
87
  Transfer the attestation to a new holder.
80
88
 
89
+ #### Type Parameters
90
+
91
+ • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
92
+
81
93
  #### Parameters
82
94
 
83
95
  • **controller**: `string`
@@ -98,7 +110,7 @@ The new controller address of the attestation belonging to the holder.
98
110
 
99
111
  #### Returns
100
112
 
101
- `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\>
113
+ `Promise`\<[`IAttestationInformation`](IAttestationInformation.md)\<`T`\>\>
102
114
 
103
115
  The updated attestation details.
104
116
 
@@ -1,7 +1,11 @@
1
- # Interface: IAttestationInformation
1
+ # Interface: IAttestationInformation\<T\>
2
2
 
3
3
  Interface describing the collated attestation information.
4
4
 
5
+ ## Type Parameters
6
+
7
+ • **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
8
+
5
9
  ## Properties
6
10
 
7
11
  ### id
@@ -46,7 +50,7 @@ The identity of the current holder, can be undefined if owner is still the holde
46
50
 
47
51
  ### data
48
52
 
49
- > **data**: `IJsonLdNodeObject`
53
+ > **data**: `T`
50
54
 
51
55
  The data that was attested.
52
56
 
@@ -12,6 +12,6 @@ The data returned from the transfer response.
12
12
 
13
13
  #### information
14
14
 
15
- > **information**: [`IAttestationInformation`](IAttestationInformation.md)
15
+ > **information**: [`IAttestationInformation`](IAttestationInformation.md)\<`IJsonLdNodeObject`\>
16
16
 
17
17
  The updated attestation information.
@@ -24,6 +24,6 @@ The failure message if the attestation is not verified.
24
24
 
25
25
  #### information?
26
26
 
27
- > `optional` **information**: `Partial`\<[`IAttestationInformation`](IAttestationInformation.md)\>
27
+ > `optional` **information**: `Partial`\<[`IAttestationInformation`](IAttestationInformation.md)\<`IJsonLdNodeObject`\>\>
28
28
 
29
29
  The attestation information.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/attestation-models",
3
- "version": "0.0.1-next.4",
3
+ "version": "0.0.1-next.6",
4
4
  "description": "Models which define the structure of the attestation connectors and services",
5
5
  "repository": {
6
6
  "type": "git",