@sphereon/ssi-sdk.vc-status-list 0.34.1-next.3 → 0.34.1-next.322
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/index.cjs +703 -125
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -37
- package/dist/index.d.ts +164 -37
- package/dist/index.js +707 -129
- package/dist/index.js.map +1 -1
- package/package.json +14 -10
- package/src/functions.ts +126 -47
- package/src/impl/BitstringStatusListImplementation.ts +496 -0
- package/src/impl/IStatusList.ts +102 -8
- package/src/impl/OAuthStatusList.ts +133 -38
- package/src/impl/StatusList2021.ts +120 -34
- package/src/impl/StatusListFactory.ts +2 -0
- package/src/impl/encoding/cbor.ts +14 -12
- package/src/index.ts +1 -0
- package/src/types/BitstringStatusList.ts +4 -0
- package/src/types/index.ts +57 -34
- package/src/utils.ts +82 -20
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,61 @@
|
|
|
1
1
|
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
2
|
-
import {
|
|
3
|
-
import { IPluginMethodMap, IAgentContext, ICredentialIssuer, ICredentialVerifier, IKeyManager,
|
|
2
|
+
import { IIssuer, StatusListType, CredentialProofFormat, StatusListCredential, StatusListDriverType, StatusListIndexingDirection, StatusPurpose2021, StatusListCredentialIdMode, ICredentialStatus, OrPromise, ICredential, IVerifiableCredential } from '@sphereon/ssi-types';
|
|
3
|
+
import { IPluginMethodMap, IAgentContext, ICredentialIssuer, ICredentialVerifier, IKeyManager, CredentialPayload } from '@veramo/core';
|
|
4
4
|
import { DataSource } from 'typeorm';
|
|
5
|
-
import { BitsPerStatus } from '@sd-jwt/jwt-status-list';
|
|
5
|
+
import { StatusList, BitsPerStatus } from '@sd-jwt/jwt-status-list';
|
|
6
6
|
import { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc';
|
|
7
7
|
import { StatusListOpts } from '@sphereon/oid4vci-common';
|
|
8
|
+
import { BitstringStatusPurpose } from '@4sure-tech/vc-bitstring-status-lists';
|
|
9
|
+
import { IVcdmCredentialPlugin } from '@sphereon/ssi-sdk.credential-vcdm';
|
|
10
|
+
import { BitstringStatusListArgs, IStatusListEntity, StatusListEntity, IStatusListEntryEntity, IBitstringStatusListEntryEntity, BitstringStatusListEntryCredentialStatus } from '@sphereon/ssi-sdk.data-store';
|
|
8
11
|
import { StatusMethod } from 'credential-status';
|
|
9
12
|
|
|
13
|
+
interface DecodedStatusListPayload {
|
|
14
|
+
issuer: string;
|
|
15
|
+
id: string;
|
|
16
|
+
statusList: StatusList;
|
|
17
|
+
exp?: number;
|
|
18
|
+
ttl?: number;
|
|
19
|
+
iat: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface IExtractedCredentialDetails {
|
|
23
|
+
id: string;
|
|
24
|
+
issuer: string | IIssuer;
|
|
25
|
+
encodedList: string;
|
|
26
|
+
decodedPayload?: DecodedStatusListPayload;
|
|
27
|
+
}
|
|
28
|
+
interface IStatusListImplementationResult {
|
|
29
|
+
id: string;
|
|
30
|
+
encodedList: string;
|
|
31
|
+
issuer: string | IIssuer;
|
|
32
|
+
type: StatusListType;
|
|
33
|
+
proofFormat: CredentialProofFormat;
|
|
34
|
+
length: number;
|
|
35
|
+
statusListCredential: StatusListCredential;
|
|
36
|
+
statuslistContentType: string;
|
|
37
|
+
correlationId?: string;
|
|
38
|
+
driverType?: StatusListDriverType;
|
|
39
|
+
}
|
|
40
|
+
interface IStatusList2021ImplementationResult extends IStatusListImplementationResult {
|
|
41
|
+
type: StatusListType.StatusList2021;
|
|
42
|
+
indexingDirection: StatusListIndexingDirection;
|
|
43
|
+
statusPurpose: StatusPurpose2021;
|
|
44
|
+
}
|
|
45
|
+
interface IOAuthStatusListImplementationResult extends IStatusListImplementationResult {
|
|
46
|
+
type: StatusListType.OAuthStatusList;
|
|
47
|
+
bitsPerStatus: number;
|
|
48
|
+
expiresAt?: Date;
|
|
49
|
+
}
|
|
50
|
+
interface IBitstringStatusListImplementationResult extends IStatusListImplementationResult {
|
|
51
|
+
type: StatusListType.BitstringStatusList;
|
|
52
|
+
statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[];
|
|
53
|
+
bitsPerStatus?: number;
|
|
54
|
+
validFrom?: Date;
|
|
55
|
+
validUntil?: Date;
|
|
56
|
+
ttl?: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
10
59
|
declare enum StatusOAuth {
|
|
11
60
|
Valid = 0,
|
|
12
61
|
Invalid = 1,
|
|
@@ -21,7 +70,7 @@ type StatusList2021Args = {
|
|
|
21
70
|
statusPurpose?: StatusPurpose2021;
|
|
22
71
|
};
|
|
23
72
|
type OAuthStatusListArgs = {
|
|
24
|
-
bitsPerStatus
|
|
73
|
+
bitsPerStatus: BitsPerStatus;
|
|
25
74
|
expiresAt?: Date;
|
|
26
75
|
};
|
|
27
76
|
type BaseCreateNewStatusListArgs = {
|
|
@@ -34,6 +83,7 @@ type BaseCreateNewStatusListArgs = {
|
|
|
34
83
|
keyRef?: string;
|
|
35
84
|
statusList2021?: StatusList2021Args;
|
|
36
85
|
oauthStatusList?: OAuthStatusListArgs;
|
|
86
|
+
bitstringStatusList?: BitstringStatusListArgs;
|
|
37
87
|
driverType?: StatusListDriverType;
|
|
38
88
|
};
|
|
39
89
|
type UpdateStatusList2021Args = {
|
|
@@ -43,10 +93,17 @@ type UpdateOAuthStatusListArgs = {
|
|
|
43
93
|
bitsPerStatus: BitsPerStatus;
|
|
44
94
|
expiresAt?: Date;
|
|
45
95
|
};
|
|
96
|
+
type UpdateBitstringStatusListArgs = {
|
|
97
|
+
statusPurpose: BitstringStatusPurpose;
|
|
98
|
+
bitsPerStatus: number;
|
|
99
|
+
validFrom?: Date;
|
|
100
|
+
validUntil?: Date;
|
|
101
|
+
ttl?: number;
|
|
102
|
+
};
|
|
46
103
|
interface UpdateStatusListFromEncodedListArgs {
|
|
47
104
|
type?: StatusListType;
|
|
48
105
|
statusListIndex: number | string;
|
|
49
|
-
value:
|
|
106
|
+
value: number;
|
|
50
107
|
proofFormat?: CredentialProofFormat;
|
|
51
108
|
keyRef?: string;
|
|
52
109
|
correlationId?: string;
|
|
@@ -55,6 +112,7 @@ interface UpdateStatusListFromEncodedListArgs {
|
|
|
55
112
|
id: string;
|
|
56
113
|
statusList2021?: UpdateStatusList2021Args;
|
|
57
114
|
oauthStatusList?: UpdateOAuthStatusListArgs;
|
|
115
|
+
bitstringStatusList?: UpdateBitstringStatusListArgs;
|
|
58
116
|
}
|
|
59
117
|
interface UpdateStatusListFromStatusListCredentialArgs {
|
|
60
118
|
statusListCredential: StatusListCredential;
|
|
@@ -63,27 +121,32 @@ interface UpdateStatusListFromStatusListCredentialArgs {
|
|
|
63
121
|
value: number | Status2021 | StatusOAuth;
|
|
64
122
|
}
|
|
65
123
|
interface StatusListResult {
|
|
124
|
+
id: string;
|
|
66
125
|
encodedList: string;
|
|
67
|
-
|
|
68
|
-
length: number;
|
|
126
|
+
issuer: string | IIssuer;
|
|
69
127
|
type: StatusListType;
|
|
70
128
|
proofFormat: CredentialProofFormat;
|
|
71
|
-
|
|
129
|
+
length: number;
|
|
130
|
+
statusListCredential: StatusListCredential;
|
|
72
131
|
statuslistContentType: string;
|
|
73
|
-
issuer: string | IIssuer;
|
|
74
|
-
statusList2021?: StatusList2021Details;
|
|
75
|
-
oauthStatusList?: OAuthStatusDetails;
|
|
76
132
|
correlationId?: string;
|
|
77
133
|
driverType?: StatusListDriverType;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
134
|
+
statusList2021?: {
|
|
135
|
+
indexingDirection: StatusListIndexingDirection;
|
|
136
|
+
statusPurpose: StatusPurpose2021;
|
|
137
|
+
credentialIdMode: StatusListCredentialIdMode;
|
|
138
|
+
};
|
|
139
|
+
oauthStatusList?: {
|
|
140
|
+
bitsPerStatus: number;
|
|
141
|
+
expiresAt?: Date;
|
|
142
|
+
};
|
|
143
|
+
bitstringStatusList?: {
|
|
144
|
+
statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[];
|
|
145
|
+
bitsPerStatus?: number;
|
|
146
|
+
validFrom?: Date;
|
|
147
|
+
validUntil?: Date;
|
|
148
|
+
ttl?: number;
|
|
149
|
+
};
|
|
87
150
|
}
|
|
88
151
|
interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
|
|
89
152
|
type: 'StatusList2021Entry';
|
|
@@ -116,23 +179,32 @@ interface CreateStatusListArgs {
|
|
|
116
179
|
length?: number;
|
|
117
180
|
statusList2021?: StatusList2021Args;
|
|
118
181
|
oauthStatusList?: OAuthStatusListArgs;
|
|
182
|
+
bitstringStatusList?: BitstringStatusListArgs;
|
|
119
183
|
}
|
|
120
184
|
interface UpdateStatusListIndexArgs {
|
|
121
185
|
statusListCredential: StatusListCredential;
|
|
122
186
|
statusListIndex: number | string;
|
|
123
187
|
value: number | Status2021 | StatusOAuth;
|
|
188
|
+
bitsPerStatus?: number;
|
|
124
189
|
keyRef?: string;
|
|
125
190
|
expiresAt?: Date;
|
|
126
191
|
}
|
|
127
192
|
interface CheckStatusIndexArgs {
|
|
128
193
|
statusListCredential: StatusListCredential;
|
|
129
194
|
statusListIndex: string | number;
|
|
195
|
+
bitsPerStatus?: number;
|
|
130
196
|
}
|
|
131
|
-
interface
|
|
132
|
-
|
|
197
|
+
interface IToDetailsFromCredentialArgs {
|
|
198
|
+
statusListCredential: StatusListCredential;
|
|
199
|
+
statusListType: StatusListType;
|
|
200
|
+
bitsPerStatus?: number;
|
|
133
201
|
correlationId?: string;
|
|
134
202
|
driverType?: StatusListDriverType;
|
|
135
203
|
}
|
|
204
|
+
interface IMergeDetailsWithEntityArgs {
|
|
205
|
+
extractedDetails: IExtractedCredentialDetails;
|
|
206
|
+
statusListEntity: IStatusListEntity;
|
|
207
|
+
}
|
|
136
208
|
/**
|
|
137
209
|
* The interface definition for a plugin that can add statuslist info to a credential
|
|
138
210
|
*
|
|
@@ -205,12 +277,22 @@ type SignedStatusListData = {
|
|
|
205
277
|
statusListCredential: StatusListCredential;
|
|
206
278
|
encodedList: string;
|
|
207
279
|
};
|
|
208
|
-
type IRequiredPlugins =
|
|
209
|
-
type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution & IKeyManager &
|
|
280
|
+
type IRequiredPlugins = IVcdmCredentialPlugin & IIdentifierResolution;
|
|
281
|
+
type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution & IKeyManager & IVcdmCredentialPlugin>;
|
|
210
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Fetches a status list credential from a URL
|
|
285
|
+
* @param args - Object containing the status list credential URL
|
|
286
|
+
* @returns Promise resolving to the fetched StatusListCredential
|
|
287
|
+
*/
|
|
211
288
|
declare function fetchStatusListCredential(args: {
|
|
212
289
|
statusListCredential: string;
|
|
213
290
|
}): Promise<StatusListCredential>;
|
|
291
|
+
/**
|
|
292
|
+
* Creates a status checking function for credential-status plugin
|
|
293
|
+
* @param args - Configuration options for status verification
|
|
294
|
+
* @returns StatusMethod function for checking credential status
|
|
295
|
+
*/
|
|
214
296
|
declare function statusPluginStatusFunction(args: {
|
|
215
297
|
documentLoader: any;
|
|
216
298
|
suite: any;
|
|
@@ -221,7 +303,8 @@ declare function statusPluginStatusFunction(args: {
|
|
|
221
303
|
}): StatusMethod;
|
|
222
304
|
/**
|
|
223
305
|
* Function that can be used together with @digitalbazar/vc and @digitialcredentials/vc
|
|
224
|
-
* @param args
|
|
306
|
+
* @param args - Configuration options for status verification
|
|
307
|
+
* @returns Function for checking credential status
|
|
225
308
|
*/
|
|
226
309
|
declare function vcLibCheckStatusFunction(args: {
|
|
227
310
|
mandatoryCredentialStatus?: boolean;
|
|
@@ -236,6 +319,11 @@ declare function vcLibCheckStatusFunction(args: {
|
|
|
236
319
|
verified: boolean;
|
|
237
320
|
error?: any;
|
|
238
321
|
}>;
|
|
322
|
+
/**
|
|
323
|
+
* Checks the status of a credential using its credential status information
|
|
324
|
+
* @param args - Parameters for credential status verification
|
|
325
|
+
* @returns Promise resolving to verification result with error details if any
|
|
326
|
+
*/
|
|
239
327
|
declare function checkStatusForCredential(args: {
|
|
240
328
|
credential: StatusListCredential;
|
|
241
329
|
documentLoader: any;
|
|
@@ -255,21 +343,60 @@ declare function simpleCheckStatusFromStatusListUrl(args: {
|
|
|
255
343
|
id?: string;
|
|
256
344
|
statusListIndex: string;
|
|
257
345
|
}): Promise<number | Status2021 | StatusOAuth>;
|
|
346
|
+
/**
|
|
347
|
+
* Checks the status at a specific index in a status list credential
|
|
348
|
+
* @param args - Parameters including credential and index to check
|
|
349
|
+
* @returns Promise resolving to status value at the specified index
|
|
350
|
+
*/
|
|
258
351
|
declare function checkStatusIndexFromStatusListCredential(args: {
|
|
259
352
|
statusListCredential: StatusListCredential;
|
|
260
|
-
statusPurpose?: StatusPurpose2021;
|
|
261
|
-
type?: StatusListType | 'StatusList2021Entry';
|
|
353
|
+
statusPurpose?: StatusPurpose2021 | string | string[];
|
|
354
|
+
type?: StatusListType | 'StatusList2021Entry' | 'BitstringStatusListEntry';
|
|
262
355
|
id?: string;
|
|
263
356
|
statusListIndex: string | number;
|
|
357
|
+
bitsPerStatus?: number;
|
|
264
358
|
}): Promise<number | Status2021 | StatusOAuth>;
|
|
265
|
-
declare function createNewStatusList(args: CreateNewStatusListFuncArgs, context: IAgentContext<(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
declare function
|
|
273
|
-
|
|
359
|
+
declare function createNewStatusList(args: CreateNewStatusListFuncArgs, context: IAgentContext<(IVcdmCredentialPlugin | any) & IIdentifierResolution>): Promise<StatusListResult>;
|
|
360
|
+
/**
|
|
361
|
+
* Updates a status index in a status list credential
|
|
362
|
+
* @param args - Parameters for status update including credential and new value
|
|
363
|
+
* @param context - Agent context with required plugins
|
|
364
|
+
* @returns Promise resolving to updated status list details
|
|
365
|
+
*/
|
|
366
|
+
declare function updateStatusIndexFromStatusListCredential(args: UpdateStatusListIndexArgs, context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
367
|
+
/**
|
|
368
|
+
* Extracts credential details from a status list credential
|
|
369
|
+
* @param statusListCredential - The status list credential to extract from
|
|
370
|
+
* @returns Promise resolving to extracted credential details
|
|
371
|
+
*/
|
|
372
|
+
declare function extractCredentialDetails(statusListCredential: StatusListCredential): Promise<IExtractedCredentialDetails>;
|
|
373
|
+
declare function toStatusListDetails(args: IToDetailsFromCredentialArgs): Promise<StatusListResult & (IStatusList2021ImplementationResult | IOAuthStatusListImplementationResult | IBitstringStatusListImplementationResult)>;
|
|
374
|
+
declare function toStatusListDetails(args: IMergeDetailsWithEntityArgs): Promise<StatusListResult & (IStatusList2021ImplementationResult | IOAuthStatusListImplementationResult | IBitstringStatusListImplementationResult)>;
|
|
375
|
+
/**
|
|
376
|
+
* Creates a credential status object from status list and entry information
|
|
377
|
+
* @param args - Parameters including status list, entry, and index
|
|
378
|
+
* @returns Promise resolving to appropriate credential status type
|
|
379
|
+
*/
|
|
380
|
+
declare function createCredentialStatusFromStatusList(args: {
|
|
381
|
+
statusList: StatusListEntity;
|
|
382
|
+
statusListEntry: IStatusListEntryEntity | IBitstringStatusListEntryEntity;
|
|
383
|
+
statusListIndex: number;
|
|
384
|
+
}): Promise<StatusList2021EntryCredentialStatus | StatusListOAuthEntryCredentialStatus | BitstringStatusListEntryCredentialStatus>;
|
|
385
|
+
/**
|
|
386
|
+
* Updates a status list using a base64 encoded list of statuses
|
|
387
|
+
* @param args - Parameters including encoded list and update details
|
|
388
|
+
* @param context - Agent context with required plugins
|
|
389
|
+
* @returns Promise resolving to updated status list details
|
|
390
|
+
*/
|
|
391
|
+
declare function updateStatusListIndexFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
392
|
+
/**
|
|
393
|
+
* Converts a StatusList2021 to a verifiable credential
|
|
394
|
+
* @param args - Parameters for credential creation including issuer and encoded list
|
|
395
|
+
* @param context - Agent context with required plugins
|
|
396
|
+
* @returns Promise resolving to signed status list credential
|
|
397
|
+
*/
|
|
398
|
+
declare function statusList2021ToVerifiableCredential(args: StatusList2021ToVerifiableCredentialArgs, context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>): Promise<StatusListCredential>;
|
|
399
|
+
|
|
400
|
+
declare function determineStatusListType(credential: StatusListCredential): StatusListType;
|
|
274
401
|
|
|
275
|
-
export { type BaseCreateNewStatusListArgs, type CheckStatusIndexArgs, type CreateNewStatusListArgs, type CreateNewStatusListFuncArgs, type CreateStatusListArgs, type CredentialWithStatusSupport, type GetStatusListArgs, type IAddStatusToCredentialArgs, type IAddStatusToSdJwtCredentialArgs, type IIssueCredentialStatusOpts, type IRequiredContext, type IRequiredPlugins, type IStatusListPlugin, type OAuthStatusListArgs, type SignedStatusListData, Status2021, type StatusList2021Args, type StatusList2021EntryCredentialStatus, type StatusList2021ToVerifiableCredentialArgs, type StatusListOAuthEntryCredentialStatus, type StatusListResult, StatusOAuth, type
|
|
402
|
+
export { type BaseCreateNewStatusListArgs, type CheckStatusIndexArgs, type CreateNewStatusListArgs, type CreateNewStatusListFuncArgs, type CreateStatusListArgs, type CredentialWithStatusSupport, type GetStatusListArgs, type IAddStatusToCredentialArgs, type IAddStatusToSdJwtCredentialArgs, type IIssueCredentialStatusOpts, type IMergeDetailsWithEntityArgs, type IRequiredContext, type IRequiredPlugins, type IStatusListPlugin, type IToDetailsFromCredentialArgs, type OAuthStatusListArgs, type SignedStatusListData, Status2021, type StatusList2021Args, type StatusList2021EntryCredentialStatus, type StatusList2021ToVerifiableCredentialArgs, type StatusListOAuthEntryCredentialStatus, type StatusListResult, StatusOAuth, type UpdateBitstringStatusListArgs, type UpdateOAuthStatusListArgs, type UpdateStatusList2021Args, type UpdateStatusListFromEncodedListArgs, type UpdateStatusListFromStatusListCredentialArgs, type UpdateStatusListIndexArgs, checkStatusForCredential, checkStatusIndexFromStatusListCredential, createCredentialStatusFromStatusList, createNewStatusList, determineStatusListType, extractCredentialDetails, fetchStatusListCredential, simpleCheckStatusFromStatusListUrl, statusList2021ToVerifiableCredential, statusPluginStatusFunction, toStatusListDetails, updateStatusIndexFromStatusListCredential, updateStatusListIndexFromEncodedList, vcLibCheckStatusFunction };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,61 @@
|
|
|
1
1
|
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
2
|
-
import {
|
|
3
|
-
import { IPluginMethodMap, IAgentContext, ICredentialIssuer, ICredentialVerifier, IKeyManager,
|
|
2
|
+
import { IIssuer, StatusListType, CredentialProofFormat, StatusListCredential, StatusListDriverType, StatusListIndexingDirection, StatusPurpose2021, StatusListCredentialIdMode, ICredentialStatus, OrPromise, ICredential, IVerifiableCredential } from '@sphereon/ssi-types';
|
|
3
|
+
import { IPluginMethodMap, IAgentContext, ICredentialIssuer, ICredentialVerifier, IKeyManager, CredentialPayload } from '@veramo/core';
|
|
4
4
|
import { DataSource } from 'typeorm';
|
|
5
|
-
import { BitsPerStatus } from '@sd-jwt/jwt-status-list';
|
|
5
|
+
import { StatusList, BitsPerStatus } from '@sd-jwt/jwt-status-list';
|
|
6
6
|
import { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc';
|
|
7
7
|
import { StatusListOpts } from '@sphereon/oid4vci-common';
|
|
8
|
+
import { BitstringStatusPurpose } from '@4sure-tech/vc-bitstring-status-lists';
|
|
9
|
+
import { IVcdmCredentialPlugin } from '@sphereon/ssi-sdk.credential-vcdm';
|
|
10
|
+
import { BitstringStatusListArgs, IStatusListEntity, StatusListEntity, IStatusListEntryEntity, IBitstringStatusListEntryEntity, BitstringStatusListEntryCredentialStatus } from '@sphereon/ssi-sdk.data-store';
|
|
8
11
|
import { StatusMethod } from 'credential-status';
|
|
9
12
|
|
|
13
|
+
interface DecodedStatusListPayload {
|
|
14
|
+
issuer: string;
|
|
15
|
+
id: string;
|
|
16
|
+
statusList: StatusList;
|
|
17
|
+
exp?: number;
|
|
18
|
+
ttl?: number;
|
|
19
|
+
iat: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface IExtractedCredentialDetails {
|
|
23
|
+
id: string;
|
|
24
|
+
issuer: string | IIssuer;
|
|
25
|
+
encodedList: string;
|
|
26
|
+
decodedPayload?: DecodedStatusListPayload;
|
|
27
|
+
}
|
|
28
|
+
interface IStatusListImplementationResult {
|
|
29
|
+
id: string;
|
|
30
|
+
encodedList: string;
|
|
31
|
+
issuer: string | IIssuer;
|
|
32
|
+
type: StatusListType;
|
|
33
|
+
proofFormat: CredentialProofFormat;
|
|
34
|
+
length: number;
|
|
35
|
+
statusListCredential: StatusListCredential;
|
|
36
|
+
statuslistContentType: string;
|
|
37
|
+
correlationId?: string;
|
|
38
|
+
driverType?: StatusListDriverType;
|
|
39
|
+
}
|
|
40
|
+
interface IStatusList2021ImplementationResult extends IStatusListImplementationResult {
|
|
41
|
+
type: StatusListType.StatusList2021;
|
|
42
|
+
indexingDirection: StatusListIndexingDirection;
|
|
43
|
+
statusPurpose: StatusPurpose2021;
|
|
44
|
+
}
|
|
45
|
+
interface IOAuthStatusListImplementationResult extends IStatusListImplementationResult {
|
|
46
|
+
type: StatusListType.OAuthStatusList;
|
|
47
|
+
bitsPerStatus: number;
|
|
48
|
+
expiresAt?: Date;
|
|
49
|
+
}
|
|
50
|
+
interface IBitstringStatusListImplementationResult extends IStatusListImplementationResult {
|
|
51
|
+
type: StatusListType.BitstringStatusList;
|
|
52
|
+
statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[];
|
|
53
|
+
bitsPerStatus?: number;
|
|
54
|
+
validFrom?: Date;
|
|
55
|
+
validUntil?: Date;
|
|
56
|
+
ttl?: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
10
59
|
declare enum StatusOAuth {
|
|
11
60
|
Valid = 0,
|
|
12
61
|
Invalid = 1,
|
|
@@ -21,7 +70,7 @@ type StatusList2021Args = {
|
|
|
21
70
|
statusPurpose?: StatusPurpose2021;
|
|
22
71
|
};
|
|
23
72
|
type OAuthStatusListArgs = {
|
|
24
|
-
bitsPerStatus
|
|
73
|
+
bitsPerStatus: BitsPerStatus;
|
|
25
74
|
expiresAt?: Date;
|
|
26
75
|
};
|
|
27
76
|
type BaseCreateNewStatusListArgs = {
|
|
@@ -34,6 +83,7 @@ type BaseCreateNewStatusListArgs = {
|
|
|
34
83
|
keyRef?: string;
|
|
35
84
|
statusList2021?: StatusList2021Args;
|
|
36
85
|
oauthStatusList?: OAuthStatusListArgs;
|
|
86
|
+
bitstringStatusList?: BitstringStatusListArgs;
|
|
37
87
|
driverType?: StatusListDriverType;
|
|
38
88
|
};
|
|
39
89
|
type UpdateStatusList2021Args = {
|
|
@@ -43,10 +93,17 @@ type UpdateOAuthStatusListArgs = {
|
|
|
43
93
|
bitsPerStatus: BitsPerStatus;
|
|
44
94
|
expiresAt?: Date;
|
|
45
95
|
};
|
|
96
|
+
type UpdateBitstringStatusListArgs = {
|
|
97
|
+
statusPurpose: BitstringStatusPurpose;
|
|
98
|
+
bitsPerStatus: number;
|
|
99
|
+
validFrom?: Date;
|
|
100
|
+
validUntil?: Date;
|
|
101
|
+
ttl?: number;
|
|
102
|
+
};
|
|
46
103
|
interface UpdateStatusListFromEncodedListArgs {
|
|
47
104
|
type?: StatusListType;
|
|
48
105
|
statusListIndex: number | string;
|
|
49
|
-
value:
|
|
106
|
+
value: number;
|
|
50
107
|
proofFormat?: CredentialProofFormat;
|
|
51
108
|
keyRef?: string;
|
|
52
109
|
correlationId?: string;
|
|
@@ -55,6 +112,7 @@ interface UpdateStatusListFromEncodedListArgs {
|
|
|
55
112
|
id: string;
|
|
56
113
|
statusList2021?: UpdateStatusList2021Args;
|
|
57
114
|
oauthStatusList?: UpdateOAuthStatusListArgs;
|
|
115
|
+
bitstringStatusList?: UpdateBitstringStatusListArgs;
|
|
58
116
|
}
|
|
59
117
|
interface UpdateStatusListFromStatusListCredentialArgs {
|
|
60
118
|
statusListCredential: StatusListCredential;
|
|
@@ -63,27 +121,32 @@ interface UpdateStatusListFromStatusListCredentialArgs {
|
|
|
63
121
|
value: number | Status2021 | StatusOAuth;
|
|
64
122
|
}
|
|
65
123
|
interface StatusListResult {
|
|
124
|
+
id: string;
|
|
66
125
|
encodedList: string;
|
|
67
|
-
|
|
68
|
-
length: number;
|
|
126
|
+
issuer: string | IIssuer;
|
|
69
127
|
type: StatusListType;
|
|
70
128
|
proofFormat: CredentialProofFormat;
|
|
71
|
-
|
|
129
|
+
length: number;
|
|
130
|
+
statusListCredential: StatusListCredential;
|
|
72
131
|
statuslistContentType: string;
|
|
73
|
-
issuer: string | IIssuer;
|
|
74
|
-
statusList2021?: StatusList2021Details;
|
|
75
|
-
oauthStatusList?: OAuthStatusDetails;
|
|
76
132
|
correlationId?: string;
|
|
77
133
|
driverType?: StatusListDriverType;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
134
|
+
statusList2021?: {
|
|
135
|
+
indexingDirection: StatusListIndexingDirection;
|
|
136
|
+
statusPurpose: StatusPurpose2021;
|
|
137
|
+
credentialIdMode: StatusListCredentialIdMode;
|
|
138
|
+
};
|
|
139
|
+
oauthStatusList?: {
|
|
140
|
+
bitsPerStatus: number;
|
|
141
|
+
expiresAt?: Date;
|
|
142
|
+
};
|
|
143
|
+
bitstringStatusList?: {
|
|
144
|
+
statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[];
|
|
145
|
+
bitsPerStatus?: number;
|
|
146
|
+
validFrom?: Date;
|
|
147
|
+
validUntil?: Date;
|
|
148
|
+
ttl?: number;
|
|
149
|
+
};
|
|
87
150
|
}
|
|
88
151
|
interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
|
|
89
152
|
type: 'StatusList2021Entry';
|
|
@@ -116,23 +179,32 @@ interface CreateStatusListArgs {
|
|
|
116
179
|
length?: number;
|
|
117
180
|
statusList2021?: StatusList2021Args;
|
|
118
181
|
oauthStatusList?: OAuthStatusListArgs;
|
|
182
|
+
bitstringStatusList?: BitstringStatusListArgs;
|
|
119
183
|
}
|
|
120
184
|
interface UpdateStatusListIndexArgs {
|
|
121
185
|
statusListCredential: StatusListCredential;
|
|
122
186
|
statusListIndex: number | string;
|
|
123
187
|
value: number | Status2021 | StatusOAuth;
|
|
188
|
+
bitsPerStatus?: number;
|
|
124
189
|
keyRef?: string;
|
|
125
190
|
expiresAt?: Date;
|
|
126
191
|
}
|
|
127
192
|
interface CheckStatusIndexArgs {
|
|
128
193
|
statusListCredential: StatusListCredential;
|
|
129
194
|
statusListIndex: string | number;
|
|
195
|
+
bitsPerStatus?: number;
|
|
130
196
|
}
|
|
131
|
-
interface
|
|
132
|
-
|
|
197
|
+
interface IToDetailsFromCredentialArgs {
|
|
198
|
+
statusListCredential: StatusListCredential;
|
|
199
|
+
statusListType: StatusListType;
|
|
200
|
+
bitsPerStatus?: number;
|
|
133
201
|
correlationId?: string;
|
|
134
202
|
driverType?: StatusListDriverType;
|
|
135
203
|
}
|
|
204
|
+
interface IMergeDetailsWithEntityArgs {
|
|
205
|
+
extractedDetails: IExtractedCredentialDetails;
|
|
206
|
+
statusListEntity: IStatusListEntity;
|
|
207
|
+
}
|
|
136
208
|
/**
|
|
137
209
|
* The interface definition for a plugin that can add statuslist info to a credential
|
|
138
210
|
*
|
|
@@ -205,12 +277,22 @@ type SignedStatusListData = {
|
|
|
205
277
|
statusListCredential: StatusListCredential;
|
|
206
278
|
encodedList: string;
|
|
207
279
|
};
|
|
208
|
-
type IRequiredPlugins =
|
|
209
|
-
type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution & IKeyManager &
|
|
280
|
+
type IRequiredPlugins = IVcdmCredentialPlugin & IIdentifierResolution;
|
|
281
|
+
type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution & IKeyManager & IVcdmCredentialPlugin>;
|
|
210
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Fetches a status list credential from a URL
|
|
285
|
+
* @param args - Object containing the status list credential URL
|
|
286
|
+
* @returns Promise resolving to the fetched StatusListCredential
|
|
287
|
+
*/
|
|
211
288
|
declare function fetchStatusListCredential(args: {
|
|
212
289
|
statusListCredential: string;
|
|
213
290
|
}): Promise<StatusListCredential>;
|
|
291
|
+
/**
|
|
292
|
+
* Creates a status checking function for credential-status plugin
|
|
293
|
+
* @param args - Configuration options for status verification
|
|
294
|
+
* @returns StatusMethod function for checking credential status
|
|
295
|
+
*/
|
|
214
296
|
declare function statusPluginStatusFunction(args: {
|
|
215
297
|
documentLoader: any;
|
|
216
298
|
suite: any;
|
|
@@ -221,7 +303,8 @@ declare function statusPluginStatusFunction(args: {
|
|
|
221
303
|
}): StatusMethod;
|
|
222
304
|
/**
|
|
223
305
|
* Function that can be used together with @digitalbazar/vc and @digitialcredentials/vc
|
|
224
|
-
* @param args
|
|
306
|
+
* @param args - Configuration options for status verification
|
|
307
|
+
* @returns Function for checking credential status
|
|
225
308
|
*/
|
|
226
309
|
declare function vcLibCheckStatusFunction(args: {
|
|
227
310
|
mandatoryCredentialStatus?: boolean;
|
|
@@ -236,6 +319,11 @@ declare function vcLibCheckStatusFunction(args: {
|
|
|
236
319
|
verified: boolean;
|
|
237
320
|
error?: any;
|
|
238
321
|
}>;
|
|
322
|
+
/**
|
|
323
|
+
* Checks the status of a credential using its credential status information
|
|
324
|
+
* @param args - Parameters for credential status verification
|
|
325
|
+
* @returns Promise resolving to verification result with error details if any
|
|
326
|
+
*/
|
|
239
327
|
declare function checkStatusForCredential(args: {
|
|
240
328
|
credential: StatusListCredential;
|
|
241
329
|
documentLoader: any;
|
|
@@ -255,21 +343,60 @@ declare function simpleCheckStatusFromStatusListUrl(args: {
|
|
|
255
343
|
id?: string;
|
|
256
344
|
statusListIndex: string;
|
|
257
345
|
}): Promise<number | Status2021 | StatusOAuth>;
|
|
346
|
+
/**
|
|
347
|
+
* Checks the status at a specific index in a status list credential
|
|
348
|
+
* @param args - Parameters including credential and index to check
|
|
349
|
+
* @returns Promise resolving to status value at the specified index
|
|
350
|
+
*/
|
|
258
351
|
declare function checkStatusIndexFromStatusListCredential(args: {
|
|
259
352
|
statusListCredential: StatusListCredential;
|
|
260
|
-
statusPurpose?: StatusPurpose2021;
|
|
261
|
-
type?: StatusListType | 'StatusList2021Entry';
|
|
353
|
+
statusPurpose?: StatusPurpose2021 | string | string[];
|
|
354
|
+
type?: StatusListType | 'StatusList2021Entry' | 'BitstringStatusListEntry';
|
|
262
355
|
id?: string;
|
|
263
356
|
statusListIndex: string | number;
|
|
357
|
+
bitsPerStatus?: number;
|
|
264
358
|
}): Promise<number | Status2021 | StatusOAuth>;
|
|
265
|
-
declare function createNewStatusList(args: CreateNewStatusListFuncArgs, context: IAgentContext<(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
declare function
|
|
273
|
-
|
|
359
|
+
declare function createNewStatusList(args: CreateNewStatusListFuncArgs, context: IAgentContext<(IVcdmCredentialPlugin | any) & IIdentifierResolution>): Promise<StatusListResult>;
|
|
360
|
+
/**
|
|
361
|
+
* Updates a status index in a status list credential
|
|
362
|
+
* @param args - Parameters for status update including credential and new value
|
|
363
|
+
* @param context - Agent context with required plugins
|
|
364
|
+
* @returns Promise resolving to updated status list details
|
|
365
|
+
*/
|
|
366
|
+
declare function updateStatusIndexFromStatusListCredential(args: UpdateStatusListIndexArgs, context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
367
|
+
/**
|
|
368
|
+
* Extracts credential details from a status list credential
|
|
369
|
+
* @param statusListCredential - The status list credential to extract from
|
|
370
|
+
* @returns Promise resolving to extracted credential details
|
|
371
|
+
*/
|
|
372
|
+
declare function extractCredentialDetails(statusListCredential: StatusListCredential): Promise<IExtractedCredentialDetails>;
|
|
373
|
+
declare function toStatusListDetails(args: IToDetailsFromCredentialArgs): Promise<StatusListResult & (IStatusList2021ImplementationResult | IOAuthStatusListImplementationResult | IBitstringStatusListImplementationResult)>;
|
|
374
|
+
declare function toStatusListDetails(args: IMergeDetailsWithEntityArgs): Promise<StatusListResult & (IStatusList2021ImplementationResult | IOAuthStatusListImplementationResult | IBitstringStatusListImplementationResult)>;
|
|
375
|
+
/**
|
|
376
|
+
* Creates a credential status object from status list and entry information
|
|
377
|
+
* @param args - Parameters including status list, entry, and index
|
|
378
|
+
* @returns Promise resolving to appropriate credential status type
|
|
379
|
+
*/
|
|
380
|
+
declare function createCredentialStatusFromStatusList(args: {
|
|
381
|
+
statusList: StatusListEntity;
|
|
382
|
+
statusListEntry: IStatusListEntryEntity | IBitstringStatusListEntryEntity;
|
|
383
|
+
statusListIndex: number;
|
|
384
|
+
}): Promise<StatusList2021EntryCredentialStatus | StatusListOAuthEntryCredentialStatus | BitstringStatusListEntryCredentialStatus>;
|
|
385
|
+
/**
|
|
386
|
+
* Updates a status list using a base64 encoded list of statuses
|
|
387
|
+
* @param args - Parameters including encoded list and update details
|
|
388
|
+
* @param context - Agent context with required plugins
|
|
389
|
+
* @returns Promise resolving to updated status list details
|
|
390
|
+
*/
|
|
391
|
+
declare function updateStatusListIndexFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
392
|
+
/**
|
|
393
|
+
* Converts a StatusList2021 to a verifiable credential
|
|
394
|
+
* @param args - Parameters for credential creation including issuer and encoded list
|
|
395
|
+
* @param context - Agent context with required plugins
|
|
396
|
+
* @returns Promise resolving to signed status list credential
|
|
397
|
+
*/
|
|
398
|
+
declare function statusList2021ToVerifiableCredential(args: StatusList2021ToVerifiableCredentialArgs, context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>): Promise<StatusListCredential>;
|
|
399
|
+
|
|
400
|
+
declare function determineStatusListType(credential: StatusListCredential): StatusListType;
|
|
274
401
|
|
|
275
|
-
export { type BaseCreateNewStatusListArgs, type CheckStatusIndexArgs, type CreateNewStatusListArgs, type CreateNewStatusListFuncArgs, type CreateStatusListArgs, type CredentialWithStatusSupport, type GetStatusListArgs, type IAddStatusToCredentialArgs, type IAddStatusToSdJwtCredentialArgs, type IIssueCredentialStatusOpts, type IRequiredContext, type IRequiredPlugins, type IStatusListPlugin, type OAuthStatusListArgs, type SignedStatusListData, Status2021, type StatusList2021Args, type StatusList2021EntryCredentialStatus, type StatusList2021ToVerifiableCredentialArgs, type StatusListOAuthEntryCredentialStatus, type StatusListResult, StatusOAuth, type
|
|
402
|
+
export { type BaseCreateNewStatusListArgs, type CheckStatusIndexArgs, type CreateNewStatusListArgs, type CreateNewStatusListFuncArgs, type CreateStatusListArgs, type CredentialWithStatusSupport, type GetStatusListArgs, type IAddStatusToCredentialArgs, type IAddStatusToSdJwtCredentialArgs, type IIssueCredentialStatusOpts, type IMergeDetailsWithEntityArgs, type IRequiredContext, type IRequiredPlugins, type IStatusListPlugin, type IToDetailsFromCredentialArgs, type OAuthStatusListArgs, type SignedStatusListData, Status2021, type StatusList2021Args, type StatusList2021EntryCredentialStatus, type StatusList2021ToVerifiableCredentialArgs, type StatusListOAuthEntryCredentialStatus, type StatusListResult, StatusOAuth, type UpdateBitstringStatusListArgs, type UpdateOAuthStatusListArgs, type UpdateStatusList2021Args, type UpdateStatusListFromEncodedListArgs, type UpdateStatusListFromStatusListCredentialArgs, type UpdateStatusListIndexArgs, checkStatusForCredential, checkStatusIndexFromStatusListCredential, createCredentialStatusFromStatusList, createNewStatusList, determineStatusListType, extractCredentialDetails, fetchStatusListCredential, simpleCheckStatusFromStatusListUrl, statusList2021ToVerifiableCredential, statusPluginStatusFunction, toStatusListDetails, updateStatusIndexFromStatusListCredential, updateStatusListIndexFromEncodedList, vcLibCheckStatusFunction };
|