@twin.org/identity-models 0.0.1-next.19 → 0.0.1-next.21

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 (37) hide show
  1. package/dist/cjs/index.cjs +43 -16
  2. package/dist/esm/index.mjs +43 -17
  3. package/dist/types/factories/identityResolverConnectorFactory.d.ts +6 -0
  4. package/dist/types/index.d.ts +14 -11
  5. package/dist/types/models/IIdentityComponent.d.ts +126 -5
  6. package/dist/types/models/IIdentityConnector.d.ts +0 -7
  7. package/dist/types/models/IIdentityResolverComponent.d.ts +13 -0
  8. package/dist/types/models/IIdentityResolverConnector.d.ts +14 -0
  9. package/dist/types/models/api/{IIdentityResolveRequest.d.ts → resolver/IIdentityResolveRequest.d.ts} +1 -1
  10. package/dist/types/utils/jwtHelper.d.ts +22 -0
  11. package/docs/changelog.md +1 -1
  12. package/docs/reference/classes/DocumentHelper.md +3 -1
  13. package/docs/reference/classes/JwtHelper.md +59 -0
  14. package/docs/reference/index.md +4 -5
  15. package/docs/reference/interfaces/IIdentityComponent.md +466 -6
  16. package/docs/reference/interfaces/IIdentityConnector.md +125 -107
  17. package/docs/reference/interfaces/IIdentityProfileComponent.md +52 -44
  18. package/docs/reference/interfaces/IIdentityProfileConnector.md +52 -40
  19. package/docs/reference/interfaces/IIdentityResolveRequest.md +1 -1
  20. package/docs/reference/interfaces/IIdentityResolverComponent.md +29 -0
  21. package/docs/reference/interfaces/IIdentityResolverConnector.md +33 -0
  22. package/docs/reference/variables/IdentityProfileConnectorFactory.md +1 -1
  23. package/docs/reference/variables/IdentityResolverConnectorFactory.md +5 -0
  24. package/locales/en.json +5 -4
  25. package/package.json +3 -3
  26. package/dist/types/models/identityRole.d.ts +0 -21
  27. package/docs/reference/type-aliases/IdentityRole.md +0 -5
  28. package/docs/reference/variables/IdentityRole.md +0 -25
  29. /package/dist/types/models/api/{IIdentityProfileCreateRequest.d.ts → profile/IIdentityProfileCreateRequest.d.ts} +0 -0
  30. /package/dist/types/models/api/{IIdentityProfileGetPublicRequest.d.ts → profile/IIdentityProfileGetPublicRequest.d.ts} +0 -0
  31. /package/dist/types/models/api/{IIdentityProfileGetPublicResponse.d.ts → profile/IIdentityProfileGetPublicResponse.d.ts} +0 -0
  32. /package/dist/types/models/api/{IIdentityProfileGetRequest.d.ts → profile/IIdentityProfileGetRequest.d.ts} +0 -0
  33. /package/dist/types/models/api/{IIdentityProfileGetResponse.d.ts → profile/IIdentityProfileGetResponse.d.ts} +0 -0
  34. /package/dist/types/models/api/{IIdentityProfileListRequest.d.ts → profile/IIdentityProfileListRequest.d.ts} +0 -0
  35. /package/dist/types/models/api/{IIdentityProfileListResponse.d.ts → profile/IIdentityProfileListResponse.d.ts} +0 -0
  36. /package/dist/types/models/api/{IIdentityProfileUpdateRequest.d.ts → profile/IIdentityProfileUpdateRequest.d.ts} +0 -0
  37. /package/dist/types/models/api/{IIdentityResolveResponse.d.ts → resolver/IIdentityResolveResponse.d.ts} +0 -0
@@ -22,15 +22,21 @@ Create the profile properties for an identity.
22
22
 
23
23
  #### Parameters
24
24
 
25
- **identity**: `string`
25
+ ##### identity
26
+
27
+ `string`
26
28
 
27
29
  The identity of the profile to create.
28
30
 
29
- **publicProfile?**: `T`
31
+ ##### publicProfile?
32
+
33
+ `T`
30
34
 
31
35
  The public profile data as JSON-LD.
32
36
 
33
- **privateProfile?**: `U`
37
+ ##### privateProfile?
38
+
39
+ `U`
34
40
 
35
41
  The private profile data as JSON-LD.
36
42
 
@@ -44,38 +50,36 @@ Nothing.
44
50
 
45
51
  ### get()
46
52
 
47
- > **get**(`identity`, `publicPropertyNames`?, `privatePropertyNames`?): `Promise`\<`object`\>
53
+ > **get**(`identity`, `publicPropertyNames`?, `privatePropertyNames`?): `Promise`\<\{ `publicProfile`: `Partial`\<`T`\>; `privateProfile`: `Partial`\<`U`\>; \}\>
48
54
 
49
55
  Get the profile properties for an identity.
50
56
 
51
57
  #### Parameters
52
58
 
53
- **identity**: `string`
59
+ ##### identity
60
+
61
+ `string`
54
62
 
55
63
  The identity of the item to get.
56
64
 
57
- **publicPropertyNames?**: keyof `T`[]
65
+ ##### publicPropertyNames?
66
+
67
+ keyof `T`[]
58
68
 
59
69
  The public properties to get for the profile, defaults to all.
60
70
 
61
- **privatePropertyNames?**: keyof `U`[]
71
+ ##### privatePropertyNames?
72
+
73
+ keyof `U`[]
62
74
 
63
75
  The private properties to get for the profile, defaults to all.
64
76
 
65
77
  #### Returns
66
78
 
67
- `Promise`\<`object`\>
79
+ `Promise`\<\{ `publicProfile`: `Partial`\<`T`\>; `privateProfile`: `Partial`\<`U`\>; \}\>
68
80
 
69
81
  The identity profile, will only return private data if you have correct permissions.
70
82
 
71
- ##### publicProfile
72
-
73
- > **publicProfile**: `Partial`\<`T`\>
74
-
75
- ##### privateProfile
76
-
77
- > **privateProfile**: `Partial`\<`U`\>
78
-
79
83
  ***
80
84
 
81
85
  ### update()
@@ -86,15 +90,21 @@ Update the profile properties of an identity.
86
90
 
87
91
  #### Parameters
88
92
 
89
- **identity**: `string`
93
+ ##### identity
94
+
95
+ `string`
90
96
 
91
97
  The identity to update.
92
98
 
93
- **publicProfile?**: `T`
99
+ ##### publicProfile?
100
+
101
+ `T`
94
102
 
95
103
  The public profile data as JSON-LD.
96
104
 
97
- **privateProfile?**: `U`
105
+ ##### privateProfile?
106
+
107
+ `U`
98
108
 
99
109
  The private profile data as JSON-LD.
100
110
 
@@ -114,7 +124,9 @@ Delete the profile for an identity.
114
124
 
115
125
  #### Parameters
116
126
 
117
- **identity**: `string`
127
+ ##### identity
128
+
129
+ `string`
118
130
 
119
131
  The identity to delete.
120
132
 
@@ -128,50 +140,50 @@ Nothing.
128
140
 
129
141
  ### list()
130
142
 
131
- > **list**(`publicFilters`?, `privateFilters`?, `publicPropertyNames`?, `privatePropertyNames`?, `cursor`?, `pageSize`?): `Promise`\<`object`\>
143
+ > **list**(`publicFilters`?, `privateFilters`?, `publicPropertyNames`?, `privatePropertyNames`?, `cursor`?, `pageSize`?): `Promise`\<\{ `items`: `object`[]; `cursor`: `string`; \}\>
132
144
 
133
145
  Get a list of the requested identities.
134
146
 
135
147
  #### Parameters
136
148
 
137
- **publicFilters?**: `object`[]
149
+ ##### publicFilters?
150
+
151
+ `object`[]
138
152
 
139
153
  The filters to apply to the identities public profiles.
140
154
 
141
- **privateFilters?**: `object`[]
155
+ ##### privateFilters?
156
+
157
+ `object`[]
142
158
 
143
159
  The filters to apply to the identities private profiles.
144
160
 
145
- **publicPropertyNames?**: keyof `T`[]
161
+ ##### publicPropertyNames?
162
+
163
+ keyof `T`[]
146
164
 
147
165
  The public properties to get for the profile, defaults to all.
148
166
 
149
- **privatePropertyNames?**: keyof `U`[]
167
+ ##### privatePropertyNames?
168
+
169
+ keyof `U`[]
150
170
 
151
171
  The private properties to get for the profile, defaults to all.
152
172
 
153
- **cursor?**: `string`
173
+ ##### cursor?
174
+
175
+ `string`
154
176
 
155
177
  The cursor for paged requests.
156
178
 
157
- **pageSize?**: `number`
179
+ ##### pageSize?
180
+
181
+ `number`
158
182
 
159
183
  The maximum number of items in a page.
160
184
 
161
185
  #### Returns
162
186
 
163
- `Promise`\<`object`\>
187
+ `Promise`\<\{ `items`: `object`[]; `cursor`: `string`; \}\>
164
188
 
165
189
  The list of items and cursor for paging.
166
-
167
- ##### items
168
-
169
- > **items**: `object`[]
170
-
171
- The identity profiles.
172
-
173
- ##### cursor?
174
-
175
- > `optional` **cursor**: `string`
176
-
177
- An optional cursor, when defined can be used to call find to get more entities.
@@ -14,4 +14,4 @@ The path parameters.
14
14
 
15
15
  > **id**: `string`
16
16
 
17
- The identity to get the document for.
17
+ The identity to resolve.
@@ -0,0 +1,29 @@
1
+ # Interface: IIdentityResolverComponent
2
+
3
+ Interface describing a contract which provides identity operations.
4
+
5
+ ## Extends
6
+
7
+ - `IComponent`
8
+
9
+ ## Methods
10
+
11
+ ### identityResolve()
12
+
13
+ > **identityResolve**(`identity`): `Promise`\<`IDidDocument`\>
14
+
15
+ Resolve an identity.
16
+
17
+ #### Parameters
18
+
19
+ ##### identity
20
+
21
+ `string`
22
+
23
+ The id of the document to resolve.
24
+
25
+ #### Returns
26
+
27
+ `Promise`\<`IDidDocument`\>
28
+
29
+ The resolved document.
@@ -0,0 +1,33 @@
1
+ # Interface: IIdentityResolverConnector
2
+
3
+ Interface describing an identity connector.
4
+
5
+ ## Extends
6
+
7
+ - `IComponent`
8
+
9
+ ## Methods
10
+
11
+ ### resolveDocument()
12
+
13
+ > **resolveDocument**(`documentId`): `Promise`\<`IDidDocument`\>
14
+
15
+ Resolve a document from its id.
16
+
17
+ #### Parameters
18
+
19
+ ##### documentId
20
+
21
+ `string`
22
+
23
+ The id of the document to resolve.
24
+
25
+ #### Returns
26
+
27
+ `Promise`\<`IDidDocument`\>
28
+
29
+ The resolved document.
30
+
31
+ #### Throws
32
+
33
+ NotFoundError if the id can not be resolved.
@@ -1,5 +1,5 @@
1
1
  # Variable: IdentityProfileConnectorFactory
2
2
 
3
- > `const` **IdentityProfileConnectorFactory**: `Factory`\<[`IIdentityProfileConnector`](../interfaces/IIdentityProfileConnector.md)\<`IJsonLdDocument`, `IJsonLdDocument`\>\>
3
+ > `const` **IdentityProfileConnectorFactory**: `Factory`\<[`IIdentityProfileConnector`](../interfaces/IIdentityProfileConnector.md)\>
4
4
 
5
5
  Factory for creating identity profile connectors.
@@ -0,0 +1,5 @@
1
+ # Variable: IdentityResolverConnectorFactory
2
+
3
+ > `const` **IdentityResolverConnectorFactory**: `Factory`\<[`IIdentityResolverConnector`](../interfaces/IIdentityResolverConnector.md)\>
4
+
5
+ Factory for creating identity resolver connectors.
package/locales/en.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
- "identityRole": {
3
- "organization": "Organization",
4
- "user": "User",
5
- "node": "Node"
2
+ "error": {
3
+ "jwtHelper": {
4
+ "jwtDecodeFailed": "Decoding the JWT failed",
5
+ "jwtPayloadMissingParam": "The JWT is missing the required parameter \"{param}\""
6
+ }
6
7
  },
7
8
  "verifiableCredentialStates": {
8
9
  "pendingVerification": "Pending Verification",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-models",
3
- "version": "0.0.1-next.19",
3
+ "version": "0.0.1-next.21",
4
4
  "description": "Models which define the structure of the contracts and connectors",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,9 +26,9 @@
26
26
  "types": "./dist/types/index.d.ts",
27
27
  "exports": {
28
28
  ".": {
29
+ "types": "./dist/types/index.d.ts",
29
30
  "require": "./dist/cjs/index.cjs",
30
- "import": "./dist/esm/index.mjs",
31
- "types": "./dist/types/index.d.ts"
31
+ "import": "./dist/esm/index.mjs"
32
32
  },
33
33
  "./locales/*.json": "./locales/*.json"
34
34
  },
@@ -1,21 +0,0 @@
1
- /**
2
- * The roles that an identity can have.
3
- */
4
- export declare const IdentityRole: {
5
- /**
6
- * Node.
7
- */
8
- readonly Node: "node";
9
- /**
10
- * Organization.
11
- */
12
- readonly Organization: "organization";
13
- /**
14
- * User.
15
- */
16
- readonly User: "user";
17
- };
18
- /**
19
- * The roles that an identity can have.
20
- */
21
- export type IdentityRole = (typeof IdentityRole)[keyof typeof IdentityRole];
@@ -1,5 +0,0 @@
1
- # Type Alias: IdentityRole
2
-
3
- > **IdentityRole**: *typeof* [`IdentityRole`](../variables/IdentityRole.md)\[keyof *typeof* [`IdentityRole`](../variables/IdentityRole.md)\]
4
-
5
- The roles that an identity can have.
@@ -1,25 +0,0 @@
1
- # Variable: IdentityRole
2
-
3
- > `const` **IdentityRole**: `object`
4
-
5
- The roles that an identity can have.
6
-
7
- ## Type declaration
8
-
9
- ### Node
10
-
11
- > `readonly` **Node**: `"node"` = `"node"`
12
-
13
- Node.
14
-
15
- ### Organization
16
-
17
- > `readonly` **Organization**: `"organization"` = `"organization"`
18
-
19
- Organization.
20
-
21
- ### User
22
-
23
- > `readonly` **User**: `"user"` = `"user"`
24
-
25
- User.