@twin.org/identity-models 0.0.1 → 0.0.2-next.10
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 +41 -0
- package/dist/esm/index.mjs +42 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/IIdentityComponent.d.ts +7 -2
- package/dist/types/models/IIdentityConnector.d.ts +7 -2
- package/dist/types/models/IIdentityProfileComponent.d.ts +2 -2
- package/dist/types/models/IIdentityProfileConnector.d.ts +2 -2
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialCreateRequest.d.ts +4 -0
- package/dist/types/models/api/profile/IIdentityProfileListRequest.d.ts +1 -1
- package/dist/types/utils/idHelper.d.ts +20 -0
- package/docs/changelog.md +80 -0
- package/docs/reference/classes/IdHelper.md +59 -0
- package/docs/reference/index.md +1 -0
- package/docs/reference/interfaces/IIdentityComponent.md +20 -2
- package/docs/reference/interfaces/IIdentityConnector.md +20 -2
- package/docs/reference/interfaces/IIdentityProfileComponent.md +10 -2
- package/docs/reference/interfaces/IIdentityProfileConnector.md +10 -2
- package/docs/reference/interfaces/IIdentityProfileListRequest.md +2 -2
- package/docs/reference/interfaces/IIdentityResolverComponent.md +8 -0
- package/docs/reference/interfaces/IIdentityResolverConnector.md +8 -0
- package/docs/reference/interfaces/IIdentityVerifiableCredentialCreateRequest.md +6 -0
- package/locales/en.json +3 -7
- package/package.json +26 -8
package/dist/cjs/index.cjs
CHANGED
|
@@ -118,6 +118,46 @@ class DocumentHelper {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
// Copyright 2024 IOTA Stiftung.
|
|
122
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
123
|
+
/**
|
|
124
|
+
* Helper methods for Ids.
|
|
125
|
+
*/
|
|
126
|
+
class IdHelper {
|
|
127
|
+
/**
|
|
128
|
+
* Runtime name for the class.
|
|
129
|
+
*/
|
|
130
|
+
static CLASS_NAME = "IdHelper";
|
|
131
|
+
/**
|
|
132
|
+
* Parse and id in to it's constituent parts.
|
|
133
|
+
* @param id The id to parse.
|
|
134
|
+
* @returns The parsed id.
|
|
135
|
+
* @throws GeneralError if the id is not valid.
|
|
136
|
+
*/
|
|
137
|
+
static parseId(id) {
|
|
138
|
+
core.Urn.guard(IdHelper.CLASS_NAME, "id", id);
|
|
139
|
+
const didUrn = core.Urn.fromValidString(id);
|
|
140
|
+
const didParts = didUrn.parts();
|
|
141
|
+
if (didParts[0] !== "did") {
|
|
142
|
+
throw new core.GeneralError(IdHelper.CLASS_NAME, "invalidDocumentId", { id });
|
|
143
|
+
}
|
|
144
|
+
if (didParts.length === 3) {
|
|
145
|
+
return {
|
|
146
|
+
method: didParts[1],
|
|
147
|
+
id: didParts[2]
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
else if (didParts.length === 4) {
|
|
151
|
+
return {
|
|
152
|
+
method: didParts[1],
|
|
153
|
+
network: didParts[2],
|
|
154
|
+
id: didParts[3]
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
throw new core.GeneralError(IdHelper.CLASS_NAME, "invalidDocumentId", { id });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
121
161
|
// Copyright 2024 IOTA Stiftung.
|
|
122
162
|
// SPDX-License-Identifier: Apache-2.0.
|
|
123
163
|
/**
|
|
@@ -194,6 +234,7 @@ class VerificationHelper {
|
|
|
194
234
|
}
|
|
195
235
|
|
|
196
236
|
exports.DocumentHelper = DocumentHelper;
|
|
237
|
+
exports.IdHelper = IdHelper;
|
|
197
238
|
exports.IdentityConnectorFactory = IdentityConnectorFactory;
|
|
198
239
|
exports.IdentityProfileConnectorFactory = IdentityProfileConnectorFactory;
|
|
199
240
|
exports.IdentityResolverConnectorFactory = IdentityResolverConnectorFactory;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Factory, Is, GeneralError, Guards } from '@twin.org/core';
|
|
1
|
+
import { Factory, Is, GeneralError, Urn, Guards } from '@twin.org/core';
|
|
2
2
|
import { DidVerificationMethodType, ProofHelper } from '@twin.org/standards-w3c-did';
|
|
3
3
|
import { Jwt, Jwk } from '@twin.org/web';
|
|
4
4
|
|
|
@@ -116,6 +116,46 @@ class DocumentHelper {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
// Copyright 2024 IOTA Stiftung.
|
|
120
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
121
|
+
/**
|
|
122
|
+
* Helper methods for Ids.
|
|
123
|
+
*/
|
|
124
|
+
class IdHelper {
|
|
125
|
+
/**
|
|
126
|
+
* Runtime name for the class.
|
|
127
|
+
*/
|
|
128
|
+
static CLASS_NAME = "IdHelper";
|
|
129
|
+
/**
|
|
130
|
+
* Parse and id in to it's constituent parts.
|
|
131
|
+
* @param id The id to parse.
|
|
132
|
+
* @returns The parsed id.
|
|
133
|
+
* @throws GeneralError if the id is not valid.
|
|
134
|
+
*/
|
|
135
|
+
static parseId(id) {
|
|
136
|
+
Urn.guard(IdHelper.CLASS_NAME, "id", id);
|
|
137
|
+
const didUrn = Urn.fromValidString(id);
|
|
138
|
+
const didParts = didUrn.parts();
|
|
139
|
+
if (didParts[0] !== "did") {
|
|
140
|
+
throw new GeneralError(IdHelper.CLASS_NAME, "invalidDocumentId", { id });
|
|
141
|
+
}
|
|
142
|
+
if (didParts.length === 3) {
|
|
143
|
+
return {
|
|
144
|
+
method: didParts[1],
|
|
145
|
+
id: didParts[2]
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
else if (didParts.length === 4) {
|
|
149
|
+
return {
|
|
150
|
+
method: didParts[1],
|
|
151
|
+
network: didParts[2],
|
|
152
|
+
id: didParts[3]
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
throw new GeneralError(IdHelper.CLASS_NAME, "invalidDocumentId", { id });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
119
159
|
// Copyright 2024 IOTA Stiftung.
|
|
120
160
|
// SPDX-License-Identifier: Apache-2.0.
|
|
121
161
|
/**
|
|
@@ -191,4 +231,4 @@ class VerificationHelper {
|
|
|
191
231
|
}
|
|
192
232
|
}
|
|
193
233
|
|
|
194
|
-
export { DocumentHelper, IdentityConnectorFactory, IdentityProfileConnectorFactory, IdentityResolverConnectorFactory, VerificationHelper };
|
|
234
|
+
export { DocumentHelper, IdHelper, IdentityConnectorFactory, IdentityProfileConnectorFactory, IdentityResolverConnectorFactory, VerificationHelper };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -41,4 +41,5 @@ export * from "./models/IIdentityProfileConnector";
|
|
|
41
41
|
export * from "./models/IIdentityResolverComponent";
|
|
42
42
|
export * from "./models/IIdentityResolverConnector";
|
|
43
43
|
export * from "./utils/documentHelper";
|
|
44
|
+
export * from "./utils/idHelper";
|
|
44
45
|
export * from "./utils/verificationHelper";
|
|
@@ -63,12 +63,17 @@ export interface IIdentityComponent extends IComponent {
|
|
|
63
63
|
* @param verificationMethodId The verification method id to use.
|
|
64
64
|
* @param id The id of the credential.
|
|
65
65
|
* @param subject The credential subject to store in the verifiable credential.
|
|
66
|
-
* @param
|
|
66
|
+
* @param options Additional options for creating the verifiable credential.
|
|
67
|
+
* @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
|
|
68
|
+
* @param options.expirationDate The date the verifiable credential is valid until.
|
|
67
69
|
* @param controller The controller of the identity who can make changes.
|
|
68
70
|
* @returns The created verifiable credential and its token.
|
|
69
71
|
* @throws NotFoundError if the id can not be resolved.
|
|
70
72
|
*/
|
|
71
|
-
verifiableCredentialCreate(verificationMethodId: string, id: string | undefined, subject: IJsonLdNodeObject,
|
|
73
|
+
verifiableCredentialCreate(verificationMethodId: string, id: string | undefined, subject: IJsonLdNodeObject, options?: {
|
|
74
|
+
revocationIndex?: number;
|
|
75
|
+
expirationDate?: Date;
|
|
76
|
+
}, controller?: string): Promise<{
|
|
72
77
|
verifiableCredential: IDidVerifiableCredential;
|
|
73
78
|
jwt: string;
|
|
74
79
|
}>;
|
|
@@ -63,11 +63,16 @@ export interface IIdentityConnector extends IComponent {
|
|
|
63
63
|
* @param verificationMethodId The verification method id to use.
|
|
64
64
|
* @param id The id of the credential.
|
|
65
65
|
* @param subject The credential subject to store in the verifiable credential.
|
|
66
|
-
* @param
|
|
66
|
+
* @param options Additional options for creating the verifiable credential.
|
|
67
|
+
* @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
|
|
68
|
+
* @param options.expirationDate The date the verifiable credential is valid until.
|
|
67
69
|
* @returns The created verifiable credential and its token.
|
|
68
70
|
* @throws NotFoundError if the id can not be resolved.
|
|
69
71
|
*/
|
|
70
|
-
createVerifiableCredential(controller: string, verificationMethodId: string, id: string | undefined, subject: IJsonLdNodeObject,
|
|
72
|
+
createVerifiableCredential(controller: string, verificationMethodId: string, id: string | undefined, subject: IJsonLdNodeObject, options?: {
|
|
73
|
+
revocationIndex?: number;
|
|
74
|
+
expirationDate?: Date;
|
|
75
|
+
}): Promise<{
|
|
71
76
|
verifiableCredential: IDidVerifiableCredential;
|
|
72
77
|
jwt: string;
|
|
73
78
|
}>;
|
|
@@ -50,13 +50,13 @@ export interface IIdentityProfileComponent<T extends IJsonLdDocument = IJsonLdDo
|
|
|
50
50
|
* @param publicFilters The filters to apply to the identities public profiles.
|
|
51
51
|
* @param publicPropertyNames The public properties to get for the profile, defaults to all.
|
|
52
52
|
* @param cursor The cursor for paged requests.
|
|
53
|
-
* @param
|
|
53
|
+
* @param limit The maximum number of items in a page.
|
|
54
54
|
* @returns The list of items and cursor for paging.
|
|
55
55
|
*/
|
|
56
56
|
list(publicFilters?: {
|
|
57
57
|
propertyName: string;
|
|
58
58
|
propertyValue: unknown;
|
|
59
|
-
}[], publicPropertyNames?: (keyof T)[], cursor?: string,
|
|
59
|
+
}[], publicPropertyNames?: (keyof T)[], cursor?: string, limit?: number): Promise<{
|
|
60
60
|
/**
|
|
61
61
|
* The identities.
|
|
62
62
|
*/
|
|
@@ -44,7 +44,7 @@ export interface IIdentityProfileConnector<T extends IJsonLdDocument = IJsonLdDo
|
|
|
44
44
|
* @param publicPropertyNames The public properties to get for the profile, defaults to all.
|
|
45
45
|
* @param privatePropertyNames The private properties to get for the profile, defaults to all.
|
|
46
46
|
* @param cursor The cursor for paged requests.
|
|
47
|
-
* @param
|
|
47
|
+
* @param limit The maximum number of items in a page.
|
|
48
48
|
* @returns The list of items and cursor for paging.
|
|
49
49
|
*/
|
|
50
50
|
list(publicFilters?: {
|
|
@@ -53,7 +53,7 @@ export interface IIdentityProfileConnector<T extends IJsonLdDocument = IJsonLdDo
|
|
|
53
53
|
}[], privateFilters?: {
|
|
54
54
|
propertyName: string;
|
|
55
55
|
propertyValue: unknown;
|
|
56
|
-
}[], publicPropertyNames?: (keyof T)[], privatePropertyNames?: (keyof U)[], cursor?: string,
|
|
56
|
+
}[], publicPropertyNames?: (keyof T)[], privatePropertyNames?: (keyof U)[], cursor?: string, limit?: number): Promise<{
|
|
57
57
|
/**
|
|
58
58
|
* The identity profiles.
|
|
59
59
|
*/
|
|
@@ -32,5 +32,9 @@ export interface IIdentityVerifiableCredentialCreateRequest {
|
|
|
32
32
|
* The bitmap revocation index of the credential, if undefined will not have revocation status.
|
|
33
33
|
*/
|
|
34
34
|
revocationIndex?: number;
|
|
35
|
+
/**
|
|
36
|
+
* The date the verifiable credential is valid until.
|
|
37
|
+
*/
|
|
38
|
+
expirationDate?: string;
|
|
35
39
|
};
|
|
36
40
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper methods for Ids.
|
|
3
|
+
*/
|
|
4
|
+
export declare class IdHelper {
|
|
5
|
+
/**
|
|
6
|
+
* Runtime name for the class.
|
|
7
|
+
*/
|
|
8
|
+
static readonly CLASS_NAME: string;
|
|
9
|
+
/**
|
|
10
|
+
* Parse and id in to it's constituent parts.
|
|
11
|
+
* @param id The id to parse.
|
|
12
|
+
* @returns The parsed id.
|
|
13
|
+
* @throws GeneralError if the id is not valid.
|
|
14
|
+
*/
|
|
15
|
+
static parseId(id: string): {
|
|
16
|
+
method: string;
|
|
17
|
+
network?: string | undefined;
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,85 @@
|
|
|
1
1
|
# @twin.org/identity-service-models - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.10](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.2-next.9...identity-models-v0.0.2-next.10) (2025-10-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **identity-models:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
## [0.0.2-next.9](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.2-next.8...identity-models-v0.0.2-next.9) (2025-10-09)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add validate-locales ([04d74b4](https://github.com/twinfoundation/identity/commit/04d74b4d1ebe42672e8ca75a7bdb8e3556afd0be))
|
|
16
|
+
|
|
17
|
+
## [0.0.2-next.8](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.2-next.7...identity-models-v0.0.2-next.8) (2025-09-25)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add idHelper class ([57c8bdb](https://github.com/twinfoundation/identity/commit/57c8bdb81efaa163b5e83f8a7f16f3764d12fd75))
|
|
23
|
+
|
|
24
|
+
## [0.0.2-next.7](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.2-next.6...identity-models-v0.0.2-next.7) (2025-09-23)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Miscellaneous Chores
|
|
28
|
+
|
|
29
|
+
* **identity-models:** Synchronize repo versions
|
|
30
|
+
|
|
31
|
+
## [0.0.2-next.6](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.2-next.5...identity-models-v0.0.2-next.6) (2025-09-23)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous Chores
|
|
35
|
+
|
|
36
|
+
* **identity-models:** Synchronize repo versions
|
|
37
|
+
|
|
38
|
+
## [0.0.2-next.5](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.2-next.4...identity-models-v0.0.2-next.5) (2025-09-15)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Miscellaneous Chores
|
|
42
|
+
|
|
43
|
+
* **identity-models:** Synchronize repo versions
|
|
44
|
+
|
|
45
|
+
## [0.0.2-next.4](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.2-next.3...identity-models-v0.0.2-next.4) (2025-09-12)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
* add expiration date option to vc creation ([73e05e1](https://github.com/twinfoundation/identity/commit/73e05e1ae61112c7e056889969751f4ff82d9f29))
|
|
51
|
+
|
|
52
|
+
## [0.0.2-next.3](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.2-next.2...identity-models-v0.0.2-next.3) (2025-08-29)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
* eslint migration to flat config ([fd6246d](https://github.com/twinfoundation/identity/commit/fd6246d566280b6d5d10a108eb1e92c4b510f2f2))
|
|
58
|
+
|
|
59
|
+
## [0.0.2-next.2](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.2-next.1...identity-models-v0.0.2-next.2) (2025-08-20)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
* update framework core ([c824497](https://github.com/twinfoundation/identity/commit/c82449709af0215eb7af496cf687c93fb30b5ae0))
|
|
65
|
+
|
|
66
|
+
## [0.0.2-next.1](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.2-next.0...identity-models-v0.0.2-next.1) (2025-08-18)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Features
|
|
70
|
+
|
|
71
|
+
* add identity remove ([eebc13f](https://github.com/twinfoundation/identity/commit/eebc13f4c2cd994d2d9cce4da2128fb346c80ba7))
|
|
72
|
+
* identity key separator use slash ([1319d0d](https://github.com/twinfoundation/identity/commit/1319d0d07164a36b3ec279e6421b8835ffefc3d3))
|
|
73
|
+
* use shared store mechanism ([#27](https://github.com/twinfoundation/identity/issues/27)) ([ce41f3f](https://github.com/twinfoundation/identity/commit/ce41f3fc3da1b206ec06da7ea5b2c968f788804d))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Bug Fixes
|
|
77
|
+
|
|
78
|
+
* Import path and bump version ([#21](https://github.com/twinfoundation/identity/issues/21)) ([ccea845](https://github.com/twinfoundation/identity/commit/ccea845bf32562267280bc1b3dde1c9af1a00360))
|
|
79
|
+
* Install sdk-wasm ([#20](https://github.com/twinfoundation/identity/issues/20)) ([75ec14e](https://github.com/twinfoundation/identity/commit/75ec14e072f8c219863a1c028a3b0783802086e9))
|
|
80
|
+
* query params force coercion ([d9347d2](https://github.com/twinfoundation/identity/commit/d9347d29d4a9cc58759f30f5d8526de864ea7522))
|
|
81
|
+
* Use resolver component ([#22](https://github.com/twinfoundation/identity/issues/22)) ([d0b3a32](https://github.com/twinfoundation/identity/commit/d0b3a321c7f9f966d397a880d752e9f2c0a98a27))
|
|
82
|
+
|
|
3
83
|
## 0.0.1 (2025-07-08)
|
|
4
84
|
|
|
5
85
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Class: IdHelper
|
|
2
|
+
|
|
3
|
+
Helper methods for Ids.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new IdHelper**(): `IdHelper`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`IdHelper`
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### CLASS\_NAME
|
|
18
|
+
|
|
19
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
|
+
|
|
21
|
+
Runtime name for the class.
|
|
22
|
+
|
|
23
|
+
## Methods
|
|
24
|
+
|
|
25
|
+
### parseId()
|
|
26
|
+
|
|
27
|
+
> `static` **parseId**(`id`): `object`
|
|
28
|
+
|
|
29
|
+
Parse and id in to it's constituent parts.
|
|
30
|
+
|
|
31
|
+
#### Parameters
|
|
32
|
+
|
|
33
|
+
##### id
|
|
34
|
+
|
|
35
|
+
`string`
|
|
36
|
+
|
|
37
|
+
The id to parse.
|
|
38
|
+
|
|
39
|
+
#### Returns
|
|
40
|
+
|
|
41
|
+
`object`
|
|
42
|
+
|
|
43
|
+
The parsed id.
|
|
44
|
+
|
|
45
|
+
##### method
|
|
46
|
+
|
|
47
|
+
> **method**: `string`
|
|
48
|
+
|
|
49
|
+
##### network?
|
|
50
|
+
|
|
51
|
+
> `optional` **network**: `string`
|
|
52
|
+
|
|
53
|
+
##### id
|
|
54
|
+
|
|
55
|
+
> **id**: `string`
|
|
56
|
+
|
|
57
|
+
#### Throws
|
|
58
|
+
|
|
59
|
+
GeneralError if the id is not valid.
|
package/docs/reference/index.md
CHANGED
|
@@ -6,6 +6,14 @@ Interface describing a contract which provides identity operations.
|
|
|
6
6
|
|
|
7
7
|
- `IComponent`
|
|
8
8
|
|
|
9
|
+
## Indexable
|
|
10
|
+
|
|
11
|
+
\[`key`: `string`\]: `any`
|
|
12
|
+
|
|
13
|
+
All methods are optional, so we introduce an index signature to allow
|
|
14
|
+
any additional properties or methods, which removes the TypeScript error where
|
|
15
|
+
the class has no properties in common with the type.
|
|
16
|
+
|
|
9
17
|
## Methods
|
|
10
18
|
|
|
11
19
|
### identityCreate()
|
|
@@ -232,7 +240,7 @@ NotFoundError if the id can not be resolved.
|
|
|
232
240
|
|
|
233
241
|
### verifiableCredentialCreate()
|
|
234
242
|
|
|
235
|
-
> **verifiableCredentialCreate**(`verificationMethodId`, `id`, `subject`, `
|
|
243
|
+
> **verifiableCredentialCreate**(`verificationMethodId`, `id`, `subject`, `options?`, `controller?`): `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
|
|
236
244
|
|
|
237
245
|
Create a verifiable credential for a verification method.
|
|
238
246
|
|
|
@@ -256,12 +264,22 @@ The id of the credential.
|
|
|
256
264
|
|
|
257
265
|
The credential subject to store in the verifiable credential.
|
|
258
266
|
|
|
259
|
-
#####
|
|
267
|
+
##### options?
|
|
268
|
+
|
|
269
|
+
Additional options for creating the verifiable credential.
|
|
270
|
+
|
|
271
|
+
###### revocationIndex?
|
|
260
272
|
|
|
261
273
|
`number`
|
|
262
274
|
|
|
263
275
|
The bitmap revocation index of the credential, if undefined will not have revocation status.
|
|
264
276
|
|
|
277
|
+
###### expirationDate?
|
|
278
|
+
|
|
279
|
+
`Date`
|
|
280
|
+
|
|
281
|
+
The date the verifiable credential is valid until.
|
|
282
|
+
|
|
265
283
|
##### controller?
|
|
266
284
|
|
|
267
285
|
`string`
|
|
@@ -6,6 +6,14 @@ Interface describing an identity connector.
|
|
|
6
6
|
|
|
7
7
|
- `IComponent`
|
|
8
8
|
|
|
9
|
+
## Indexable
|
|
10
|
+
|
|
11
|
+
\[`key`: `string`\]: `any`
|
|
12
|
+
|
|
13
|
+
All methods are optional, so we introduce an index signature to allow
|
|
14
|
+
any additional properties or methods, which removes the TypeScript error where
|
|
15
|
+
the class has no properties in common with the type.
|
|
16
|
+
|
|
9
17
|
## Methods
|
|
10
18
|
|
|
11
19
|
### createDocument()
|
|
@@ -226,7 +234,7 @@ NotFoundError if the id can not be resolved.
|
|
|
226
234
|
|
|
227
235
|
### createVerifiableCredential()
|
|
228
236
|
|
|
229
|
-
> **createVerifiableCredential**(`controller`, `verificationMethodId`, `id`, `subject`, `
|
|
237
|
+
> **createVerifiableCredential**(`controller`, `verificationMethodId`, `id`, `subject`, `options?`): `Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
|
|
230
238
|
|
|
231
239
|
Create a verifiable credential for a verification method.
|
|
232
240
|
|
|
@@ -256,12 +264,22 @@ The id of the credential.
|
|
|
256
264
|
|
|
257
265
|
The credential subject to store in the verifiable credential.
|
|
258
266
|
|
|
259
|
-
#####
|
|
267
|
+
##### options?
|
|
268
|
+
|
|
269
|
+
Additional options for creating the verifiable credential.
|
|
270
|
+
|
|
271
|
+
###### revocationIndex?
|
|
260
272
|
|
|
261
273
|
`number`
|
|
262
274
|
|
|
263
275
|
The bitmap revocation index of the credential, if undefined will not have revocation status.
|
|
264
276
|
|
|
277
|
+
###### expirationDate?
|
|
278
|
+
|
|
279
|
+
`Date`
|
|
280
|
+
|
|
281
|
+
The date the verifiable credential is valid until.
|
|
282
|
+
|
|
265
283
|
#### Returns
|
|
266
284
|
|
|
267
285
|
`Promise`\<\{ `verifiableCredential`: `IDidVerifiableCredential`; `jwt`: `string`; \}\>
|
|
@@ -16,6 +16,14 @@ Interface describing a contract which provides profile operations.
|
|
|
16
16
|
|
|
17
17
|
`U` *extends* `IJsonLdDocument` = `IJsonLdDocument`
|
|
18
18
|
|
|
19
|
+
## Indexable
|
|
20
|
+
|
|
21
|
+
\[`key`: `string`\]: `any`
|
|
22
|
+
|
|
23
|
+
All methods are optional, so we introduce an index signature to allow
|
|
24
|
+
any additional properties or methods, which removes the TypeScript error where
|
|
25
|
+
the class has no properties in common with the type.
|
|
26
|
+
|
|
19
27
|
## Methods
|
|
20
28
|
|
|
21
29
|
### create()
|
|
@@ -172,7 +180,7 @@ Nothing.
|
|
|
172
180
|
|
|
173
181
|
### list()
|
|
174
182
|
|
|
175
|
-
> **list**(`publicFilters?`, `publicPropertyNames?`, `cursor?`, `
|
|
183
|
+
> **list**(`publicFilters?`, `publicPropertyNames?`, `cursor?`, `limit?`): `Promise`\<\{ `items`: `object`[]; `cursor?`: `string`; \}\>
|
|
176
184
|
|
|
177
185
|
Get a list of the requested identities.
|
|
178
186
|
|
|
@@ -196,7 +204,7 @@ The public properties to get for the profile, defaults to all.
|
|
|
196
204
|
|
|
197
205
|
The cursor for paged requests.
|
|
198
206
|
|
|
199
|
-
#####
|
|
207
|
+
##### limit?
|
|
200
208
|
|
|
201
209
|
`number`
|
|
202
210
|
|
|
@@ -16,6 +16,14 @@ Interface describing a contract which provides profile operations.
|
|
|
16
16
|
|
|
17
17
|
`U` *extends* `IJsonLdDocument` = `IJsonLdDocument`
|
|
18
18
|
|
|
19
|
+
## Indexable
|
|
20
|
+
|
|
21
|
+
\[`key`: `string`\]: `any`
|
|
22
|
+
|
|
23
|
+
All methods are optional, so we introduce an index signature to allow
|
|
24
|
+
any additional properties or methods, which removes the TypeScript error where
|
|
25
|
+
the class has no properties in common with the type.
|
|
26
|
+
|
|
19
27
|
## Methods
|
|
20
28
|
|
|
21
29
|
### create()
|
|
@@ -144,7 +152,7 @@ Nothing.
|
|
|
144
152
|
|
|
145
153
|
### list()
|
|
146
154
|
|
|
147
|
-
> **list**(`publicFilters?`, `privateFilters?`, `publicPropertyNames?`, `privatePropertyNames?`, `cursor?`, `
|
|
155
|
+
> **list**(`publicFilters?`, `privateFilters?`, `publicPropertyNames?`, `privatePropertyNames?`, `cursor?`, `limit?`): `Promise`\<\{ `items`: `object`[]; `cursor?`: `string`; \}\>
|
|
148
156
|
|
|
149
157
|
Get a list of the requested identities.
|
|
150
158
|
|
|
@@ -180,7 +188,7 @@ The private properties to get for the profile, defaults to all.
|
|
|
180
188
|
|
|
181
189
|
The cursor for paged requests.
|
|
182
190
|
|
|
183
|
-
#####
|
|
191
|
+
##### limit?
|
|
184
192
|
|
|
185
193
|
`number`
|
|
186
194
|
|
|
@@ -28,8 +28,8 @@ The public properties to get for the profile, defaults to all, should be a comma
|
|
|
28
28
|
|
|
29
29
|
The cursor for paged requests.
|
|
30
30
|
|
|
31
|
-
####
|
|
31
|
+
#### limit?
|
|
32
32
|
|
|
33
|
-
> `optional` **
|
|
33
|
+
> `optional` **limit**: `string`
|
|
34
34
|
|
|
35
35
|
Number of items to return.
|
|
@@ -6,6 +6,14 @@ Interface describing a contract which provides identity operations.
|
|
|
6
6
|
|
|
7
7
|
- `IComponent`
|
|
8
8
|
|
|
9
|
+
## Indexable
|
|
10
|
+
|
|
11
|
+
\[`key`: `string`\]: `any`
|
|
12
|
+
|
|
13
|
+
All methods are optional, so we introduce an index signature to allow
|
|
14
|
+
any additional properties or methods, which removes the TypeScript error where
|
|
15
|
+
the class has no properties in common with the type.
|
|
16
|
+
|
|
9
17
|
## Methods
|
|
10
18
|
|
|
11
19
|
### identityResolve()
|
|
@@ -6,6 +6,14 @@ Interface describing an identity connector.
|
|
|
6
6
|
|
|
7
7
|
- `IComponent`
|
|
8
8
|
|
|
9
|
+
## Indexable
|
|
10
|
+
|
|
11
|
+
\[`key`: `string`\]: `any`
|
|
12
|
+
|
|
13
|
+
All methods are optional, so we introduce an index signature to allow
|
|
14
|
+
any additional properties or methods, which removes the TypeScript error where
|
|
15
|
+
the class has no properties in common with the type.
|
|
16
|
+
|
|
9
17
|
## Methods
|
|
10
18
|
|
|
11
19
|
### resolveDocument()
|
|
@@ -47,3 +47,9 @@ The credential subject to store in the verifiable credential.
|
|
|
47
47
|
> `optional` **revocationIndex**: `number`
|
|
48
48
|
|
|
49
49
|
The bitmap revocation index of the credential, if undefined will not have revocation status.
|
|
50
|
+
|
|
51
|
+
#### expirationDate?
|
|
52
|
+
|
|
53
|
+
> `optional` **expirationDate**: `string`
|
|
54
|
+
|
|
55
|
+
The date the verifiable credential is valid until.
|
package/locales/en.json
CHANGED
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
"error": {
|
|
3
3
|
"verificationHelper": {
|
|
4
4
|
"jwtDecodeFailed": "Decoding the JWT failed",
|
|
5
|
-
"proofTypeNotSupported": "The proof type \"{proofType}\" is not supported",
|
|
6
5
|
"proofMissingVerificationMethod": "The proof is missing the verification method"
|
|
7
6
|
},
|
|
8
7
|
"documentHelper": {
|
|
9
8
|
"verificationMethodNotFound": "The verification method \"{methodName}\" of type \"{methodType}\" could not be found",
|
|
10
9
|
"verificationMethodJwkNotFound": "The verification method \"{methodName}\" of type \"{methodType}\" is missing the JWK"
|
|
10
|
+
},
|
|
11
|
+
"idHelper": {
|
|
12
|
+
"invalidDocumentId": "The document id \"{id}\" is invalid"
|
|
11
13
|
}
|
|
12
|
-
},
|
|
13
|
-
"verifiableCredentialStates": {
|
|
14
|
-
"pendingVerification": "Pending Verification",
|
|
15
|
-
"rejected": "Rejected",
|
|
16
|
-
"issued": "Issued",
|
|
17
|
-
"revoked": "Revoked"
|
|
18
14
|
}
|
|
19
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/identity-models",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-next.10",
|
|
4
4
|
"description": "Models which define the structure of the contracts and connectors",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "
|
|
18
|
-
"@twin.org/data-core": "
|
|
19
|
-
"@twin.org/data-json-ld": "
|
|
20
|
-
"@twin.org/entity": "
|
|
21
|
-
"@twin.org/standards-w3c-did": "
|
|
22
|
-
"@twin.org/web": "
|
|
17
|
+
"@twin.org/core": "next",
|
|
18
|
+
"@twin.org/data-core": "next",
|
|
19
|
+
"@twin.org/data-json-ld": "next",
|
|
20
|
+
"@twin.org/entity": "next",
|
|
21
|
+
"@twin.org/standards-w3c-did": "next",
|
|
22
|
+
"@twin.org/web": "next"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/cjs/index.cjs",
|
|
25
25
|
"module": "./dist/esm/index.mjs",
|
|
@@ -38,5 +38,23 @@
|
|
|
38
38
|
"dist/types",
|
|
39
39
|
"locales",
|
|
40
40
|
"docs"
|
|
41
|
-
]
|
|
41
|
+
],
|
|
42
|
+
"keywords": [
|
|
43
|
+
"twin",
|
|
44
|
+
"trade",
|
|
45
|
+
"iota",
|
|
46
|
+
"framework",
|
|
47
|
+
"blockchain",
|
|
48
|
+
"identity",
|
|
49
|
+
"did",
|
|
50
|
+
"credentials",
|
|
51
|
+
"authentication",
|
|
52
|
+
"models",
|
|
53
|
+
"types",
|
|
54
|
+
"schemas"
|
|
55
|
+
],
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "git+https://github.com/twinfoundation/identity/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://twindev.org"
|
|
42
60
|
}
|