@twin.org/identity-rest-client 0.0.3-next.9 → 0.9.0-next.1
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/identityProfileRestClient.js +4 -4
- package/dist/es/identityProfileRestClient.js.map +1 -1
- package/dist/es/identityResolverRestClient.js +1 -1
- package/dist/es/identityResolverRestClient.js.map +1 -1
- package/dist/es/identityRestClient.js +80 -25
- package/dist/es/identityRestClient.js.map +1 -1
- package/dist/types/identityProfileRestClient.d.ts +4 -4
- package/dist/types/identityResolverRestClient.d.ts +1 -1
- package/dist/types/identityRestClient.d.ts +52 -13
- package/docs/changelog.md +563 -86
- package/docs/examples.md +175 -1
- package/docs/reference/classes/IdentityProfileRestClient.md +12 -12
- package/docs/reference/classes/IdentityResolverRestClient.md +4 -4
- package/docs/reference/classes/IdentityRestClient.md +155 -45
- package/package.json +13 -13
|
@@ -30,7 +30,7 @@ export declare class IdentityRestClient extends BaseRestClient implements IIdent
|
|
|
30
30
|
/**
|
|
31
31
|
* Remove an identity.
|
|
32
32
|
* @param identity The id of the document to remove.
|
|
33
|
-
* @returns
|
|
33
|
+
* @returns A promise that resolves when the identity has been removed.
|
|
34
34
|
*/
|
|
35
35
|
identityRemove(identity: string): Promise<void>;
|
|
36
36
|
/**
|
|
@@ -46,7 +46,7 @@ export declare class IdentityRestClient extends BaseRestClient implements IIdent
|
|
|
46
46
|
/**
|
|
47
47
|
* Remove a verification method from the document.
|
|
48
48
|
* @param verificationMethodId The id of the verification method.
|
|
49
|
-
* @returns
|
|
49
|
+
* @returns A promise that resolves when the verification method has been removed.
|
|
50
50
|
* @throws NotFoundError if the id can not be resolved.
|
|
51
51
|
* @throws NotSupportedError if the platform does not support multiple revocable keys.
|
|
52
52
|
*/
|
|
@@ -64,10 +64,30 @@ export declare class IdentityRestClient extends BaseRestClient implements IIdent
|
|
|
64
64
|
/**
|
|
65
65
|
* Remove a service from the document.
|
|
66
66
|
* @param serviceId The id of the service.
|
|
67
|
-
* @returns
|
|
67
|
+
* @returns A promise that resolves when the service has been removed.
|
|
68
68
|
* @throws NotFoundError if the id can not be resolved.
|
|
69
69
|
*/
|
|
70
70
|
serviceRemove(serviceId: string): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Add an alias to the alsoKnownAs property on the document.
|
|
73
|
+
* If the alias is already present the operation is a no-op.
|
|
74
|
+
* @param documentId The id of the document to update.
|
|
75
|
+
* @param alias The alias to add. Must be a Url or Urn (typically another DID).
|
|
76
|
+
* @returns A promise that resolves when the alias has been added.
|
|
77
|
+
* @throws GeneralError if the alias is not a Url or Urn.
|
|
78
|
+
* @throws NotFoundError if the id can not be resolved.
|
|
79
|
+
*/
|
|
80
|
+
alsoKnownAsAdd(documentId: string, alias: string): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Remove an alias from the alsoKnownAs property on the document.
|
|
83
|
+
* If the alias is not present the operation is a no-op.
|
|
84
|
+
* @param documentId The id of the document to update.
|
|
85
|
+
* @param alias The alias to remove. Must be a Url or Urn.
|
|
86
|
+
* @returns A promise that resolves when the alias has been removed.
|
|
87
|
+
* @throws GeneralError if the alias is not a Url or Urn.
|
|
88
|
+
* @throws NotFoundError if the id can not be resolved.
|
|
89
|
+
*/
|
|
90
|
+
alsoKnownAsRemove(documentId: string, alias: string): Promise<void>;
|
|
71
91
|
/**
|
|
72
92
|
* Create a verifiable credential for a verification method.
|
|
73
93
|
* @param verificationMethodId The verification method id to use.
|
|
@@ -76,37 +96,45 @@ export declare class IdentityRestClient extends BaseRestClient implements IIdent
|
|
|
76
96
|
* @param options Additional options for creating the verifiable credential.
|
|
77
97
|
* @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
|
|
78
98
|
* @param options.expirationDate The date the verifiable credential is valid until.
|
|
99
|
+
* @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable credential in jwt format.
|
|
100
|
+
* @param options.jwtPayloadFields Additional fields to include in the JWT payload when creating the verifiable credential in jwt format.
|
|
79
101
|
* @returns The created verifiable credential and its token.
|
|
80
102
|
* @throws NotFoundError if the id can not be resolved.
|
|
81
103
|
*/
|
|
82
104
|
verifiableCredentialCreate(verificationMethodId: string, id: string | undefined, subject: IJsonLdNodeObject, options?: {
|
|
83
105
|
revocationIndex?: number;
|
|
84
106
|
expirationDate?: Date;
|
|
107
|
+
jwtHeaderFields?: {
|
|
108
|
+
[id: string]: string;
|
|
109
|
+
};
|
|
110
|
+
jwtPayloadFields?: {
|
|
111
|
+
[id: string]: string;
|
|
112
|
+
};
|
|
85
113
|
}): Promise<{
|
|
86
114
|
verifiableCredential: IDidVerifiableCredential;
|
|
87
115
|
jwt: string;
|
|
88
116
|
}>;
|
|
89
117
|
/**
|
|
90
118
|
* Verify a verifiable credential is valid.
|
|
91
|
-
* @param
|
|
119
|
+
* @param credential The credential to verify.
|
|
92
120
|
* @returns The credential stored in the jwt and the revocation status.
|
|
93
121
|
*/
|
|
94
|
-
verifiableCredentialVerify(
|
|
122
|
+
verifiableCredentialVerify(credential: string | IDidVerifiableCredential): Promise<{
|
|
95
123
|
revoked: boolean;
|
|
96
124
|
verifiableCredential?: IDidVerifiableCredential;
|
|
97
125
|
}>;
|
|
98
126
|
/**
|
|
99
127
|
* Revoke verifiable credential.
|
|
100
128
|
* @param issuerId The id of the document to update the revocation list for.
|
|
101
|
-
* @param credentialIndex The revocation bitmap index revoke.
|
|
102
|
-
* @returns
|
|
129
|
+
* @param credentialIndex The revocation bitmap index to revoke.
|
|
130
|
+
* @returns A promise that resolves when the credential has been revoked.
|
|
103
131
|
*/
|
|
104
132
|
verifiableCredentialRevoke(issuerId: string, credentialIndex: number): Promise<void>;
|
|
105
133
|
/**
|
|
106
134
|
* Unrevoke verifiable credential.
|
|
107
135
|
* @param issuerId The id of the document to update the revocation list for.
|
|
108
|
-
* @param credentialIndex The revocation bitmap index to
|
|
109
|
-
* @returns
|
|
136
|
+
* @param credentialIndex The revocation bitmap index to unrevoke.
|
|
137
|
+
* @returns A promise that resolves when the credential has been unrevoked.
|
|
110
138
|
*/
|
|
111
139
|
verifiableCredentialUnrevoke(issuerId: string, credentialIndex: number): Promise<void>;
|
|
112
140
|
/**
|
|
@@ -116,20 +144,31 @@ export declare class IdentityRestClient extends BaseRestClient implements IIdent
|
|
|
116
144
|
* @param contexts The contexts for the data stored in the verifiable credential.
|
|
117
145
|
* @param types The types for the data stored in the verifiable credential.
|
|
118
146
|
* @param verifiableCredentials The credentials to use for creating the presentation in jwt format.
|
|
119
|
-
* @param
|
|
147
|
+
* @param options Additional options for creating the verifiable presentation.
|
|
148
|
+
* @param options.expirationDate The date the verifiable presentation is valid until.
|
|
149
|
+
* @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable presentation in jwt format.
|
|
150
|
+
* @param options.jwtPayloadFields Additional fields to include in the JWT payload when creating the verifiable presentation in jwt format.
|
|
120
151
|
* @returns The created verifiable presentation and its token.
|
|
121
152
|
* @throws NotFoundError if the id can not be resolved.
|
|
122
153
|
*/
|
|
123
|
-
verifiablePresentationCreate(verificationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential)[],
|
|
154
|
+
verifiablePresentationCreate(verificationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential)[], options?: {
|
|
155
|
+
expirationDate?: Date;
|
|
156
|
+
jwtHeaderFields?: {
|
|
157
|
+
[id: string]: string;
|
|
158
|
+
};
|
|
159
|
+
jwtPayloadFields?: {
|
|
160
|
+
[id: string]: string;
|
|
161
|
+
};
|
|
162
|
+
}): Promise<{
|
|
124
163
|
verifiablePresentation: IDidVerifiablePresentation;
|
|
125
164
|
jwt: string;
|
|
126
165
|
}>;
|
|
127
166
|
/**
|
|
128
167
|
* Verify a verifiable presentation is valid.
|
|
129
|
-
* @param
|
|
168
|
+
* @param presentation The presentation to verify.
|
|
130
169
|
* @returns The presentation stored in the jwt and the revocation status.
|
|
131
170
|
*/
|
|
132
|
-
verifiablePresentationVerify(
|
|
171
|
+
verifiablePresentationVerify(presentation: string | IDidVerifiablePresentation): Promise<{
|
|
133
172
|
revoked: boolean;
|
|
134
173
|
verifiablePresentation?: IDidVerifiablePresentation;
|
|
135
174
|
issuers?: IDidDocument[];
|