@twin.org/identity-connector-entity-storage 0.0.1-next.19 → 0.0.1-next.20
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.
- package/dist/cjs/index.cjs +10 -13
- package/dist/esm/index.mjs +10 -13
- package/dist/types/entityStorageIdentityConnector.d.ts +4 -8
- package/dist/types/entityStorageIdentityProfileConnector.d.ts +4 -6
- package/dist/types/index.d.ts +2 -0
- package/dist/types/models/IEntityStorageIdentityConnectorConstructorOptions.d.ts +15 -0
- package/dist/types/models/IEntityStorageIdentityProfileConnectorConstructorOptions.d.ts +10 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/EntityStorageIdentityConnector.md +131 -93
- package/docs/reference/classes/EntityStorageIdentityProfileConnector.md +56 -46
- package/docs/reference/functions/initSchema.md +7 -3
- package/docs/reference/index.md +5 -0
- package/docs/reference/interfaces/IEntityStorageIdentityConnectorConstructorOptions.md +31 -0
- package/docs/reference/interfaces/IEntityStorageIdentityProfileConnectorConstructorOptions.md +17 -0
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -36,19 +36,19 @@ exports.IdentityDocument = class IdentityDocument {
|
|
|
36
36
|
__decorate([
|
|
37
37
|
entity.property({ type: "string", isPrimary: true }),
|
|
38
38
|
__metadata("design:type", String)
|
|
39
|
-
], exports.IdentityDocument.prototype, "id",
|
|
39
|
+
], exports.IdentityDocument.prototype, "id", undefined);
|
|
40
40
|
__decorate([
|
|
41
41
|
entity.property({ type: "object" }),
|
|
42
42
|
__metadata("design:type", Object)
|
|
43
|
-
], exports.IdentityDocument.prototype, "document",
|
|
43
|
+
], exports.IdentityDocument.prototype, "document", undefined);
|
|
44
44
|
__decorate([
|
|
45
45
|
entity.property({ type: "string" }),
|
|
46
46
|
__metadata("design:type", String)
|
|
47
|
-
], exports.IdentityDocument.prototype, "signature",
|
|
47
|
+
], exports.IdentityDocument.prototype, "signature", undefined);
|
|
48
48
|
__decorate([
|
|
49
49
|
entity.property({ type: "string" }),
|
|
50
50
|
__metadata("design:type", String)
|
|
51
|
-
], exports.IdentityDocument.prototype, "controller",
|
|
51
|
+
], exports.IdentityDocument.prototype, "controller", undefined);
|
|
52
52
|
exports.IdentityDocument = __decorate([
|
|
53
53
|
entity.entity()
|
|
54
54
|
], exports.IdentityDocument);
|
|
@@ -75,15 +75,15 @@ exports.IdentityProfile = class IdentityProfile {
|
|
|
75
75
|
__decorate([
|
|
76
76
|
entity.property({ type: "string", isPrimary: true }),
|
|
77
77
|
__metadata("design:type", String)
|
|
78
|
-
], exports.IdentityProfile.prototype, "identity",
|
|
78
|
+
], exports.IdentityProfile.prototype, "identity", undefined);
|
|
79
79
|
__decorate([
|
|
80
80
|
entity.property({ type: "object" }),
|
|
81
81
|
__metadata("design:type", Object)
|
|
82
|
-
], exports.IdentityProfile.prototype, "publicProfile",
|
|
82
|
+
], exports.IdentityProfile.prototype, "publicProfile", undefined);
|
|
83
83
|
__decorate([
|
|
84
84
|
entity.property({ type: "object" }),
|
|
85
85
|
__metadata("design:type", Object)
|
|
86
|
-
], exports.IdentityProfile.prototype, "privateProfile",
|
|
86
|
+
], exports.IdentityProfile.prototype, "privateProfile", undefined);
|
|
87
87
|
exports.IdentityProfile = __decorate([
|
|
88
88
|
entity.entity()
|
|
89
89
|
], exports.IdentityProfile);
|
|
@@ -119,9 +119,7 @@ class EntityStorageIdentityConnector {
|
|
|
119
119
|
_vaultConnector;
|
|
120
120
|
/**
|
|
121
121
|
* Create a new instance of EntityStorageIdentityConnector.
|
|
122
|
-
* @param options The
|
|
123
|
-
* @param options.didDocumentEntityStorageType The entity storage for the did documents, defaults to "identity-document".
|
|
124
|
-
* @param options.vaultConnectorType The vault for the private keys, defaults to "vault".
|
|
122
|
+
* @param options The options for the identity connector.
|
|
125
123
|
*/
|
|
126
124
|
constructor(options) {
|
|
127
125
|
this._didDocumentEntityStorage = entityStorageModels.EntityStorageConnectorFactory.get(options?.didDocumentEntityStorageType ?? "identity-document");
|
|
@@ -1013,9 +1011,8 @@ class EntityStorageIdentityProfileConnector {
|
|
|
1013
1011
|
*/
|
|
1014
1012
|
_profileEntityStorage;
|
|
1015
1013
|
/**
|
|
1016
|
-
* Create a new instance of
|
|
1017
|
-
* @param options The
|
|
1018
|
-
* @param options.profileEntityStorageType The storage connector for the profiles, default to "identity-profile".
|
|
1014
|
+
* Create a new instance of EntityStorageIdentityProfileConnector.
|
|
1015
|
+
* @param options The options for the identity service.
|
|
1019
1016
|
*/
|
|
1020
1017
|
constructor(options) {
|
|
1021
1018
|
this._profileEntityStorage = entityStorageModels.EntityStorageConnectorFactory.get(options?.profileEntityStorageType ?? "identity-profile");
|
package/dist/esm/index.mjs
CHANGED
|
@@ -34,19 +34,19 @@ let IdentityDocument = class IdentityDocument {
|
|
|
34
34
|
__decorate([
|
|
35
35
|
property({ type: "string", isPrimary: true }),
|
|
36
36
|
__metadata("design:type", String)
|
|
37
|
-
], IdentityDocument.prototype, "id",
|
|
37
|
+
], IdentityDocument.prototype, "id", undefined);
|
|
38
38
|
__decorate([
|
|
39
39
|
property({ type: "object" }),
|
|
40
40
|
__metadata("design:type", Object)
|
|
41
|
-
], IdentityDocument.prototype, "document",
|
|
41
|
+
], IdentityDocument.prototype, "document", undefined);
|
|
42
42
|
__decorate([
|
|
43
43
|
property({ type: "string" }),
|
|
44
44
|
__metadata("design:type", String)
|
|
45
|
-
], IdentityDocument.prototype, "signature",
|
|
45
|
+
], IdentityDocument.prototype, "signature", undefined);
|
|
46
46
|
__decorate([
|
|
47
47
|
property({ type: "string" }),
|
|
48
48
|
__metadata("design:type", String)
|
|
49
|
-
], IdentityDocument.prototype, "controller",
|
|
49
|
+
], IdentityDocument.prototype, "controller", undefined);
|
|
50
50
|
IdentityDocument = __decorate([
|
|
51
51
|
entity()
|
|
52
52
|
], IdentityDocument);
|
|
@@ -73,15 +73,15 @@ let IdentityProfile = class IdentityProfile {
|
|
|
73
73
|
__decorate([
|
|
74
74
|
property({ type: "string", isPrimary: true }),
|
|
75
75
|
__metadata("design:type", String)
|
|
76
|
-
], IdentityProfile.prototype, "identity",
|
|
76
|
+
], IdentityProfile.prototype, "identity", undefined);
|
|
77
77
|
__decorate([
|
|
78
78
|
property({ type: "object" }),
|
|
79
79
|
__metadata("design:type", Object)
|
|
80
|
-
], IdentityProfile.prototype, "publicProfile",
|
|
80
|
+
], IdentityProfile.prototype, "publicProfile", undefined);
|
|
81
81
|
__decorate([
|
|
82
82
|
property({ type: "object" }),
|
|
83
83
|
__metadata("design:type", Object)
|
|
84
|
-
], IdentityProfile.prototype, "privateProfile",
|
|
84
|
+
], IdentityProfile.prototype, "privateProfile", undefined);
|
|
85
85
|
IdentityProfile = __decorate([
|
|
86
86
|
entity()
|
|
87
87
|
], IdentityProfile);
|
|
@@ -117,9 +117,7 @@ class EntityStorageIdentityConnector {
|
|
|
117
117
|
_vaultConnector;
|
|
118
118
|
/**
|
|
119
119
|
* Create a new instance of EntityStorageIdentityConnector.
|
|
120
|
-
* @param options The
|
|
121
|
-
* @param options.didDocumentEntityStorageType The entity storage for the did documents, defaults to "identity-document".
|
|
122
|
-
* @param options.vaultConnectorType The vault for the private keys, defaults to "vault".
|
|
120
|
+
* @param options The options for the identity connector.
|
|
123
121
|
*/
|
|
124
122
|
constructor(options) {
|
|
125
123
|
this._didDocumentEntityStorage = EntityStorageConnectorFactory.get(options?.didDocumentEntityStorageType ?? "identity-document");
|
|
@@ -1011,9 +1009,8 @@ class EntityStorageIdentityProfileConnector {
|
|
|
1011
1009
|
*/
|
|
1012
1010
|
_profileEntityStorage;
|
|
1013
1011
|
/**
|
|
1014
|
-
* Create a new instance of
|
|
1015
|
-
* @param options The
|
|
1016
|
-
* @param options.profileEntityStorageType The storage connector for the profiles, default to "identity-profile".
|
|
1012
|
+
* Create a new instance of EntityStorageIdentityProfileConnector.
|
|
1013
|
+
* @param options The options for the identity service.
|
|
1017
1014
|
*/
|
|
1018
1015
|
constructor(options) {
|
|
1019
1016
|
this._profileEntityStorage = EntityStorageConnectorFactory.get(options?.profileEntityStorageType ?? "identity-profile");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type IJsonLdContextDefinitionRoot, type IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
2
|
import { type IIdentityConnector } from "@twin.org/identity-models";
|
|
3
3
|
import { DidVerificationMethodType, type IDidDocument, type IDidDocumentVerificationMethod, type IDidProof, type IDidService, type IDidVerifiableCredential, type IDidVerifiablePresentation } from "@twin.org/standards-w3c-did";
|
|
4
|
+
import type { IEntityStorageIdentityConnectorConstructorOptions } from "./models/IEntityStorageIdentityConnectorConstructorOptions";
|
|
4
5
|
/**
|
|
5
6
|
* Class for performing identity operations using entity storage.
|
|
6
7
|
*/
|
|
@@ -15,14 +16,9 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
|
|
|
15
16
|
readonly CLASS_NAME: string;
|
|
16
17
|
/**
|
|
17
18
|
* Create a new instance of EntityStorageIdentityConnector.
|
|
18
|
-
* @param options The
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
constructor(options?: {
|
|
23
|
-
didDocumentEntityStorageType?: string;
|
|
24
|
-
vaultConnectorType?: string;
|
|
25
|
-
});
|
|
19
|
+
* @param options The options for the identity connector.
|
|
20
|
+
*/
|
|
21
|
+
constructor(options?: IEntityStorageIdentityConnectorConstructorOptions);
|
|
26
22
|
/**
|
|
27
23
|
* Create a new document.
|
|
28
24
|
* @param controller The controller of the identity who can make changes.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IJsonLdDocument } from "@twin.org/data-json-ld";
|
|
2
2
|
import type { IIdentityProfileConnector } from "@twin.org/identity-models";
|
|
3
|
+
import type { IEntityStorageIdentityProfileConnectorConstructorOptions } from "./models/IEntityStorageIdentityProfileConnectorConstructorOptions";
|
|
3
4
|
/**
|
|
4
5
|
* Class which implements the identity profile connector contract.
|
|
5
6
|
*/
|
|
@@ -13,13 +14,10 @@ export declare class EntityStorageIdentityProfileConnector<T extends IJsonLdDocu
|
|
|
13
14
|
*/
|
|
14
15
|
readonly CLASS_NAME: string;
|
|
15
16
|
/**
|
|
16
|
-
* Create a new instance of
|
|
17
|
-
* @param options The
|
|
18
|
-
* @param options.profileEntityStorageType The storage connector for the profiles, default to "identity-profile".
|
|
17
|
+
* Create a new instance of EntityStorageIdentityProfileConnector.
|
|
18
|
+
* @param options The options for the identity service.
|
|
19
19
|
*/
|
|
20
|
-
constructor(options?:
|
|
21
|
-
profileEntityStorageType?: string;
|
|
22
|
-
});
|
|
20
|
+
constructor(options?: IEntityStorageIdentityProfileConnectorConstructorOptions);
|
|
23
21
|
/**
|
|
24
22
|
* Create the profile properties for an identity.
|
|
25
23
|
* @param identity The identity of the profile to create.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export * from "./entities/identityDocument";
|
|
|
2
2
|
export * from "./entities/identityProfile";
|
|
3
3
|
export * from "./entityStorageIdentityConnector";
|
|
4
4
|
export * from "./entityStorageIdentityProfileConnector";
|
|
5
|
+
export * from "./models/IEntityStorageIdentityConnectorConstructorOptions";
|
|
6
|
+
export * from "./models/IEntityStorageIdentityProfileConnectorConstructorOptions";
|
|
5
7
|
export * from "./schema";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the entity storage identity connector constructor.
|
|
3
|
+
*/
|
|
4
|
+
export interface IEntityStorageIdentityConnectorConstructorOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The entity storage for the did documents.
|
|
7
|
+
* @default identity-document
|
|
8
|
+
*/
|
|
9
|
+
didDocumentEntityStorageType?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The vault for the private keys.
|
|
12
|
+
* @default vault
|
|
13
|
+
*/
|
|
14
|
+
vaultConnectorType?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the entity storage identity profile connector constructor.
|
|
3
|
+
*/
|
|
4
|
+
export interface IEntityStorageIdentityProfileConnectorConstructorOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The storage connector for the profiles.
|
|
7
|
+
* @default identity-profile
|
|
8
|
+
*/
|
|
9
|
+
profileEntityStorageType?: string;
|
|
10
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -16,17 +16,11 @@ Create a new instance of EntityStorageIdentityConnector.
|
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### options?
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
[`IEntityStorageIdentityConnectorConstructorOptions`](../interfaces/IEntityStorageIdentityConnectorConstructorOptions.md)
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
The entity storage for the did documents, defaults to "identity-document".
|
|
26
|
-
|
|
27
|
-
• **options.vaultConnectorType?**: `string`
|
|
28
|
-
|
|
29
|
-
The vault for the private keys, defaults to "vault".
|
|
23
|
+
The options for the identity connector.
|
|
30
24
|
|
|
31
25
|
#### Returns
|
|
32
26
|
|
|
@@ -62,7 +56,9 @@ Create a new document.
|
|
|
62
56
|
|
|
63
57
|
#### Parameters
|
|
64
58
|
|
|
65
|
-
|
|
59
|
+
##### controller
|
|
60
|
+
|
|
61
|
+
`string`
|
|
66
62
|
|
|
67
63
|
The controller of the identity who can make changes.
|
|
68
64
|
|
|
@@ -86,7 +82,9 @@ Resolve a document from its id.
|
|
|
86
82
|
|
|
87
83
|
#### Parameters
|
|
88
84
|
|
|
89
|
-
|
|
85
|
+
##### documentId
|
|
86
|
+
|
|
87
|
+
`string`
|
|
90
88
|
|
|
91
89
|
The id of the document to resolve.
|
|
92
90
|
|
|
@@ -114,19 +112,27 @@ Add a verification method to the document in JSON Web key Format.
|
|
|
114
112
|
|
|
115
113
|
#### Parameters
|
|
116
114
|
|
|
117
|
-
|
|
115
|
+
##### controller
|
|
116
|
+
|
|
117
|
+
`string`
|
|
118
118
|
|
|
119
119
|
The controller of the identity who can make changes.
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
##### documentId
|
|
122
|
+
|
|
123
|
+
`string`
|
|
122
124
|
|
|
123
125
|
The id of the document to add the verification method to.
|
|
124
126
|
|
|
125
|
-
|
|
127
|
+
##### verificationMethodType
|
|
128
|
+
|
|
129
|
+
`DidVerificationMethodType`
|
|
126
130
|
|
|
127
131
|
The type of the verification method to add.
|
|
128
132
|
|
|
129
|
-
|
|
133
|
+
##### verificationMethodId?
|
|
134
|
+
|
|
135
|
+
`string`
|
|
130
136
|
|
|
131
137
|
The id of the verification method, if undefined uses the kid of the generated JWK.
|
|
132
138
|
|
|
@@ -158,11 +164,15 @@ Remove a verification method from the document.
|
|
|
158
164
|
|
|
159
165
|
#### Parameters
|
|
160
166
|
|
|
161
|
-
|
|
167
|
+
##### controller
|
|
168
|
+
|
|
169
|
+
`string`
|
|
162
170
|
|
|
163
171
|
The controller of the identity who can make changes.
|
|
164
172
|
|
|
165
|
-
|
|
173
|
+
##### verificationMethodId
|
|
174
|
+
|
|
175
|
+
`string`
|
|
166
176
|
|
|
167
177
|
The id of the verification method.
|
|
168
178
|
|
|
@@ -194,23 +204,33 @@ Add a service to the document.
|
|
|
194
204
|
|
|
195
205
|
#### Parameters
|
|
196
206
|
|
|
197
|
-
|
|
207
|
+
##### controller
|
|
208
|
+
|
|
209
|
+
`string`
|
|
198
210
|
|
|
199
211
|
The controller of the identity who can make changes.
|
|
200
212
|
|
|
201
|
-
|
|
213
|
+
##### documentId
|
|
214
|
+
|
|
215
|
+
`string`
|
|
202
216
|
|
|
203
217
|
The id of the document to add the service to.
|
|
204
218
|
|
|
205
|
-
|
|
219
|
+
##### serviceId
|
|
220
|
+
|
|
221
|
+
`string`
|
|
206
222
|
|
|
207
223
|
The id of the service.
|
|
208
224
|
|
|
209
|
-
|
|
225
|
+
##### serviceType
|
|
226
|
+
|
|
227
|
+
`string`
|
|
210
228
|
|
|
211
229
|
The type of the service.
|
|
212
230
|
|
|
213
|
-
|
|
231
|
+
##### serviceEndpoint
|
|
232
|
+
|
|
233
|
+
`string`
|
|
214
234
|
|
|
215
235
|
The endpoint for the service.
|
|
216
236
|
|
|
@@ -238,11 +258,15 @@ Remove a service from the document.
|
|
|
238
258
|
|
|
239
259
|
#### Parameters
|
|
240
260
|
|
|
241
|
-
|
|
261
|
+
##### controller
|
|
262
|
+
|
|
263
|
+
`string`
|
|
242
264
|
|
|
243
265
|
The controller of the identity who can make changes.
|
|
244
266
|
|
|
245
|
-
|
|
267
|
+
##### serviceId
|
|
268
|
+
|
|
269
|
+
`string`
|
|
246
270
|
|
|
247
271
|
The id of the service.
|
|
248
272
|
|
|
@@ -264,46 +288,48 @@ NotFoundError if the id can not be resolved.
|
|
|
264
288
|
|
|
265
289
|
### createVerifiableCredential()
|
|
266
290
|
|
|
267
|
-
> **createVerifiableCredential**(`controller`, `verificationMethodId`, `id`, `credential`, `revocationIndex`?): `Promise
|
|
291
|
+
> **createVerifiableCredential**(`controller`, `verificationMethodId`, `id`, `credential`, `revocationIndex`?): `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
|
|
268
292
|
|
|
269
293
|
Create a verifiable credential for a verification method.
|
|
270
294
|
|
|
271
295
|
#### Parameters
|
|
272
296
|
|
|
273
|
-
|
|
297
|
+
##### controller
|
|
298
|
+
|
|
299
|
+
`string`
|
|
274
300
|
|
|
275
301
|
The controller of the identity who can make changes.
|
|
276
302
|
|
|
277
|
-
|
|
303
|
+
##### verificationMethodId
|
|
304
|
+
|
|
305
|
+
`string`
|
|
278
306
|
|
|
279
307
|
The verification method id to use.
|
|
280
308
|
|
|
281
|
-
|
|
309
|
+
##### id
|
|
282
310
|
|
|
283
311
|
The id of the credential.
|
|
284
312
|
|
|
285
|
-
|
|
313
|
+
`undefined` | `string`
|
|
314
|
+
|
|
315
|
+
##### credential
|
|
316
|
+
|
|
317
|
+
`IJsonLdNodeObject`
|
|
286
318
|
|
|
287
319
|
The credential to store in the verifiable credential.
|
|
288
320
|
|
|
289
|
-
|
|
321
|
+
##### revocationIndex?
|
|
322
|
+
|
|
323
|
+
`number`
|
|
290
324
|
|
|
291
325
|
The bitmap revocation index of the credential, if undefined will not have revocation status.
|
|
292
326
|
|
|
293
327
|
#### Returns
|
|
294
328
|
|
|
295
|
-
`Promise
|
|
329
|
+
`Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
|
|
296
330
|
|
|
297
331
|
The created verifiable credential and its token.
|
|
298
332
|
|
|
299
|
-
##### verifiableCredential
|
|
300
|
-
|
|
301
|
-
> **verifiableCredential**: `IDidVerifiableCredential`
|
|
302
|
-
|
|
303
|
-
##### jwt
|
|
304
|
-
|
|
305
|
-
> **jwt**: `string`
|
|
306
|
-
|
|
307
333
|
#### Throws
|
|
308
334
|
|
|
309
335
|
NotFoundError if the id can not be resolved.
|
|
@@ -316,30 +342,24 @@ NotFoundError if the id can not be resolved.
|
|
|
316
342
|
|
|
317
343
|
### checkVerifiableCredential()
|
|
318
344
|
|
|
319
|
-
> **checkVerifiableCredential**(`credentialJwt`): `Promise
|
|
345
|
+
> **checkVerifiableCredential**(`credentialJwt`): `Promise`\<\{ `revoked`: `boolean`; `verifiableCredential`: `IDidVerifiableCredential`; \}\>
|
|
320
346
|
|
|
321
347
|
Check a verifiable credential is valid.
|
|
322
348
|
|
|
323
349
|
#### Parameters
|
|
324
350
|
|
|
325
|
-
|
|
351
|
+
##### credentialJwt
|
|
352
|
+
|
|
353
|
+
`string`
|
|
326
354
|
|
|
327
355
|
The credential to verify.
|
|
328
356
|
|
|
329
357
|
#### Returns
|
|
330
358
|
|
|
331
|
-
`Promise
|
|
359
|
+
`Promise`\<\{ `revoked`: `boolean`; `verifiableCredential`: `IDidVerifiableCredential`; \}\>
|
|
332
360
|
|
|
333
361
|
The credential stored in the jwt and the revocation status.
|
|
334
362
|
|
|
335
|
-
##### revoked
|
|
336
|
-
|
|
337
|
-
> **revoked**: `boolean`
|
|
338
|
-
|
|
339
|
-
##### verifiableCredential?
|
|
340
|
-
|
|
341
|
-
> `optional` **verifiableCredential**: `IDidVerifiableCredential`
|
|
342
|
-
|
|
343
363
|
#### Implementation of
|
|
344
364
|
|
|
345
365
|
`IIdentityConnector.checkVerifiableCredential`
|
|
@@ -354,15 +374,21 @@ Revoke verifiable credential(s).
|
|
|
354
374
|
|
|
355
375
|
#### Parameters
|
|
356
376
|
|
|
357
|
-
|
|
377
|
+
##### controller
|
|
378
|
+
|
|
379
|
+
`string`
|
|
358
380
|
|
|
359
381
|
The controller of the identity who can make changes.
|
|
360
382
|
|
|
361
|
-
|
|
383
|
+
##### issuerDocumentId
|
|
384
|
+
|
|
385
|
+
`string`
|
|
362
386
|
|
|
363
387
|
The id of the document to update the revocation list for.
|
|
364
388
|
|
|
365
|
-
|
|
389
|
+
##### credentialIndices
|
|
390
|
+
|
|
391
|
+
`number`[]
|
|
366
392
|
|
|
367
393
|
The revocation bitmap index or indices to revoke.
|
|
368
394
|
|
|
@@ -386,15 +412,21 @@ Unrevoke verifiable credential(s).
|
|
|
386
412
|
|
|
387
413
|
#### Parameters
|
|
388
414
|
|
|
389
|
-
|
|
415
|
+
##### controller
|
|
416
|
+
|
|
417
|
+
`string`
|
|
390
418
|
|
|
391
419
|
The controller of the identity who can make changes.
|
|
392
420
|
|
|
393
|
-
|
|
421
|
+
##### issuerDocumentId
|
|
422
|
+
|
|
423
|
+
`string`
|
|
394
424
|
|
|
395
425
|
The id of the document to update the revocation list for.
|
|
396
426
|
|
|
397
|
-
|
|
427
|
+
##### credentialIndices
|
|
428
|
+
|
|
429
|
+
`number`[]
|
|
398
430
|
|
|
399
431
|
The revocation bitmap index or indices to un revoke.
|
|
400
432
|
|
|
@@ -412,54 +444,60 @@ Nothing.
|
|
|
412
444
|
|
|
413
445
|
### createVerifiablePresentation()
|
|
414
446
|
|
|
415
|
-
> **createVerifiablePresentation**(`controller`, `presentationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `expiresInMinutes`?): `Promise
|
|
447
|
+
> **createVerifiablePresentation**(`controller`, `presentationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `expiresInMinutes`?): `Promise`\<\{ `verifiablePresentation`: `IDidVerifiablePresentation`; `jwt`: `string`; \}\>
|
|
416
448
|
|
|
417
449
|
Create a verifiable presentation from the supplied verifiable credentials.
|
|
418
450
|
|
|
419
451
|
#### Parameters
|
|
420
452
|
|
|
421
|
-
|
|
453
|
+
##### controller
|
|
454
|
+
|
|
455
|
+
`string`
|
|
422
456
|
|
|
423
457
|
The controller of the identity who can make changes.
|
|
424
458
|
|
|
425
|
-
|
|
459
|
+
##### presentationMethodId
|
|
460
|
+
|
|
461
|
+
`string`
|
|
426
462
|
|
|
427
463
|
The method to associate with the presentation.
|
|
428
464
|
|
|
429
|
-
|
|
465
|
+
##### presentationId
|
|
430
466
|
|
|
431
467
|
The id of the presentation.
|
|
432
468
|
|
|
433
|
-
|
|
469
|
+
`undefined` | `string`
|
|
470
|
+
|
|
471
|
+
##### contexts
|
|
434
472
|
|
|
435
473
|
The contexts for the data stored in the verifiable credential.
|
|
436
474
|
|
|
437
|
-
|
|
475
|
+
`undefined` | `IJsonLdContextDefinitionRoot`
|
|
476
|
+
|
|
477
|
+
##### types
|
|
438
478
|
|
|
439
479
|
The types for the data stored in the verifiable credential.
|
|
440
480
|
|
|
441
|
-
|
|
481
|
+
`undefined` | `string` | `string`[]
|
|
482
|
+
|
|
483
|
+
##### verifiableCredentials
|
|
484
|
+
|
|
485
|
+
(`string` \| `IDidVerifiableCredential`)[]
|
|
442
486
|
|
|
443
487
|
The credentials to use for creating the presentation in jwt format.
|
|
444
488
|
|
|
445
|
-
|
|
489
|
+
##### expiresInMinutes?
|
|
490
|
+
|
|
491
|
+
`number`
|
|
446
492
|
|
|
447
493
|
The time in minutes for the presentation to expire.
|
|
448
494
|
|
|
449
495
|
#### Returns
|
|
450
496
|
|
|
451
|
-
`Promise
|
|
497
|
+
`Promise`\<\{ `verifiablePresentation`: `IDidVerifiablePresentation`; `jwt`: `string`; \}\>
|
|
452
498
|
|
|
453
499
|
The created verifiable presentation and its token.
|
|
454
500
|
|
|
455
|
-
##### verifiablePresentation
|
|
456
|
-
|
|
457
|
-
> **verifiablePresentation**: `IDidVerifiablePresentation`
|
|
458
|
-
|
|
459
|
-
##### jwt
|
|
460
|
-
|
|
461
|
-
> **jwt**: `string`
|
|
462
|
-
|
|
463
501
|
#### Throws
|
|
464
502
|
|
|
465
503
|
NotFoundError if the id can not be resolved.
|
|
@@ -472,34 +510,24 @@ NotFoundError if the id can not be resolved.
|
|
|
472
510
|
|
|
473
511
|
### checkVerifiablePresentation()
|
|
474
512
|
|
|
475
|
-
> **checkVerifiablePresentation**(`presentationJwt`): `Promise
|
|
513
|
+
> **checkVerifiablePresentation**(`presentationJwt`): `Promise`\<\{ `revoked`: `boolean`; `verifiablePresentation`: `IDidVerifiablePresentation`; `issuers`: `IDidDocument`[]; \}\>
|
|
476
514
|
|
|
477
515
|
Check a verifiable presentation is valid.
|
|
478
516
|
|
|
479
517
|
#### Parameters
|
|
480
518
|
|
|
481
|
-
|
|
519
|
+
##### presentationJwt
|
|
520
|
+
|
|
521
|
+
`string`
|
|
482
522
|
|
|
483
523
|
The presentation to verify.
|
|
484
524
|
|
|
485
525
|
#### Returns
|
|
486
526
|
|
|
487
|
-
`Promise
|
|
527
|
+
`Promise`\<\{ `revoked`: `boolean`; `verifiablePresentation`: `IDidVerifiablePresentation`; `issuers`: `IDidDocument`[]; \}\>
|
|
488
528
|
|
|
489
529
|
The presentation stored in the jwt and the revocation status.
|
|
490
530
|
|
|
491
|
-
##### revoked
|
|
492
|
-
|
|
493
|
-
> **revoked**: `boolean`
|
|
494
|
-
|
|
495
|
-
##### verifiablePresentation?
|
|
496
|
-
|
|
497
|
-
> `optional` **verifiablePresentation**: `IDidVerifiablePresentation`
|
|
498
|
-
|
|
499
|
-
##### issuers?
|
|
500
|
-
|
|
501
|
-
> `optional` **issuers**: `IDidDocument`[]
|
|
502
|
-
|
|
503
531
|
#### Implementation of
|
|
504
532
|
|
|
505
533
|
`IIdentityConnector.checkVerifiablePresentation`
|
|
@@ -514,15 +542,21 @@ Create a proof for arbitrary data with the specified verification method.
|
|
|
514
542
|
|
|
515
543
|
#### Parameters
|
|
516
544
|
|
|
517
|
-
|
|
545
|
+
##### controller
|
|
546
|
+
|
|
547
|
+
`string`
|
|
518
548
|
|
|
519
549
|
The controller of the identity who can make changes.
|
|
520
550
|
|
|
521
|
-
|
|
551
|
+
##### verificationMethodId
|
|
552
|
+
|
|
553
|
+
`string`
|
|
522
554
|
|
|
523
555
|
The verification method id to use.
|
|
524
556
|
|
|
525
|
-
|
|
557
|
+
##### bytes
|
|
558
|
+
|
|
559
|
+
`Uint8Array`
|
|
526
560
|
|
|
527
561
|
The data bytes to sign.
|
|
528
562
|
|
|
@@ -546,11 +580,15 @@ Verify proof for arbitrary data with the specified verification method.
|
|
|
546
580
|
|
|
547
581
|
#### Parameters
|
|
548
582
|
|
|
549
|
-
|
|
583
|
+
##### bytes
|
|
584
|
+
|
|
585
|
+
`Uint8Array`
|
|
550
586
|
|
|
551
587
|
The data bytes to verify.
|
|
552
588
|
|
|
553
|
-
|
|
589
|
+
##### proof
|
|
590
|
+
|
|
591
|
+
`IDidProof`
|
|
554
592
|
|
|
555
593
|
The proof to verify.
|
|
556
594
|
|
|
@@ -18,17 +18,15 @@ Class which implements the identity profile connector contract.
|
|
|
18
18
|
|
|
19
19
|
> **new EntityStorageIdentityProfileConnector**\<`T`, `U`\>(`options`?): [`EntityStorageIdentityProfileConnector`](EntityStorageIdentityProfileConnector.md)\<`T`, `U`\>
|
|
20
20
|
|
|
21
|
-
Create a new instance of
|
|
21
|
+
Create a new instance of EntityStorageIdentityProfileConnector.
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### options?
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
[`IEntityStorageIdentityProfileConnectorConstructorOptions`](../interfaces/IEntityStorageIdentityProfileConnectorConstructorOptions.md)
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
The storage connector for the profiles, default to "identity-profile".
|
|
29
|
+
The options for the identity service.
|
|
32
30
|
|
|
33
31
|
#### Returns
|
|
34
32
|
|
|
@@ -64,15 +62,21 @@ Create the profile properties for an identity.
|
|
|
64
62
|
|
|
65
63
|
#### Parameters
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
##### identity
|
|
66
|
+
|
|
67
|
+
`string`
|
|
68
68
|
|
|
69
69
|
The identity of the profile to create.
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
##### publicProfile?
|
|
72
|
+
|
|
73
|
+
`T`
|
|
72
74
|
|
|
73
75
|
The public profile data.
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
##### privateProfile?
|
|
78
|
+
|
|
79
|
+
`U`
|
|
76
80
|
|
|
77
81
|
The private profile data.
|
|
78
82
|
|
|
@@ -90,38 +94,36 @@ Nothing.
|
|
|
90
94
|
|
|
91
95
|
### get()
|
|
92
96
|
|
|
93
|
-
> **get**(`identity`, `publicPropertyNames`?, `privatePropertyNames`?): `Promise`\<`
|
|
97
|
+
> **get**(`identity`, `publicPropertyNames`?, `privatePropertyNames`?): `Promise`\<\{ `publicProfile`: `Partial`\<`T`\>; `privateProfile`: `Partial`\<`U`\>; \}\>
|
|
94
98
|
|
|
95
99
|
Get the profile properties for an identity.
|
|
96
100
|
|
|
97
101
|
#### Parameters
|
|
98
102
|
|
|
99
|
-
|
|
103
|
+
##### identity
|
|
104
|
+
|
|
105
|
+
`string`
|
|
100
106
|
|
|
101
107
|
The identity of the item to get.
|
|
102
108
|
|
|
103
|
-
|
|
109
|
+
##### publicPropertyNames?
|
|
110
|
+
|
|
111
|
+
keyof `T`[]
|
|
104
112
|
|
|
105
113
|
The public properties to get for the profile, defaults to all.
|
|
106
114
|
|
|
107
|
-
|
|
115
|
+
##### privatePropertyNames?
|
|
116
|
+
|
|
117
|
+
keyof `U`[]
|
|
108
118
|
|
|
109
119
|
The private properties to get for the profile, defaults to all.
|
|
110
120
|
|
|
111
121
|
#### Returns
|
|
112
122
|
|
|
113
|
-
`Promise`\<`
|
|
123
|
+
`Promise`\<\{ `publicProfile`: `Partial`\<`T`\>; `privateProfile`: `Partial`\<`U`\>; \}\>
|
|
114
124
|
|
|
115
125
|
The items properties.
|
|
116
126
|
|
|
117
|
-
##### publicProfile
|
|
118
|
-
|
|
119
|
-
> **publicProfile**: `Partial`\<`T`\>
|
|
120
|
-
|
|
121
|
-
##### privateProfile
|
|
122
|
-
|
|
123
|
-
> **privateProfile**: `Partial`\<`U`\>
|
|
124
|
-
|
|
125
127
|
#### Implementation of
|
|
126
128
|
|
|
127
129
|
`IIdentityProfileConnector.get`
|
|
@@ -136,15 +138,21 @@ Update the profile properties of an identity.
|
|
|
136
138
|
|
|
137
139
|
#### Parameters
|
|
138
140
|
|
|
139
|
-
|
|
141
|
+
##### identity
|
|
142
|
+
|
|
143
|
+
`string`
|
|
140
144
|
|
|
141
145
|
The identity to update.
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
##### publicProfile?
|
|
148
|
+
|
|
149
|
+
`T`
|
|
144
150
|
|
|
145
151
|
The public profile data.
|
|
146
152
|
|
|
147
|
-
|
|
153
|
+
##### privateProfile?
|
|
154
|
+
|
|
155
|
+
`U`
|
|
148
156
|
|
|
149
157
|
The private profile data.
|
|
150
158
|
|
|
@@ -168,7 +176,9 @@ Delete the profile for an identity.
|
|
|
168
176
|
|
|
169
177
|
#### Parameters
|
|
170
178
|
|
|
171
|
-
|
|
179
|
+
##### identity
|
|
180
|
+
|
|
181
|
+
`string`
|
|
172
182
|
|
|
173
183
|
The identity to delete.
|
|
174
184
|
|
|
@@ -186,54 +196,54 @@ Nothing.
|
|
|
186
196
|
|
|
187
197
|
### list()
|
|
188
198
|
|
|
189
|
-
> **list**(`publicFilters`?, `privateFilters`?, `publicPropertyNames`?, `privatePropertyNames`?, `cursor`?, `pageSize`?): `Promise
|
|
199
|
+
> **list**(`publicFilters`?, `privateFilters`?, `publicPropertyNames`?, `privatePropertyNames`?, `cursor`?, `pageSize`?): `Promise`\<\{ `items`: `object`[]; `cursor`: `string`; \}\>
|
|
190
200
|
|
|
191
201
|
Get a list of the requested types.
|
|
192
202
|
|
|
193
203
|
#### Parameters
|
|
194
204
|
|
|
195
|
-
|
|
205
|
+
##### publicFilters?
|
|
206
|
+
|
|
207
|
+
`object`[]
|
|
196
208
|
|
|
197
209
|
The filters to apply to the identities public profiles.
|
|
198
210
|
|
|
199
|
-
|
|
211
|
+
##### privateFilters?
|
|
212
|
+
|
|
213
|
+
`object`[]
|
|
200
214
|
|
|
201
215
|
The filters to apply to the identities private profiles.
|
|
202
216
|
|
|
203
|
-
|
|
217
|
+
##### publicPropertyNames?
|
|
218
|
+
|
|
219
|
+
keyof `T`[]
|
|
204
220
|
|
|
205
221
|
The public properties to get for the profile, defaults to all.
|
|
206
222
|
|
|
207
|
-
|
|
223
|
+
##### privatePropertyNames?
|
|
224
|
+
|
|
225
|
+
keyof `U`[]
|
|
208
226
|
|
|
209
227
|
The private properties to get for the profile, defaults to all.
|
|
210
228
|
|
|
211
|
-
|
|
229
|
+
##### cursor?
|
|
230
|
+
|
|
231
|
+
`string`
|
|
212
232
|
|
|
213
233
|
The cursor for paged requests.
|
|
214
234
|
|
|
215
|
-
|
|
235
|
+
##### pageSize?
|
|
236
|
+
|
|
237
|
+
`number`
|
|
216
238
|
|
|
217
239
|
The maximum number of items in a page.
|
|
218
240
|
|
|
219
241
|
#### Returns
|
|
220
242
|
|
|
221
|
-
`Promise
|
|
243
|
+
`Promise`\<\{ `items`: `object`[]; `cursor`: `string`; \}\>
|
|
222
244
|
|
|
223
245
|
The list of items and cursor for paging.
|
|
224
246
|
|
|
225
|
-
##### items
|
|
226
|
-
|
|
227
|
-
> **items**: `object`[]
|
|
228
|
-
|
|
229
|
-
The identities.
|
|
230
|
-
|
|
231
|
-
##### cursor?
|
|
232
|
-
|
|
233
|
-
> `optional` **cursor**: `string`
|
|
234
|
-
|
|
235
|
-
An optional cursor, when defined can be used to call find to get more entities.
|
|
236
|
-
|
|
237
247
|
#### Implementation of
|
|
238
248
|
|
|
239
249
|
`IIdentityProfileConnector.list`
|
|
@@ -6,15 +6,19 @@ Initialize the schema for the identity entity storage connector.
|
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### options?
|
|
10
10
|
|
|
11
11
|
Options for which entities to register.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
#### includeDocument
|
|
14
|
+
|
|
15
|
+
`boolean`
|
|
14
16
|
|
|
15
17
|
Whether to include the document entity, defaults to true.
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
#### includeProfile
|
|
20
|
+
|
|
21
|
+
`boolean`
|
|
18
22
|
|
|
19
23
|
Whether to include the profile entity, defaults to true.
|
|
20
24
|
|
package/docs/reference/index.md
CHANGED
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
- [EntityStorageIdentityConnector](classes/EntityStorageIdentityConnector.md)
|
|
8
8
|
- [EntityStorageIdentityProfileConnector](classes/EntityStorageIdentityProfileConnector.md)
|
|
9
9
|
|
|
10
|
+
## Interfaces
|
|
11
|
+
|
|
12
|
+
- [IEntityStorageIdentityConnectorConstructorOptions](interfaces/IEntityStorageIdentityConnectorConstructorOptions.md)
|
|
13
|
+
- [IEntityStorageIdentityProfileConnectorConstructorOptions](interfaces/IEntityStorageIdentityProfileConnectorConstructorOptions.md)
|
|
14
|
+
|
|
10
15
|
## Functions
|
|
11
16
|
|
|
12
17
|
- [initSchema](functions/initSchema.md)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Interface: IEntityStorageIdentityConnectorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the entity storage identity connector constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### didDocumentEntityStorageType?
|
|
8
|
+
|
|
9
|
+
> `optional` **didDocumentEntityStorageType**: `string`
|
|
10
|
+
|
|
11
|
+
The entity storage for the did documents.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
identity-document
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### vaultConnectorType?
|
|
22
|
+
|
|
23
|
+
> `optional` **vaultConnectorType**: `string`
|
|
24
|
+
|
|
25
|
+
The vault for the private keys.
|
|
26
|
+
|
|
27
|
+
#### Default
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
vault
|
|
31
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: IEntityStorageIdentityProfileConnectorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the entity storage identity profile connector constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### profileEntityStorageType?
|
|
8
|
+
|
|
9
|
+
> `optional` **profileEntityStorageType**: `string`
|
|
10
|
+
|
|
11
|
+
The storage connector for the profiles.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
identity-profile
|
|
17
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/identity-connector-entity-storage",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.20",
|
|
4
4
|
"description": "Identity connector implementation using entity storage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@twin.org/data-core": "next",
|
|
20
20
|
"@twin.org/data-json-ld": "next",
|
|
21
21
|
"@twin.org/entity": "next",
|
|
22
|
-
"@twin.org/identity-models": "0.0.1-next.
|
|
22
|
+
"@twin.org/identity-models": "0.0.1-next.20",
|
|
23
23
|
"@twin.org/nameof": "next",
|
|
24
24
|
"@twin.org/standards-w3c-did": "next",
|
|
25
25
|
"@twin.org/vault-models": "next",
|