@twin.org/identity-models 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 +3 -3
- package/dist/es/contextIdHandlers/didContextIdHandler.js +7 -0
- package/dist/es/contextIdHandlers/didContextIdHandler.js.map +1 -1
- package/dist/es/index.js +4 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IIdentityComponent.js.map +1 -1
- package/dist/es/models/IIdentityConnector.js.map +1 -1
- package/dist/es/models/api/identity/IIdentityAlsoKnownAsCreateRequest.js +4 -0
- package/dist/es/models/api/identity/IIdentityAlsoKnownAsCreateRequest.js.map +1 -0
- package/dist/es/models/api/identity/IIdentityAlsoKnownAsRemoveRequest.js +4 -0
- package/dist/es/models/api/identity/IIdentityAlsoKnownAsRemoveRequest.js.map +1 -0
- package/dist/es/models/api/identity/IIdentityVerifiableCredentialRevokeRequest.js.map +1 -1
- package/dist/es/models/api/identity/IIdentityVerifiableCredentialUnrevokeRequest.js.map +1 -1
- package/dist/es/models/api/identity/IIdentityVerifiableCredentialVerifyDocumentRequest.js +2 -0
- package/dist/es/models/api/identity/IIdentityVerifiableCredentialVerifyDocumentRequest.js.map +1 -0
- package/dist/es/models/api/identity/IIdentityVerifiablePresentationCreateRequest.js.map +1 -1
- package/dist/es/models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.js +2 -0
- package/dist/es/models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.js.map +1 -0
- package/dist/types/contextIdHandlers/didContextIdHandler.d.ts +5 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/models/IIdentityComponent.d.ts +31 -6
- package/dist/types/models/IIdentityConnector.d.ts +31 -6
- package/dist/types/models/api/identity/IIdentityAlsoKnownAsCreateRequest.d.ts +23 -0
- package/dist/types/models/api/identity/IIdentityAlsoKnownAsRemoveRequest.d.ts +18 -0
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialRevokeRequest.d.ts +1 -1
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialUnrevokeRequest.d.ts +1 -1
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialVerifyDocumentRequest.d.ts +10 -0
- package/dist/types/models/api/identity/IIdentityVerifiablePresentationCreateRequest.d.ts +2 -2
- package/dist/types/models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.d.ts +10 -0
- package/docs/changelog.md +247 -75
- package/docs/examples.md +157 -1
- package/docs/reference/classes/Did.md +4 -4
- package/docs/reference/classes/DidContextIdHandler.md +21 -3
- package/docs/reference/classes/DocumentHelper.md +5 -5
- package/docs/reference/classes/VerificationHelper.md +3 -3
- package/docs/reference/index.md +4 -0
- package/docs/reference/interfaces/IIdentityAlsoKnownAsCreateRequest.md +31 -0
- package/docs/reference/interfaces/IIdentityAlsoKnownAsRemoveRequest.md +23 -0
- package/docs/reference/interfaces/IIdentityComponent.md +126 -36
- package/docs/reference/interfaces/IIdentityConnector.md +126 -36
- package/docs/reference/interfaces/IIdentityCreateRequest.md +3 -3
- package/docs/reference/interfaces/IIdentityCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityProfileComponent.md +6 -6
- package/docs/reference/interfaces/IIdentityProfileConnector.md +5 -5
- package/docs/reference/interfaces/IIdentityProfileCreateRequest.md +3 -3
- package/docs/reference/interfaces/IIdentityProfileGetPublicRequest.md +4 -4
- package/docs/reference/interfaces/IIdentityProfileGetPublicResponse.md +2 -2
- package/docs/reference/interfaces/IIdentityProfileGetRequest.md +4 -4
- package/docs/reference/interfaces/IIdentityProfileGetResponse.md +3 -3
- package/docs/reference/interfaces/IIdentityProfileListRequest.md +6 -6
- package/docs/reference/interfaces/IIdentityProfileListResponse.md +2 -2
- package/docs/reference/interfaces/IIdentityProfileUpdateRequest.md +3 -3
- package/docs/reference/interfaces/IIdentityProofCreateRequest.md +2 -2
- package/docs/reference/interfaces/IIdentityProofCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityProofVerifyRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityProofVerifyResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityRemoveRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityResolveRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityResolveResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityResolverComponent.md +1 -1
- package/docs/reference/interfaces/IIdentityResolverConnector.md +1 -1
- package/docs/reference/interfaces/IIdentityServiceCreateRequest.md +2 -2
- package/docs/reference/interfaces/IIdentityServiceCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityServiceRemoveRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiableCredentialCreateRequest.md +5 -5
- package/docs/reference/interfaces/IIdentityVerifiableCredentialCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiableCredentialRevokeRequest.md +2 -2
- package/docs/reference/interfaces/IIdentityVerifiableCredentialUnrevokeRequest.md +2 -2
- package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyDocumentRequest.md +11 -0
- package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyResponse.md +2 -2
- package/docs/reference/interfaces/IIdentityVerifiablePresentationCreateRequest.md +8 -8
- package/docs/reference/interfaces/IIdentityVerifiablePresentationCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyDocumentRequest.md +11 -0
- package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyResponse.md +3 -3
- package/docs/reference/interfaces/IIdentityVerificationMethodCreateRequest.md +3 -3
- package/docs/reference/interfaces/IIdentityVerificationMethodCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityVerificationMethodRemoveRequest.md +1 -1
- package/package.json +4 -4
package/docs/examples.md
CHANGED
|
@@ -1 +1,157 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Identity Models Examples
|
|
2
|
+
|
|
3
|
+
These examples focus on building and validating DID identifiers, extracting data from DID documents, and verifying signed materials.
|
|
4
|
+
|
|
5
|
+
## DocumentHelper
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { DocumentHelper } from '@twin.org/identity-models';
|
|
9
|
+
|
|
10
|
+
const parsed = DocumentHelper.parseId('did:iota:tst:0x1234abcd#key-1');
|
|
11
|
+
|
|
12
|
+
console.log(parsed.id); // did:iota:tst:0x1234abcd
|
|
13
|
+
console.log(parsed.fragment); // key-1
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { DocumentHelper } from '@twin.org/identity-models';
|
|
18
|
+
import { DidVerificationMethodType, type IDidDocument } from '@twin.org/standards-w3c-did';
|
|
19
|
+
|
|
20
|
+
const didDocument: IDidDocument = {
|
|
21
|
+
id: 'did:iota:tst:0x1234abcd',
|
|
22
|
+
verificationMethod: [
|
|
23
|
+
{
|
|
24
|
+
id: 'did:iota:tst:0x1234abcd#key-1',
|
|
25
|
+
controller: 'did:iota:tst:0x1234abcd',
|
|
26
|
+
type: 'JsonWebKey',
|
|
27
|
+
publicKeyJwk: {
|
|
28
|
+
kty: 'OKP',
|
|
29
|
+
crv: 'Ed25519',
|
|
30
|
+
x: 'S4e4WQ9Hj1et0eS2e0_ExampleBase64Url'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const fullVerificationMethodId = DocumentHelper.joinId(didDocument.id, 'key-1');
|
|
37
|
+
const verificationMethod = DocumentHelper.getVerificationMethod(
|
|
38
|
+
didDocument,
|
|
39
|
+
fullVerificationMethodId,
|
|
40
|
+
DidVerificationMethodType.VerificationMethod
|
|
41
|
+
);
|
|
42
|
+
const publicJwk = DocumentHelper.getJwk(
|
|
43
|
+
didDocument,
|
|
44
|
+
fullVerificationMethodId,
|
|
45
|
+
DidVerificationMethodType.VerificationMethod
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
console.log(verificationMethod.id); // did:iota:tst:0x1234abcd#key-1
|
|
49
|
+
console.log(publicJwk.crv); // Ed25519
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## DidContextIdHandler
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { DidContextIdHandler } from '@twin.org/identity-models';
|
|
56
|
+
|
|
57
|
+
const contextIdHandler = new DidContextIdHandler();
|
|
58
|
+
|
|
59
|
+
const className = contextIdHandler.className();
|
|
60
|
+
const shortened = contextIdHandler.short('did:iota:tst:0x8f2f0d7a5c4b3a2f1e0d9c8b7a6f5e4d');
|
|
61
|
+
contextIdHandler.guard('did:iota:tst:0x8f2f0d7a5c4b3a2f1e0d9c8b7a6f5e4d');
|
|
62
|
+
|
|
63
|
+
console.log(className); // DidContextIdHandler
|
|
64
|
+
console.log(shortened); // jy8NelxLOi8eDZyLem9eTQ
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Did
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { Did } from '@twin.org/identity-models';
|
|
71
|
+
|
|
72
|
+
const parsedDid = Did.parse('did:iota:tst:0x1234abcd');
|
|
73
|
+
Did.guard('ExampleWorkflow', 'issuerDid', 'did:iota:tst:0x1234abcd');
|
|
74
|
+
|
|
75
|
+
console.log(parsedDid.method); // iota
|
|
76
|
+
console.log(parsedDid.network); // tst
|
|
77
|
+
console.log(parsedDid.id); // 0x1234abcd
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## VerificationHelper
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { VerificationHelper, type IIdentityResolverComponent } from '@twin.org/identity-models';
|
|
84
|
+
|
|
85
|
+
const resolver: IIdentityResolverComponent = {
|
|
86
|
+
className: () => 'IdentityResolverService',
|
|
87
|
+
identityResolve: async (identity: string) => ({
|
|
88
|
+
id: identity,
|
|
89
|
+
verificationMethod: [
|
|
90
|
+
{
|
|
91
|
+
id: `${identity}#signing-key`,
|
|
92
|
+
controller: identity,
|
|
93
|
+
type: 'JsonWebKey',
|
|
94
|
+
publicKeyJwk: {
|
|
95
|
+
kty: 'OKP',
|
|
96
|
+
crv: 'Ed25519',
|
|
97
|
+
x: 'S4e4WQ9Hj1et0eS2e0_ExampleBase64Url'
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
})
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const jwt =
|
|
105
|
+
'eyJraWQiOiJkaWQ6aW90YTp0c3Q6MHgxMjM0YWJjZCNzaWduaW5nLWtleSIsImlzcyI6ImRpZDppb3RhOnRzdDoweDEyMzRhYmNkIiwiYWxnIjoiRWREU0EiLCJ0eXAiOiJKV1QifQ.eyJzdWIiOiJhbGljZSJ9.Q2hhbmdlTWVXaXRoUmVhbFNpZ25hdHVyZQ';
|
|
106
|
+
|
|
107
|
+
const jwtVerification = await VerificationHelper.verifyJwt(resolver, jwt);
|
|
108
|
+
|
|
109
|
+
console.log(typeof jwtVerification.payload.sub); // string
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { VerificationHelper, type IIdentityResolverComponent } from '@twin.org/identity-models';
|
|
114
|
+
import type { IJsonLdNodeObject } from '@twin.org/data-json-ld';
|
|
115
|
+
|
|
116
|
+
const resolver: IIdentityResolverComponent = {
|
|
117
|
+
className: () => 'IdentityResolverService',
|
|
118
|
+
identityResolve: async (identity: string) => ({
|
|
119
|
+
id: identity,
|
|
120
|
+
verificationMethod: [
|
|
121
|
+
{
|
|
122
|
+
id: `${identity}#signing-key`,
|
|
123
|
+
controller: identity,
|
|
124
|
+
type: 'JsonWebKey',
|
|
125
|
+
publicKeyJwk: {
|
|
126
|
+
kty: 'OKP',
|
|
127
|
+
crv: 'Ed25519',
|
|
128
|
+
x: 'S4e4WQ9Hj1et0eS2e0_ExampleBase64Url'
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
})
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const verifiableCredential: IJsonLdNodeObject = {
|
|
136
|
+
'@context': ['https://www.w3.org/2018/credentials/v1'],
|
|
137
|
+
type: ['VerifiableCredential'],
|
|
138
|
+
issuer: 'did:iota:tst:0x1234abcd',
|
|
139
|
+
issuanceDate: '2026-03-10T00:00:00.000Z',
|
|
140
|
+
credentialSubject: {
|
|
141
|
+
id: 'did:iota:tst:0x5678efab',
|
|
142
|
+
role: 'Developer'
|
|
143
|
+
},
|
|
144
|
+
proof: {
|
|
145
|
+
type: 'DataIntegrityProof',
|
|
146
|
+
verificationMethod: 'did:iota:tst:0x1234abcd#signing-key',
|
|
147
|
+
cryptosuite: 'eddsa-jcs-2022',
|
|
148
|
+
created: '2026-03-10T00:00:00.000Z',
|
|
149
|
+
proofPurpose: 'assertionMethod',
|
|
150
|
+
proofValue: 'z4ExampleProofValue'
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const verified = await VerificationHelper.verifyProof(resolver, verifiableCredential);
|
|
155
|
+
|
|
156
|
+
console.log(verified); // true
|
|
157
|
+
```
|
|
@@ -14,7 +14,7 @@ Helper methods for Ids.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### CLASS\_NAME
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
18
|
|
|
19
19
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Runtime name for the class.
|
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
25
|
-
### parse()
|
|
25
|
+
### parse() {#parse}
|
|
26
26
|
|
|
27
27
|
> `static` **parse**(`id`): `object`
|
|
28
28
|
|
|
@@ -48,7 +48,7 @@ The parsed id.
|
|
|
48
48
|
|
|
49
49
|
##### network?
|
|
50
50
|
|
|
51
|
-
> `optional` **network
|
|
51
|
+
> `optional` **network?**: `string`
|
|
52
52
|
|
|
53
53
|
##### id
|
|
54
54
|
|
|
@@ -60,7 +60,7 @@ GeneralError if the id is not valid.
|
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
63
|
-
### guard()
|
|
63
|
+
### guard() {#guard}
|
|
64
64
|
|
|
65
65
|
> `static` **guard**(`source`, `property`, `value`): `asserts value is string`
|
|
66
66
|
|
|
@@ -18,7 +18,7 @@ Context Id handler for testing as a DID.
|
|
|
18
18
|
|
|
19
19
|
## Properties
|
|
20
20
|
|
|
21
|
-
### CLASS\_NAME
|
|
21
|
+
### CLASS\_NAME {#class_name}
|
|
22
22
|
|
|
23
23
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
24
24
|
|
|
@@ -26,7 +26,25 @@ Runtime name for the class.
|
|
|
26
26
|
|
|
27
27
|
## Methods
|
|
28
28
|
|
|
29
|
-
###
|
|
29
|
+
### className() {#classname}
|
|
30
|
+
|
|
31
|
+
> **className**(): `string`
|
|
32
|
+
|
|
33
|
+
The class name of the component.
|
|
34
|
+
|
|
35
|
+
#### Returns
|
|
36
|
+
|
|
37
|
+
`string`
|
|
38
|
+
|
|
39
|
+
The class name.
|
|
40
|
+
|
|
41
|
+
#### Implementation of
|
|
42
|
+
|
|
43
|
+
`IContextIdHandler.className`
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### short() {#short}
|
|
30
48
|
|
|
31
49
|
> **short**(`value`): `string`
|
|
32
50
|
|
|
@@ -52,7 +70,7 @@ Short form string.
|
|
|
52
70
|
|
|
53
71
|
***
|
|
54
72
|
|
|
55
|
-
### guard()
|
|
73
|
+
### guard() {#guard}
|
|
56
74
|
|
|
57
75
|
> **guard**(`value`): `void`
|
|
58
76
|
|
|
@@ -14,7 +14,7 @@ Helper methods for documents.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### CLASS\_NAME
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
18
|
|
|
19
19
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Runtime name for the class.
|
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
25
|
-
### parseId()
|
|
25
|
+
### parseId() {#parseid}
|
|
26
26
|
|
|
27
27
|
> `static` **parseId**(`documentId`): `object`
|
|
28
28
|
|
|
@@ -52,7 +52,7 @@ The parsed document id.
|
|
|
52
52
|
|
|
53
53
|
***
|
|
54
54
|
|
|
55
|
-
### joinId()
|
|
55
|
+
### joinId() {#joinid}
|
|
56
56
|
|
|
57
57
|
> `static` **joinId**(`documentId`, `fragment?`): `string`
|
|
58
58
|
|
|
@@ -80,7 +80,7 @@ The full id.
|
|
|
80
80
|
|
|
81
81
|
***
|
|
82
82
|
|
|
83
|
-
### getVerificationMethod()
|
|
83
|
+
### getVerificationMethod() {#getverificationmethod}
|
|
84
84
|
|
|
85
85
|
> `static` **getVerificationMethod**(`didDocument`, `methodName`, `methodType?`): `IDidDocumentVerificationMethod`
|
|
86
86
|
|
|
@@ -118,7 +118,7 @@ Error if the method is not found.
|
|
|
118
118
|
|
|
119
119
|
***
|
|
120
120
|
|
|
121
|
-
### getJwk()
|
|
121
|
+
### getJwk() {#getjwk}
|
|
122
122
|
|
|
123
123
|
> `static` **getJwk**(`didDocument`, `methodName`, `methodType?`): `JWK`
|
|
124
124
|
|
|
@@ -14,7 +14,7 @@ Helper methods for verification.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### CLASS\_NAME
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
18
|
|
|
19
19
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Runtime name for the class.
|
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
25
|
-
### verifyJwt()
|
|
25
|
+
### verifyJwt() {#verifyjwt}
|
|
26
26
|
|
|
27
27
|
> `static` **verifyJwt**\<`T`, `U`\>(`resolver`, `jwt`): `Promise`\<\{ `header`: `T`; `payload`: `U`; \}\>
|
|
28
28
|
|
|
@@ -60,7 +60,7 @@ The decoded payload.
|
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
63
|
-
### verifyProof()
|
|
63
|
+
### verifyProof() {#verifyproof}
|
|
64
64
|
|
|
65
65
|
> `static` **verifyProof**(`resolver`, `secureDocument`): `Promise`\<`boolean`\>
|
|
66
66
|
|
package/docs/reference/index.md
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
- [IIdentityProfileConnector](interfaces/IIdentityProfileConnector.md)
|
|
16
16
|
- [IIdentityResolverComponent](interfaces/IIdentityResolverComponent.md)
|
|
17
17
|
- [IIdentityResolverConnector](interfaces/IIdentityResolverConnector.md)
|
|
18
|
+
- [IIdentityAlsoKnownAsCreateRequest](interfaces/IIdentityAlsoKnownAsCreateRequest.md)
|
|
19
|
+
- [IIdentityAlsoKnownAsRemoveRequest](interfaces/IIdentityAlsoKnownAsRemoveRequest.md)
|
|
18
20
|
- [IIdentityCreateRequest](interfaces/IIdentityCreateRequest.md)
|
|
19
21
|
- [IIdentityCreateResponse](interfaces/IIdentityCreateResponse.md)
|
|
20
22
|
- [IIdentityProofCreateRequest](interfaces/IIdentityProofCreateRequest.md)
|
|
@@ -29,10 +31,12 @@
|
|
|
29
31
|
- [IIdentityVerifiableCredentialCreateResponse](interfaces/IIdentityVerifiableCredentialCreateResponse.md)
|
|
30
32
|
- [IIdentityVerifiableCredentialRevokeRequest](interfaces/IIdentityVerifiableCredentialRevokeRequest.md)
|
|
31
33
|
- [IIdentityVerifiableCredentialUnrevokeRequest](interfaces/IIdentityVerifiableCredentialUnrevokeRequest.md)
|
|
34
|
+
- [IIdentityVerifiableCredentialVerifyDocumentRequest](interfaces/IIdentityVerifiableCredentialVerifyDocumentRequest.md)
|
|
32
35
|
- [IIdentityVerifiableCredentialVerifyRequest](interfaces/IIdentityVerifiableCredentialVerifyRequest.md)
|
|
33
36
|
- [IIdentityVerifiableCredentialVerifyResponse](interfaces/IIdentityVerifiableCredentialVerifyResponse.md)
|
|
34
37
|
- [IIdentityVerifiablePresentationCreateRequest](interfaces/IIdentityVerifiablePresentationCreateRequest.md)
|
|
35
38
|
- [IIdentityVerifiablePresentationCreateResponse](interfaces/IIdentityVerifiablePresentationCreateResponse.md)
|
|
39
|
+
- [IIdentityVerifiablePresentationVerifyDocumentRequest](interfaces/IIdentityVerifiablePresentationVerifyDocumentRequest.md)
|
|
36
40
|
- [IIdentityVerifiablePresentationVerifyRequest](interfaces/IIdentityVerifiablePresentationVerifyRequest.md)
|
|
37
41
|
- [IIdentityVerifiablePresentationVerifyResponse](interfaces/IIdentityVerifiablePresentationVerifyResponse.md)
|
|
38
42
|
- [IIdentityVerificationMethodCreateRequest](interfaces/IIdentityVerificationMethodCreateRequest.md)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Interface: IIdentityAlsoKnownAsCreateRequest
|
|
2
|
+
|
|
3
|
+
Request to create an alias for an identity.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### pathParams {#pathparams}
|
|
8
|
+
|
|
9
|
+
> **pathParams**: `object`
|
|
10
|
+
|
|
11
|
+
The path parameters.
|
|
12
|
+
|
|
13
|
+
#### identity
|
|
14
|
+
|
|
15
|
+
> **identity**: `string`
|
|
16
|
+
|
|
17
|
+
The identity to create the alias for.
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### body {#body}
|
|
22
|
+
|
|
23
|
+
> **body**: `object`
|
|
24
|
+
|
|
25
|
+
The data for the request.
|
|
26
|
+
|
|
27
|
+
#### alias
|
|
28
|
+
|
|
29
|
+
> **alias**: `string`
|
|
30
|
+
|
|
31
|
+
The alias to create for the identity.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Interface: IIdentityAlsoKnownAsRemoveRequest
|
|
2
|
+
|
|
3
|
+
Request to remove an alias from an identity.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### pathParams {#pathparams}
|
|
8
|
+
|
|
9
|
+
> **pathParams**: `object`
|
|
10
|
+
|
|
11
|
+
The path parameters.
|
|
12
|
+
|
|
13
|
+
#### identity
|
|
14
|
+
|
|
15
|
+
> **identity**: `string`
|
|
16
|
+
|
|
17
|
+
The identity to remove the alias from.
|
|
18
|
+
|
|
19
|
+
#### alias
|
|
20
|
+
|
|
21
|
+
> **alias**: `string`
|
|
22
|
+
|
|
23
|
+
The alias to remove.
|
|
@@ -8,7 +8,7 @@ Interface describing a contract which provides identity operations.
|
|
|
8
8
|
|
|
9
9
|
## Methods
|
|
10
10
|
|
|
11
|
-
### identityCreate()
|
|
11
|
+
### identityCreate() {#identitycreate}
|
|
12
12
|
|
|
13
13
|
> **identityCreate**(`namespace?`, `controller?`): `Promise`\<`IDidDocument`\>
|
|
14
14
|
|
|
@@ -36,7 +36,7 @@ The created identity document.
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### identityRemove()
|
|
39
|
+
### identityRemove() {#identityremove}
|
|
40
40
|
|
|
41
41
|
> **identityRemove**(`identity`, `controller?`): `Promise`\<`void`\>
|
|
42
42
|
|
|
@@ -64,7 +64,7 @@ Nothing.
|
|
|
64
64
|
|
|
65
65
|
***
|
|
66
66
|
|
|
67
|
-
### verificationMethodCreate()
|
|
67
|
+
### verificationMethodCreate() {#verificationmethodcreate}
|
|
68
68
|
|
|
69
69
|
> **verificationMethodCreate**(`identity`, `verificationMethodType`, `verificationMethodId?`, `controller?`): `Promise`\<`IDidDocumentVerificationMethod`\>
|
|
70
70
|
|
|
@@ -112,7 +112,7 @@ NotSupportedError if the platform does not support multiple keys.
|
|
|
112
112
|
|
|
113
113
|
***
|
|
114
114
|
|
|
115
|
-
### verificationMethodRemove()
|
|
115
|
+
### verificationMethodRemove() {#verificationmethodremove}
|
|
116
116
|
|
|
117
117
|
> **verificationMethodRemove**(`verificationMethodId`, `controller?`): `Promise`\<`void`\>
|
|
118
118
|
|
|
@@ -148,7 +148,7 @@ NotSupportedError if the platform does not support multiple revocable keys.
|
|
|
148
148
|
|
|
149
149
|
***
|
|
150
150
|
|
|
151
|
-
### serviceCreate()
|
|
151
|
+
### serviceCreate() {#servicecreate}
|
|
152
152
|
|
|
153
153
|
> **serviceCreate**(`identity`, `serviceId`, `serviceType`, `serviceEndpoint`, `controller?`): `Promise`\<`IDidService`\>
|
|
154
154
|
|
|
@@ -170,15 +170,15 @@ The id of the service.
|
|
|
170
170
|
|
|
171
171
|
##### serviceType
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
`string` \| `string`[]
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
The type of the service.
|
|
176
176
|
|
|
177
177
|
##### serviceEndpoint
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
`string` \| `string`[]
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
The endpoint for the service.
|
|
182
182
|
|
|
183
183
|
##### controller?
|
|
184
184
|
|
|
@@ -198,7 +198,7 @@ NotFoundError if the id can not be resolved.
|
|
|
198
198
|
|
|
199
199
|
***
|
|
200
200
|
|
|
201
|
-
### serviceRemove()
|
|
201
|
+
### serviceRemove() {#serviceremove}
|
|
202
202
|
|
|
203
203
|
> **serviceRemove**(`serviceId`, `controller?`): `Promise`\<`void`\>
|
|
204
204
|
|
|
@@ -230,7 +230,93 @@ NotFoundError if the id can not be resolved.
|
|
|
230
230
|
|
|
231
231
|
***
|
|
232
232
|
|
|
233
|
-
###
|
|
233
|
+
### alsoKnownAsAdd() {#alsoknownasadd}
|
|
234
|
+
|
|
235
|
+
> **alsoKnownAsAdd**(`documentId`, `alias`, `controller?`): `Promise`\<`void`\>
|
|
236
|
+
|
|
237
|
+
Add an alias to the alsoKnownAs property on the document.
|
|
238
|
+
If the alias is already present the operation is a no-op.
|
|
239
|
+
|
|
240
|
+
#### Parameters
|
|
241
|
+
|
|
242
|
+
##### documentId
|
|
243
|
+
|
|
244
|
+
`string`
|
|
245
|
+
|
|
246
|
+
The id of the document to update.
|
|
247
|
+
|
|
248
|
+
##### alias
|
|
249
|
+
|
|
250
|
+
`string`
|
|
251
|
+
|
|
252
|
+
The alias to add. Must be a Url or Urn (typically another DID).
|
|
253
|
+
|
|
254
|
+
##### controller?
|
|
255
|
+
|
|
256
|
+
`string`
|
|
257
|
+
|
|
258
|
+
The controller of the identity who can make changes.
|
|
259
|
+
|
|
260
|
+
#### Returns
|
|
261
|
+
|
|
262
|
+
`Promise`\<`void`\>
|
|
263
|
+
|
|
264
|
+
Nothing.
|
|
265
|
+
|
|
266
|
+
#### Throws
|
|
267
|
+
|
|
268
|
+
GeneralError if the alias is not a Url or Urn.
|
|
269
|
+
|
|
270
|
+
#### Throws
|
|
271
|
+
|
|
272
|
+
NotFoundError if the id can not be resolved.
|
|
273
|
+
|
|
274
|
+
***
|
|
275
|
+
|
|
276
|
+
### alsoKnownAsRemove() {#alsoknownasremove}
|
|
277
|
+
|
|
278
|
+
> **alsoKnownAsRemove**(`documentId`, `alias`, `controller?`): `Promise`\<`void`\>
|
|
279
|
+
|
|
280
|
+
Remove an alias from the alsoKnownAs property on the document.
|
|
281
|
+
If the alias is not present the operation is a no-op.
|
|
282
|
+
|
|
283
|
+
#### Parameters
|
|
284
|
+
|
|
285
|
+
##### documentId
|
|
286
|
+
|
|
287
|
+
`string`
|
|
288
|
+
|
|
289
|
+
The id of the document to update.
|
|
290
|
+
|
|
291
|
+
##### alias
|
|
292
|
+
|
|
293
|
+
`string`
|
|
294
|
+
|
|
295
|
+
The alias to remove. Must be a Url or Urn.
|
|
296
|
+
|
|
297
|
+
##### controller?
|
|
298
|
+
|
|
299
|
+
`string`
|
|
300
|
+
|
|
301
|
+
The controller of the identity who can make changes.
|
|
302
|
+
|
|
303
|
+
#### Returns
|
|
304
|
+
|
|
305
|
+
`Promise`\<`void`\>
|
|
306
|
+
|
|
307
|
+
Nothing.
|
|
308
|
+
|
|
309
|
+
#### Throws
|
|
310
|
+
|
|
311
|
+
GeneralError if the alias is not a Url or Urn.
|
|
312
|
+
|
|
313
|
+
#### Throws
|
|
314
|
+
|
|
315
|
+
NotFoundError if the id can not be resolved.
|
|
316
|
+
|
|
317
|
+
***
|
|
318
|
+
|
|
319
|
+
### verifiableCredentialCreate() {#verifiablecredentialcreate}
|
|
234
320
|
|
|
235
321
|
> **verifiableCredentialCreate**(`verificationMethodId`, `id`, `subject`, `options?`, `controller?`): `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
|
|
236
322
|
|
|
@@ -246,9 +332,9 @@ The verification method id to use.
|
|
|
246
332
|
|
|
247
333
|
##### id
|
|
248
334
|
|
|
249
|
-
|
|
335
|
+
`string` \| `undefined`
|
|
250
336
|
|
|
251
|
-
|
|
337
|
+
The id of the credential.
|
|
252
338
|
|
|
253
339
|
##### subject
|
|
254
340
|
|
|
@@ -290,17 +376,17 @@ NotFoundError if the id can not be resolved.
|
|
|
290
376
|
|
|
291
377
|
***
|
|
292
378
|
|
|
293
|
-
### verifiableCredentialVerify()
|
|
379
|
+
### verifiableCredentialVerify() {#verifiablecredentialverify}
|
|
294
380
|
|
|
295
|
-
> **verifiableCredentialVerify**(`
|
|
381
|
+
> **verifiableCredentialVerify**(`credential`): `Promise`\<\{ `revoked`: `boolean`; `verifiableCredential?`: `IDidVerifiableCredential`; \}\>
|
|
296
382
|
|
|
297
383
|
Verify a verifiable credential is valid.
|
|
298
384
|
|
|
299
385
|
#### Parameters
|
|
300
386
|
|
|
301
|
-
#####
|
|
387
|
+
##### credential
|
|
302
388
|
|
|
303
|
-
`string`
|
|
389
|
+
`string` \| `IDidVerifiableCredential`
|
|
304
390
|
|
|
305
391
|
The credential to verify.
|
|
306
392
|
|
|
@@ -312,7 +398,7 @@ The credential stored in the jwt and the revocation status.
|
|
|
312
398
|
|
|
313
399
|
***
|
|
314
400
|
|
|
315
|
-
### verifiableCredentialRevoke()
|
|
401
|
+
### verifiableCredentialRevoke() {#verifiablecredentialrevoke}
|
|
316
402
|
|
|
317
403
|
> **verifiableCredentialRevoke**(`issuerId`, `credentialIndex`, `controller?`): `Promise`\<`void`\>
|
|
318
404
|
|
|
@@ -346,7 +432,7 @@ Nothing.
|
|
|
346
432
|
|
|
347
433
|
***
|
|
348
434
|
|
|
349
|
-
### verifiableCredentialUnrevoke()
|
|
435
|
+
### verifiableCredentialUnrevoke() {#verifiablecredentialunrevoke}
|
|
350
436
|
|
|
351
437
|
> **verifiableCredentialUnrevoke**(`issuerId`, `credentialIndex`, `controller?`): `Promise`\<`void`\>
|
|
352
438
|
|
|
@@ -380,9 +466,9 @@ Nothing.
|
|
|
380
466
|
|
|
381
467
|
***
|
|
382
468
|
|
|
383
|
-
### verifiablePresentationCreate()
|
|
469
|
+
### verifiablePresentationCreate() {#verifiablepresentationcreate}
|
|
384
470
|
|
|
385
|
-
> **verifiablePresentationCreate**(`verificationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `
|
|
471
|
+
> **verifiablePresentationCreate**(`verificationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `options?`, `controller?`): `Promise`\<\{ `verifiablePresentation`: `IDidVerifiablePresentation`; `jwt`: `string`; \}\>
|
|
386
472
|
|
|
387
473
|
Create a verifiable presentation from the supplied verifiable credentials.
|
|
388
474
|
|
|
@@ -396,21 +482,21 @@ The method to associate with the presentation.
|
|
|
396
482
|
|
|
397
483
|
##### presentationId
|
|
398
484
|
|
|
399
|
-
|
|
485
|
+
`string` \| `undefined`
|
|
400
486
|
|
|
401
|
-
|
|
487
|
+
The id of the presentation.
|
|
402
488
|
|
|
403
489
|
##### contexts
|
|
404
490
|
|
|
405
|
-
|
|
491
|
+
`IJsonLdContextDefinitionRoot` \| `undefined`
|
|
406
492
|
|
|
407
|
-
|
|
493
|
+
The contexts for the data stored in the verifiable credential.
|
|
408
494
|
|
|
409
495
|
##### types
|
|
410
496
|
|
|
411
|
-
|
|
497
|
+
`string` \| `string`[] \| `undefined`
|
|
412
498
|
|
|
413
|
-
|
|
499
|
+
The types for the data stored in the verifiable credential.
|
|
414
500
|
|
|
415
501
|
##### verifiableCredentials
|
|
416
502
|
|
|
@@ -418,11 +504,15 @@ The types for the data stored in the verifiable credential.
|
|
|
418
504
|
|
|
419
505
|
The credentials to use for creating the presentation in jwt format.
|
|
420
506
|
|
|
421
|
-
#####
|
|
507
|
+
##### options?
|
|
422
508
|
|
|
423
|
-
|
|
509
|
+
Additional options for creating the verifiable presentation.
|
|
424
510
|
|
|
425
|
-
|
|
511
|
+
###### expirationDate?
|
|
512
|
+
|
|
513
|
+
`Date`
|
|
514
|
+
|
|
515
|
+
The date the verifiable presentation is valid until.
|
|
426
516
|
|
|
427
517
|
##### controller?
|
|
428
518
|
|
|
@@ -442,17 +532,17 @@ NotFoundError if the id can not be resolved.
|
|
|
442
532
|
|
|
443
533
|
***
|
|
444
534
|
|
|
445
|
-
### verifiablePresentationVerify()
|
|
535
|
+
### verifiablePresentationVerify() {#verifiablepresentationverify}
|
|
446
536
|
|
|
447
|
-
> **verifiablePresentationVerify**(`
|
|
537
|
+
> **verifiablePresentationVerify**(`presentation`): `Promise`\<\{ `revoked`: `boolean`; `verifiablePresentation?`: `IDidVerifiablePresentation`; `issuers?`: `IDidDocument`[]; \}\>
|
|
448
538
|
|
|
449
539
|
Verify a verifiable presentation is valid.
|
|
450
540
|
|
|
451
541
|
#### Parameters
|
|
452
542
|
|
|
453
|
-
#####
|
|
543
|
+
##### presentation
|
|
454
544
|
|
|
455
|
-
`string`
|
|
545
|
+
`string` \| `IDidVerifiablePresentation`
|
|
456
546
|
|
|
457
547
|
The presentation to verify.
|
|
458
548
|
|
|
@@ -464,7 +554,7 @@ The presentation stored in the jwt and the revocation status.
|
|
|
464
554
|
|
|
465
555
|
***
|
|
466
556
|
|
|
467
|
-
### proofCreate()
|
|
557
|
+
### proofCreate() {#proofcreate}
|
|
468
558
|
|
|
469
559
|
> **proofCreate**(`verificationMethodId`, `proofType`, `unsecureDocument`, `controller?`): `Promise`\<`IProof`\>
|
|
470
560
|
|
|
@@ -504,7 +594,7 @@ The proof.
|
|
|
504
594
|
|
|
505
595
|
***
|
|
506
596
|
|
|
507
|
-
### proofVerify()
|
|
597
|
+
### proofVerify() {#proofverify}
|
|
508
598
|
|
|
509
599
|
> **proofVerify**(`document`, `proof`): `Promise`\<`boolean`\>
|
|
510
600
|
|