@twin.org/identity-connector-entity-storage 0.0.3-next.2 → 0.0.3-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.
- package/README.md +2 -2
- package/dist/es/entityStorageIdentityConnector.js +171 -27
- package/dist/es/entityStorageIdentityConnector.js.map +1 -1
- package/dist/es/entityStorageIdentityProfileConnector.js.map +1 -1
- package/dist/es/models/IEntityStorageIdentityConnectorConstructorOptions.js.map +1 -1
- package/dist/types/entityStorageIdentityConnector.d.ts +37 -8
- package/docs/changelog.md +380 -69
- package/docs/examples.md +221 -1
- package/docs/reference/classes/EntityStorageIdentityConnector.md +148 -40
- package/docs/reference/classes/EntityStorageIdentityProfileConnector.md +8 -8
- package/docs/reference/classes/EntityStorageIdentityResolverConnector.md +4 -4
- package/docs/reference/classes/IdentityDocument.md +4 -4
- package/docs/reference/classes/IdentityProfile.md +5 -5
- package/docs/reference/interfaces/IEntityStorageIdentityConnectorConstructorOptions.md +4 -4
- package/docs/reference/interfaces/IEntityStorageIdentityProfileConnectorConstructorOptions.md +2 -2
- package/docs/reference/interfaces/IEntityStorageIdentityResolverConnectorConstructorOptions.md +4 -4
- package/locales/en.json +21 -16
- package/package.json +5 -5
package/docs/examples.md
CHANGED
|
@@ -1 +1,221 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Identity Connector Entity Storage Examples
|
|
2
|
+
|
|
3
|
+
These snippets demonstrate document, profile, and resolution workflows using entity storage connectors and model entities.
|
|
4
|
+
|
|
5
|
+
## EntityStorageIdentityConnector
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { EntityStorageIdentityConnector } from '@twin.org/identity-connector-entity-storage';
|
|
9
|
+
|
|
10
|
+
const connector = new EntityStorageIdentityConnector({
|
|
11
|
+
didDocumentEntityStorageType: 'identity-document',
|
|
12
|
+
vaultConnectorType: 'vault'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const className = connector.className();
|
|
16
|
+
const createdDocument = await connector.createDocument('controller-1');
|
|
17
|
+
const vaultKey = EntityStorageIdentityConnector.buildVaultKey(createdDocument.id, 'did');
|
|
18
|
+
|
|
19
|
+
await connector.removeDocument('controller-1', createdDocument.id);
|
|
20
|
+
|
|
21
|
+
console.log(className); // EntityStorageIdentityConnector
|
|
22
|
+
console.log(vaultKey); // did:entity-storage:.../did
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { EntityStorageIdentityConnector } from '@twin.org/identity-connector-entity-storage';
|
|
27
|
+
import { DidVerificationMethodType, ProofTypes } from '@twin.org/standards-w3c-did';
|
|
28
|
+
|
|
29
|
+
const connector = new EntityStorageIdentityConnector({
|
|
30
|
+
didDocumentEntityStorageType: 'identity-document',
|
|
31
|
+
vaultConnectorType: 'vault'
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const identity = 'did:entity-storage:0x1234abcd';
|
|
35
|
+
|
|
36
|
+
const verificationMethod = await connector.addVerificationMethod(
|
|
37
|
+
'controller-1',
|
|
38
|
+
identity,
|
|
39
|
+
DidVerificationMethodType.VerificationMethod,
|
|
40
|
+
'signing-key'
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
await connector.removeVerificationMethod('controller-1', verificationMethod.id);
|
|
44
|
+
|
|
45
|
+
const service = await connector.addService(
|
|
46
|
+
'controller-1',
|
|
47
|
+
identity,
|
|
48
|
+
'linked-domain',
|
|
49
|
+
'LinkedDomains',
|
|
50
|
+
'https://example.org'
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
await connector.removeService('controller-1', service.id);
|
|
54
|
+
|
|
55
|
+
const createdCredential = await connector.createVerifiableCredential(
|
|
56
|
+
'controller-1',
|
|
57
|
+
`${identity}#signing-key`,
|
|
58
|
+
'urn:uuid:credential-001',
|
|
59
|
+
{
|
|
60
|
+
id: 'did:entity-storage:0x5678efab',
|
|
61
|
+
role: 'Engineer'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
revocationIndex: 3
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const verifiedCredential = await connector.checkVerifiableCredential(createdCredential.jwt);
|
|
69
|
+
|
|
70
|
+
await connector.revokeVerifiableCredentials('controller-1', identity, [3]);
|
|
71
|
+
await connector.unrevokeVerifiableCredentials('controller-1', identity, [3]);
|
|
72
|
+
|
|
73
|
+
const createdPresentation = await connector.createVerifiablePresentation(
|
|
74
|
+
'controller-1',
|
|
75
|
+
`${identity}#signing-key`,
|
|
76
|
+
'urn:uuid:presentation-001',
|
|
77
|
+
['https://www.w3.org/2018/credentials/v1'],
|
|
78
|
+
['VerifiablePresentation'],
|
|
79
|
+
[createdCredential.jwt]
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const verifiedPresentation = await connector.checkVerifiablePresentation(createdPresentation.jwt);
|
|
83
|
+
|
|
84
|
+
const proof = await connector.createProof(
|
|
85
|
+
'controller-1',
|
|
86
|
+
`${identity}#signing-key`,
|
|
87
|
+
ProofTypes.DataIntegrityProof,
|
|
88
|
+
{
|
|
89
|
+
id: 'urn:example:document-1',
|
|
90
|
+
status: 'active'
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const proofVerified = await connector.verifyProof(
|
|
95
|
+
{
|
|
96
|
+
id: 'urn:example:document-1',
|
|
97
|
+
status: 'active'
|
|
98
|
+
},
|
|
99
|
+
proof
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
console.log(verifiedCredential.revoked); // false
|
|
103
|
+
console.log(verifiedPresentation.revoked); // false
|
|
104
|
+
console.log(proofVerified); // true
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## EntityStorageIdentityProfileConnector
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import { EntityStorageIdentityProfileConnector } from '@twin.org/identity-connector-entity-storage';
|
|
111
|
+
|
|
112
|
+
interface PublicProfile {
|
|
113
|
+
displayName: string;
|
|
114
|
+
region: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface PrivateProfile {
|
|
118
|
+
email: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const profileConnector = new EntityStorageIdentityProfileConnector<PublicProfile, PrivateProfile>({
|
|
122
|
+
profileEntityStorageType: 'identity-profile'
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const className = profileConnector.className();
|
|
126
|
+
const identity = 'did:entity-storage:0x1234abcd';
|
|
127
|
+
|
|
128
|
+
await profileConnector.create(
|
|
129
|
+
identity,
|
|
130
|
+
{
|
|
131
|
+
displayName: 'Alice',
|
|
132
|
+
region: 'Manchester'
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
email: 'alice@example.org'
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
const profile = await profileConnector.get(identity, ['displayName'], ['email']);
|
|
140
|
+
|
|
141
|
+
await profileConnector.update(
|
|
142
|
+
identity,
|
|
143
|
+
{
|
|
144
|
+
displayName: 'Alice Doe',
|
|
145
|
+
region: 'Manchester'
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
email: 'alice.doe@example.org'
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
const profileList = await profileConnector.list(
|
|
153
|
+
[
|
|
154
|
+
{
|
|
155
|
+
propertyName: 'displayName',
|
|
156
|
+
propertyValue: 'Alice Doe'
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
undefined,
|
|
160
|
+
['displayName'],
|
|
161
|
+
['email'],
|
|
162
|
+
undefined,
|
|
163
|
+
10
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
await profileConnector.remove(identity);
|
|
167
|
+
|
|
168
|
+
console.log(className); // EntityStorageIdentityProfileConnector
|
|
169
|
+
console.log(profile.publicProfile.displayName); // Alice
|
|
170
|
+
console.log(profileList.items.length); // 1
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## EntityStorageIdentityResolverConnector
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
import { EntityStorageIdentityResolverConnector } from '@twin.org/identity-connector-entity-storage';
|
|
177
|
+
|
|
178
|
+
const resolverConnector = new EntityStorageIdentityResolverConnector({
|
|
179
|
+
didDocumentEntityStorageType: 'identity-document',
|
|
180
|
+
vaultConnectorType: 'vault'
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
const className = resolverConnector.className();
|
|
184
|
+
const didDocument = await resolverConnector.resolveDocument('did:entity-storage:0x1234abcd');
|
|
185
|
+
|
|
186
|
+
console.log(className); // EntityStorageIdentityResolverConnector
|
|
187
|
+
console.log(didDocument.id); // did:entity-storage:0x1234abcd
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## IdentityDocument
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
import { IdentityDocument } from '@twin.org/identity-connector-entity-storage';
|
|
194
|
+
|
|
195
|
+
const identityDocument = new IdentityDocument();
|
|
196
|
+
identityDocument.id = 'did:entity-storage:0x1234abcd';
|
|
197
|
+
identityDocument.document = {
|
|
198
|
+
id: 'did:entity-storage:0x1234abcd'
|
|
199
|
+
};
|
|
200
|
+
identityDocument.signature = 'MEYCIQCyExampleSignature';
|
|
201
|
+
identityDocument.controller = 'controller-1';
|
|
202
|
+
|
|
203
|
+
console.log(identityDocument.id); // did:entity-storage:0x1234abcd
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## IdentityProfile
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
import { IdentityProfile } from '@twin.org/identity-connector-entity-storage';
|
|
210
|
+
|
|
211
|
+
const identityProfile = new IdentityProfile();
|
|
212
|
+
identityProfile.identity = 'did:entity-storage:0x1234abcd';
|
|
213
|
+
identityProfile.publicProfile = {
|
|
214
|
+
displayName: 'Alice'
|
|
215
|
+
};
|
|
216
|
+
identityProfile.privateProfile = {
|
|
217
|
+
email: 'alice@example.org'
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
console.log(identityProfile.identity); // did:entity-storage:0x1234abcd
|
|
221
|
+
```
|
|
@@ -28,7 +28,7 @@ The options for the identity connector.
|
|
|
28
28
|
|
|
29
29
|
## Properties
|
|
30
30
|
|
|
31
|
-
### CLASS\_NAME
|
|
31
|
+
### CLASS\_NAME {#class_name}
|
|
32
32
|
|
|
33
33
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ Runtime name for the class.
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### NAMESPACE
|
|
39
|
+
### NAMESPACE {#namespace}
|
|
40
40
|
|
|
41
41
|
> `readonly` `static` **NAMESPACE**: `string` = `"entity-storage"`
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ The namespace supported by the identity connector.
|
|
|
44
44
|
|
|
45
45
|
## Methods
|
|
46
46
|
|
|
47
|
-
### className()
|
|
47
|
+
### className() {#classname}
|
|
48
48
|
|
|
49
49
|
> **className**(): `string`
|
|
50
50
|
|
|
@@ -62,7 +62,7 @@ The class name of the component.
|
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
### createDocument()
|
|
65
|
+
### createDocument() {#createdocument}
|
|
66
66
|
|
|
67
67
|
> **createDocument**(`controller`): `Promise`\<`IDidDocument`\>
|
|
68
68
|
|
|
@@ -88,7 +88,7 @@ The created document.
|
|
|
88
88
|
|
|
89
89
|
***
|
|
90
90
|
|
|
91
|
-
### removeDocument()
|
|
91
|
+
### removeDocument() {#removedocument}
|
|
92
92
|
|
|
93
93
|
> **removeDocument**(`controller`, `documentId`): `Promise`\<`void`\>
|
|
94
94
|
|
|
@@ -120,7 +120,7 @@ Nothing.
|
|
|
120
120
|
|
|
121
121
|
***
|
|
122
122
|
|
|
123
|
-
### addVerificationMethod()
|
|
123
|
+
### addVerificationMethod() {#addverificationmethod}
|
|
124
124
|
|
|
125
125
|
> **addVerificationMethod**(`controller`, `documentId`, `verificationMethodType`, `verificationMethodId?`): `Promise`\<`IDidDocumentVerificationMethod`\>
|
|
126
126
|
|
|
@@ -172,7 +172,7 @@ NotSupportedError if the platform does not support multiple keys.
|
|
|
172
172
|
|
|
173
173
|
***
|
|
174
174
|
|
|
175
|
-
### removeVerificationMethod()
|
|
175
|
+
### removeVerificationMethod() {#removeverificationmethod}
|
|
176
176
|
|
|
177
177
|
> **removeVerificationMethod**(`controller`, `verificationMethodId`): `Promise`\<`void`\>
|
|
178
178
|
|
|
@@ -212,7 +212,7 @@ NotSupportedError if the platform does not support multiple revocable keys.
|
|
|
212
212
|
|
|
213
213
|
***
|
|
214
214
|
|
|
215
|
-
### addService()
|
|
215
|
+
### addService() {#addservice}
|
|
216
216
|
|
|
217
217
|
> **addService**(`controller`, `documentId`, `serviceId`, `serviceType`, `serviceEndpoint`): `Promise`\<`IDidService`\>
|
|
218
218
|
|
|
@@ -240,15 +240,15 @@ The id of the service.
|
|
|
240
240
|
|
|
241
241
|
##### serviceType
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
`string` \| `string`[]
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
The type of the service.
|
|
246
246
|
|
|
247
247
|
##### serviceEndpoint
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
`string` \| `string`[]
|
|
250
250
|
|
|
251
|
-
|
|
251
|
+
The endpoint for the service.
|
|
252
252
|
|
|
253
253
|
#### Returns
|
|
254
254
|
|
|
@@ -266,7 +266,7 @@ NotFoundError if the id can not be resolved.
|
|
|
266
266
|
|
|
267
267
|
***
|
|
268
268
|
|
|
269
|
-
### removeService()
|
|
269
|
+
### removeService() {#removeservice}
|
|
270
270
|
|
|
271
271
|
> **removeService**(`controller`, `serviceId`): `Promise`\<`void`\>
|
|
272
272
|
|
|
@@ -302,7 +302,101 @@ NotFoundError if the id can not be resolved.
|
|
|
302
302
|
|
|
303
303
|
***
|
|
304
304
|
|
|
305
|
-
###
|
|
305
|
+
### addAlsoKnownAs() {#addalsoknownas}
|
|
306
|
+
|
|
307
|
+
> **addAlsoKnownAs**(`controller`, `documentId`, `alias`): `Promise`\<`void`\>
|
|
308
|
+
|
|
309
|
+
Add an alias to the alsoKnownAs property on the document.
|
|
310
|
+
If the alias is already present the operation is a no-op.
|
|
311
|
+
|
|
312
|
+
#### Parameters
|
|
313
|
+
|
|
314
|
+
##### controller
|
|
315
|
+
|
|
316
|
+
`string`
|
|
317
|
+
|
|
318
|
+
The controller of the identity who can make changes.
|
|
319
|
+
|
|
320
|
+
##### documentId
|
|
321
|
+
|
|
322
|
+
`string`
|
|
323
|
+
|
|
324
|
+
The id of the document to update.
|
|
325
|
+
|
|
326
|
+
##### alias
|
|
327
|
+
|
|
328
|
+
`string`
|
|
329
|
+
|
|
330
|
+
The alias to add. Must be a Url or Urn (typically another DID).
|
|
331
|
+
|
|
332
|
+
#### Returns
|
|
333
|
+
|
|
334
|
+
`Promise`\<`void`\>
|
|
335
|
+
|
|
336
|
+
Nothing.
|
|
337
|
+
|
|
338
|
+
#### Throws
|
|
339
|
+
|
|
340
|
+
GeneralError if the alias is not a Url or Urn.
|
|
341
|
+
|
|
342
|
+
#### Throws
|
|
343
|
+
|
|
344
|
+
NotFoundError if the id can not be resolved.
|
|
345
|
+
|
|
346
|
+
#### Implementation of
|
|
347
|
+
|
|
348
|
+
`IIdentityConnector.addAlsoKnownAs`
|
|
349
|
+
|
|
350
|
+
***
|
|
351
|
+
|
|
352
|
+
### removeAlsoKnownAs() {#removealsoknownas}
|
|
353
|
+
|
|
354
|
+
> **removeAlsoKnownAs**(`controller`, `documentId`, `alias`): `Promise`\<`void`\>
|
|
355
|
+
|
|
356
|
+
Remove an alias from the alsoKnownAs property on the document.
|
|
357
|
+
If the alias is not present the operation is a no-op.
|
|
358
|
+
|
|
359
|
+
#### Parameters
|
|
360
|
+
|
|
361
|
+
##### controller
|
|
362
|
+
|
|
363
|
+
`string`
|
|
364
|
+
|
|
365
|
+
The controller of the identity who can make changes.
|
|
366
|
+
|
|
367
|
+
##### documentId
|
|
368
|
+
|
|
369
|
+
`string`
|
|
370
|
+
|
|
371
|
+
The id of the document to update.
|
|
372
|
+
|
|
373
|
+
##### alias
|
|
374
|
+
|
|
375
|
+
`string`
|
|
376
|
+
|
|
377
|
+
The alias to remove. Must be a Url or Urn.
|
|
378
|
+
|
|
379
|
+
#### Returns
|
|
380
|
+
|
|
381
|
+
`Promise`\<`void`\>
|
|
382
|
+
|
|
383
|
+
Nothing.
|
|
384
|
+
|
|
385
|
+
#### Throws
|
|
386
|
+
|
|
387
|
+
GeneralError if the alias is not a Url or Urn.
|
|
388
|
+
|
|
389
|
+
#### Throws
|
|
390
|
+
|
|
391
|
+
NotFoundError if the id can not be resolved.
|
|
392
|
+
|
|
393
|
+
#### Implementation of
|
|
394
|
+
|
|
395
|
+
`IIdentityConnector.removeAlsoKnownAs`
|
|
396
|
+
|
|
397
|
+
***
|
|
398
|
+
|
|
399
|
+
### createVerifiableCredential() {#createverifiablecredential}
|
|
306
400
|
|
|
307
401
|
> **createVerifiableCredential**(`controller`, `verificationMethodId`, `id`, `subject`, `options?`): `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredentialV1`; `jwt`: `string`; \}\>
|
|
308
402
|
|
|
@@ -324,9 +418,9 @@ The verification method id to use.
|
|
|
324
418
|
|
|
325
419
|
##### id
|
|
326
420
|
|
|
327
|
-
|
|
421
|
+
`string` \| `undefined`
|
|
328
422
|
|
|
329
|
-
|
|
423
|
+
The id of the credential.
|
|
330
424
|
|
|
331
425
|
##### subject
|
|
332
426
|
|
|
@@ -366,23 +460,23 @@ NotFoundError if the id can not be resolved.
|
|
|
366
460
|
|
|
367
461
|
***
|
|
368
462
|
|
|
369
|
-
### checkVerifiableCredential()
|
|
463
|
+
### checkVerifiableCredential() {#checkverifiablecredential}
|
|
370
464
|
|
|
371
|
-
> **checkVerifiableCredential**(`
|
|
465
|
+
> **checkVerifiableCredential**(`credential`): `Promise`\<\{ `revoked`: `boolean`; `verifiableCredential?`: `IDidVerifiableCredential`; \}\>
|
|
372
466
|
|
|
373
467
|
Check a verifiable credential is valid.
|
|
374
468
|
|
|
375
469
|
#### Parameters
|
|
376
470
|
|
|
377
|
-
#####
|
|
471
|
+
##### credential
|
|
378
472
|
|
|
379
|
-
`string`
|
|
473
|
+
`string` \| `IDidVerifiableCredential`
|
|
380
474
|
|
|
381
475
|
The credential to verify.
|
|
382
476
|
|
|
383
477
|
#### Returns
|
|
384
478
|
|
|
385
|
-
`Promise`\<\{ `revoked`: `boolean`; `verifiableCredential?`: `
|
|
479
|
+
`Promise`\<\{ `revoked`: `boolean`; `verifiableCredential?`: `IDidVerifiableCredential`; \}\>
|
|
386
480
|
|
|
387
481
|
The credential stored in the jwt and the revocation status.
|
|
388
482
|
|
|
@@ -392,7 +486,7 @@ The credential stored in the jwt and the revocation status.
|
|
|
392
486
|
|
|
393
487
|
***
|
|
394
488
|
|
|
395
|
-
### revokeVerifiableCredentials()
|
|
489
|
+
### revokeVerifiableCredentials() {#revokeverifiablecredentials}
|
|
396
490
|
|
|
397
491
|
> **revokeVerifiableCredentials**(`controller`, `issuerDocumentId`, `credentialIndices`): `Promise`\<`void`\>
|
|
398
492
|
|
|
@@ -430,7 +524,7 @@ Nothing.
|
|
|
430
524
|
|
|
431
525
|
***
|
|
432
526
|
|
|
433
|
-
### unrevokeVerifiableCredentials()
|
|
527
|
+
### unrevokeVerifiableCredentials() {#unrevokeverifiablecredentials}
|
|
434
528
|
|
|
435
529
|
> **unrevokeVerifiableCredentials**(`controller`, `issuerDocumentId`, `credentialIndices`): `Promise`\<`void`\>
|
|
436
530
|
|
|
@@ -468,9 +562,9 @@ Nothing.
|
|
|
468
562
|
|
|
469
563
|
***
|
|
470
564
|
|
|
471
|
-
### createVerifiablePresentation()
|
|
565
|
+
### createVerifiablePresentation() {#createverifiablepresentation}
|
|
472
566
|
|
|
473
|
-
> **createVerifiablePresentation**(`controller`, `verificationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `
|
|
567
|
+
> **createVerifiablePresentation**(`controller`, `verificationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `options?`): `Promise`\<\{ `verifiablePresentation`: `IDidVerifiablePresentationV1`; `jwt`: `string`; \}\>
|
|
474
568
|
|
|
475
569
|
Create a verifiable presentation from the supplied verifiable credentials.
|
|
476
570
|
|
|
@@ -490,21 +584,21 @@ The method to associate with the presentation.
|
|
|
490
584
|
|
|
491
585
|
##### presentationId
|
|
492
586
|
|
|
493
|
-
|
|
587
|
+
`string` \| `undefined`
|
|
494
588
|
|
|
495
|
-
|
|
589
|
+
The id of the presentation.
|
|
496
590
|
|
|
497
591
|
##### contexts
|
|
498
592
|
|
|
499
|
-
|
|
593
|
+
`IJsonLdContextDefinitionRoot` \| `undefined`
|
|
500
594
|
|
|
501
|
-
|
|
595
|
+
The contexts for the data stored in the verifiable credential.
|
|
502
596
|
|
|
503
597
|
##### types
|
|
504
598
|
|
|
505
|
-
|
|
599
|
+
`string` \| `string`[] \| `undefined`
|
|
506
600
|
|
|
507
|
-
|
|
601
|
+
The types for the data stored in the verifiable credential.
|
|
508
602
|
|
|
509
603
|
##### verifiableCredentials
|
|
510
604
|
|
|
@@ -512,11 +606,15 @@ The types for the data stored in the verifiable credential.
|
|
|
512
606
|
|
|
513
607
|
The credentials to use for creating the presentation in jwt format.
|
|
514
608
|
|
|
515
|
-
#####
|
|
609
|
+
##### options?
|
|
516
610
|
|
|
517
|
-
|
|
611
|
+
Additional options for creating the verifiable presentation.
|
|
612
|
+
|
|
613
|
+
###### expirationDate?
|
|
518
614
|
|
|
519
|
-
|
|
615
|
+
`Date`
|
|
616
|
+
|
|
617
|
+
The date the verifiable presentation is valid until.
|
|
520
618
|
|
|
521
619
|
#### Returns
|
|
522
620
|
|
|
@@ -534,17 +632,17 @@ NotFoundError if the id can not be resolved.
|
|
|
534
632
|
|
|
535
633
|
***
|
|
536
634
|
|
|
537
|
-
### checkVerifiablePresentation()
|
|
635
|
+
### checkVerifiablePresentation() {#checkverifiablepresentation}
|
|
538
636
|
|
|
539
|
-
> **checkVerifiablePresentation**(`
|
|
637
|
+
> **checkVerifiablePresentation**(`presentation`): `Promise`\<\{ `revoked`: `boolean`; `verifiablePresentation?`: `IDidVerifiablePresentationV1`; `issuers?`: `IDidDocument`[]; \}\>
|
|
540
638
|
|
|
541
639
|
Check a verifiable presentation is valid.
|
|
542
640
|
|
|
543
641
|
#### Parameters
|
|
544
642
|
|
|
545
|
-
#####
|
|
643
|
+
##### presentation
|
|
546
644
|
|
|
547
|
-
`string`
|
|
645
|
+
`string` \| `IDidVerifiablePresentation`
|
|
548
646
|
|
|
549
647
|
The presentation to verify.
|
|
550
648
|
|
|
@@ -560,11 +658,13 @@ The presentation stored in the jwt and the revocation status.
|
|
|
560
658
|
|
|
561
659
|
***
|
|
562
660
|
|
|
563
|
-
### createProof()
|
|
661
|
+
### createProof() {#createproof}
|
|
564
662
|
|
|
565
663
|
> **createProof**(`controller`, `verificationMethodId`, `proofType`, `unsecureDocument`): `Promise`\<`IProof`\>
|
|
566
664
|
|
|
567
665
|
Create a proof for arbitrary data with the specified verification method.
|
|
666
|
+
This method uses async signing to ensure the private key never leaves the vault,
|
|
667
|
+
with algorithm validation to ensure key type compatibility.
|
|
568
668
|
|
|
569
669
|
#### Parameters
|
|
570
670
|
|
|
@@ -598,13 +698,21 @@ The unsecure document to create the proof for.
|
|
|
598
698
|
|
|
599
699
|
The proof.
|
|
600
700
|
|
|
701
|
+
#### Throws
|
|
702
|
+
|
|
703
|
+
NotFoundError if the identity or method is not found.
|
|
704
|
+
|
|
705
|
+
#### Throws
|
|
706
|
+
|
|
707
|
+
GeneralError if algorithm doesn't match key type or proof creation fails.
|
|
708
|
+
|
|
601
709
|
#### Implementation of
|
|
602
710
|
|
|
603
711
|
`IIdentityConnector.createProof`
|
|
604
712
|
|
|
605
713
|
***
|
|
606
714
|
|
|
607
|
-
### verifyProof()
|
|
715
|
+
### verifyProof() {#verifyproof}
|
|
608
716
|
|
|
609
717
|
> **verifyProof**(`document`, `proof`): `Promise`\<`boolean`\>
|
|
610
718
|
|
|
@@ -38,7 +38,7 @@ The options for the identity service.
|
|
|
38
38
|
|
|
39
39
|
## Properties
|
|
40
40
|
|
|
41
|
-
### NAMESPACE
|
|
41
|
+
### NAMESPACE {#namespace}
|
|
42
42
|
|
|
43
43
|
> `readonly` `static` **NAMESPACE**: `string` = `"entity-storage"`
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ The namespace supported by the identity profile connector.
|
|
|
46
46
|
|
|
47
47
|
***
|
|
48
48
|
|
|
49
|
-
### CLASS\_NAME
|
|
49
|
+
### CLASS\_NAME {#class_name}
|
|
50
50
|
|
|
51
51
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ Runtime name for the class.
|
|
|
54
54
|
|
|
55
55
|
## Methods
|
|
56
56
|
|
|
57
|
-
### className()
|
|
57
|
+
### className() {#classname}
|
|
58
58
|
|
|
59
59
|
> **className**(): `string`
|
|
60
60
|
|
|
@@ -72,7 +72,7 @@ The class name of the component.
|
|
|
72
72
|
|
|
73
73
|
***
|
|
74
74
|
|
|
75
|
-
### create()
|
|
75
|
+
### create() {#create}
|
|
76
76
|
|
|
77
77
|
> **create**(`identity`, `publicProfile?`, `privateProfile?`): `Promise`\<`void`\>
|
|
78
78
|
|
|
@@ -110,7 +110,7 @@ Nothing.
|
|
|
110
110
|
|
|
111
111
|
***
|
|
112
112
|
|
|
113
|
-
### get()
|
|
113
|
+
### get() {#get}
|
|
114
114
|
|
|
115
115
|
> **get**(`identity`, `publicPropertyNames?`, `privatePropertyNames?`): `Promise`\<\{ `publicProfile`: `Partial`\<`T`\>; `privateProfile`: `Partial`\<`U`\>; \}\>
|
|
116
116
|
|
|
@@ -148,7 +148,7 @@ The items properties.
|
|
|
148
148
|
|
|
149
149
|
***
|
|
150
150
|
|
|
151
|
-
### update()
|
|
151
|
+
### update() {#update}
|
|
152
152
|
|
|
153
153
|
> **update**(`identity`, `publicProfile?`, `privateProfile?`): `Promise`\<`void`\>
|
|
154
154
|
|
|
@@ -186,7 +186,7 @@ Nothing.
|
|
|
186
186
|
|
|
187
187
|
***
|
|
188
188
|
|
|
189
|
-
### remove()
|
|
189
|
+
### remove() {#remove}
|
|
190
190
|
|
|
191
191
|
> **remove**(`identity`): `Promise`\<`void`\>
|
|
192
192
|
|
|
@@ -212,7 +212,7 @@ Nothing.
|
|
|
212
212
|
|
|
213
213
|
***
|
|
214
214
|
|
|
215
|
-
### list()
|
|
215
|
+
### list() {#list}
|
|
216
216
|
|
|
217
217
|
> **list**(`publicFilters?`, `privateFilters?`, `publicPropertyNames?`, `privatePropertyNames?`, `cursor?`, `limit?`): `Promise`\<\{ `items`: `object`[]; `cursor?`: `string`; \}\>
|
|
218
218
|
|
|
@@ -28,7 +28,7 @@ The options for the identity connector.
|
|
|
28
28
|
|
|
29
29
|
## Properties
|
|
30
30
|
|
|
31
|
-
### NAMESPACE
|
|
31
|
+
### NAMESPACE {#namespace}
|
|
32
32
|
|
|
33
33
|
> `readonly` `static` **NAMESPACE**: `string` = `"entity-storage"`
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ The namespace supported by the identity connector.
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### CLASS\_NAME
|
|
39
|
+
### CLASS\_NAME {#class_name}
|
|
40
40
|
|
|
41
41
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ Runtime name for the class.
|
|
|
44
44
|
|
|
45
45
|
## Methods
|
|
46
46
|
|
|
47
|
-
### className()
|
|
47
|
+
### className() {#classname}
|
|
48
48
|
|
|
49
49
|
> **className**(): `string`
|
|
50
50
|
|
|
@@ -62,7 +62,7 @@ The class name of the component.
|
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
### resolveDocument()
|
|
65
|
+
### resolveDocument() {#resolvedocument}
|
|
66
66
|
|
|
67
67
|
> **resolveDocument**(`documentId`): `Promise`\<`IDidDocument`\>
|
|
68
68
|
|