@sphereon/ssi-sdk.vc-status-list 0.34.1-feature.SSISDK.17.bitstring.sl.2 → 0.34.1-feature.SSISDK.17.bitstring.sl.24

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.d.cts CHANGED
@@ -1,12 +1,61 @@
1
1
  import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
2
- import { StatusListIndexingDirection, StatusPurpose2021, BitstringStatusPurpose, StatusListType, IIssuer, CredentialProofFormat, StatusListDriverType, StatusListCredential, StatusListCredentialIdMode, ICredentialStatus, OrPromise, ICredential, IVerifiableCredential } from '@sphereon/ssi-types';
3
- import { IPluginMethodMap, IAgentContext, ICredentialIssuer, ICredentialVerifier, IKeyManager, ICredentialPlugin, CredentialPayload } from '@veramo/core';
2
+ import { IIssuer, StatusListType, CredentialProofFormat, StatusListCredential, StatusListDriverType, StatusListIndexingDirection, StatusPurpose2021, 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,
@@ -16,34 +65,14 @@ declare enum Status2021 {
16
65
  Valid = 0,
17
66
  Invalid = 1
18
67
  }
19
- type BitstringStatus = {
20
- status: string;
21
- message?: string;
22
- [x: string]: any;
23
- };
24
- type BitstringStatusResult = BitstringStatus & {
25
- index: number;
26
- status: string;
27
- set: boolean;
28
- message?: string;
29
- [x: string]: any;
30
- };
31
68
  type StatusList2021Args = {
32
69
  indexingDirection: StatusListIndexingDirection;
33
70
  statusPurpose?: StatusPurpose2021;
34
71
  };
35
72
  type OAuthStatusListArgs = {
36
- bitsPerStatus?: BitsPerStatus;
73
+ bitsPerStatus: BitsPerStatus;
37
74
  expiresAt?: Date;
38
75
  };
39
- type BitstringStatusListArgs = {
40
- statusPurpose: BitstringStatusPurpose;
41
- statusSize?: number;
42
- statusMessage?: Array<BitstringStatus>;
43
- ttl?: number;
44
- validFrom?: Date;
45
- validUntil?: Date;
46
- };
47
76
  type BaseCreateNewStatusListArgs = {
48
77
  type: StatusListType;
49
78
  id: string;
@@ -54,6 +83,7 @@ type BaseCreateNewStatusListArgs = {
54
83
  keyRef?: string;
55
84
  statusList2021?: StatusList2021Args;
56
85
  oauthStatusList?: OAuthStatusListArgs;
86
+ bitstringStatusList?: BitstringStatusListArgs;
57
87
  driverType?: StatusListDriverType;
58
88
  };
59
89
  type UpdateStatusList2021Args = {
@@ -65,8 +95,7 @@ type UpdateOAuthStatusListArgs = {
65
95
  };
66
96
  type UpdateBitstringStatusListArgs = {
67
97
  statusPurpose: BitstringStatusPurpose;
68
- statusSize?: number;
69
- statusMessage?: Array<BitstringStatus>;
98
+ bitsPerStatus: number;
70
99
  validFrom?: Date;
71
100
  validUntil?: Date;
72
101
  ttl?: number;
@@ -74,7 +103,7 @@ type UpdateBitstringStatusListArgs = {
74
103
  interface UpdateStatusListFromEncodedListArgs {
75
104
  type?: StatusListType;
76
105
  statusListIndex: number | string;
77
- value: boolean;
106
+ value: number;
78
107
  proofFormat?: CredentialProofFormat;
79
108
  keyRef?: string;
80
109
  correlationId?: string;
@@ -89,37 +118,34 @@ interface UpdateStatusListFromStatusListCredentialArgs {
89
118
  statusListCredential: StatusListCredential;
90
119
  keyRef?: string;
91
120
  statusListIndex: number | string;
92
- value: number | Status2021 | StatusOAuth | BitstringStatus;
121
+ value: number | Status2021 | StatusOAuth;
93
122
  }
94
123
  interface StatusListResult {
124
+ id: string;
95
125
  encodedList: string;
96
- statusListCredential: StatusListCredential;
97
- length: number;
126
+ issuer: string | IIssuer;
98
127
  type: StatusListType;
99
128
  proofFormat: CredentialProofFormat;
100
- id: string;
129
+ length: number;
130
+ statusListCredential: StatusListCredential;
101
131
  statuslistContentType: string;
102
- issuer: string | IIssuer;
103
- statusList2021?: StatusList2021Details;
104
- oauthStatusList?: OAuthStatusDetails;
105
- bitstringStatusList?: BitstringStatusDetails;
106
132
  correlationId?: string;
107
133
  driverType?: StatusListDriverType;
108
- credentialIdMode?: StatusListCredentialIdMode;
109
- }
110
- interface StatusList2021Details {
111
- indexingDirection: StatusListIndexingDirection;
112
- statusPurpose?: StatusPurpose2021;
113
- }
114
- interface OAuthStatusDetails {
115
- bitsPerStatus?: BitsPerStatus;
116
- expiresAt?: Date;
117
- }
118
- interface BitstringStatusDetails {
119
- statusPurpose: BitstringStatusPurpose;
120
- validFrom?: Date;
121
- validUntil?: Date;
122
- ttl?: number;
134
+ statusList2021?: {
135
+ indexingDirection: StatusListIndexingDirection;
136
+ statusPurpose: StatusPurpose2021;
137
+ };
138
+ oauthStatusList?: {
139
+ bitsPerStatus: number;
140
+ expiresAt?: Date;
141
+ };
142
+ bitstringStatusList?: {
143
+ statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[];
144
+ bitsPerStatus?: number;
145
+ validFrom?: Date;
146
+ validUntil?: Date;
147
+ ttl?: number;
148
+ };
123
149
  }
124
150
  interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
125
151
  type: 'StatusList2021Entry';
@@ -134,15 +160,6 @@ interface StatusListOAuthEntryCredentialStatus extends ICredentialStatus {
134
160
  statusListCredential: string;
135
161
  expiresAt?: Date;
136
162
  }
137
- interface BitstringStatusListEntryCredentialStatus extends ICredentialStatus {
138
- type: 'BitstringStatusListEntry';
139
- statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[];
140
- statusListIndex: string;
141
- statusListCredential: string;
142
- statusSize?: number;
143
- statusMessage?: Array<BitstringStatus>;
144
- statusReference?: string | string[];
145
- }
146
163
  interface StatusList2021ToVerifiableCredentialArgs {
147
164
  issuer: string | IIssuer;
148
165
  id: string;
@@ -166,19 +183,27 @@ interface CreateStatusListArgs {
166
183
  interface UpdateStatusListIndexArgs {
167
184
  statusListCredential: StatusListCredential;
168
185
  statusListIndex: number | string;
169
- value: number | Status2021 | StatusOAuth | BitstringStatus;
186
+ value: number | Status2021 | StatusOAuth;
187
+ bitsPerStatus?: number;
170
188
  keyRef?: string;
171
189
  expiresAt?: Date;
172
190
  }
173
191
  interface CheckStatusIndexArgs {
174
192
  statusListCredential: StatusListCredential;
175
193
  statusListIndex: string | number;
194
+ bitsPerStatus?: number;
176
195
  }
177
- interface ToStatusListDetailsArgs {
178
- statusListPayload: StatusListCredential;
196
+ interface IToDetailsFromCredentialArgs {
197
+ statusListCredential: StatusListCredential;
198
+ statusListType: StatusListType;
199
+ bitsPerStatus?: number;
179
200
  correlationId?: string;
180
201
  driverType?: StatusListDriverType;
181
202
  }
203
+ interface IMergeDetailsWithEntityArgs {
204
+ extractedDetails: IExtractedCredentialDetails;
205
+ statusListEntity: IStatusListEntity;
206
+ }
182
207
  /**
183
208
  * The interface definition for a plugin that can add statuslist info to a credential
184
209
  *
@@ -251,12 +276,22 @@ type SignedStatusListData = {
251
276
  statusListCredential: StatusListCredential;
252
277
  encodedList: string;
253
278
  };
254
- type IRequiredPlugins = ICredentialPlugin & IIdentifierResolution;
255
- type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution & IKeyManager & ICredentialPlugin>;
279
+ type IRequiredPlugins = IVcdmCredentialPlugin & IIdentifierResolution;
280
+ type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution & IKeyManager & IVcdmCredentialPlugin>;
256
281
 
282
+ /**
283
+ * Fetches a status list credential from a URL
284
+ * @param args - Object containing the status list credential URL
285
+ * @returns Promise resolving to the fetched StatusListCredential
286
+ */
257
287
  declare function fetchStatusListCredential(args: {
258
288
  statusListCredential: string;
259
289
  }): Promise<StatusListCredential>;
290
+ /**
291
+ * Creates a status checking function for credential-status plugin
292
+ * @param args - Configuration options for status verification
293
+ * @returns StatusMethod function for checking credential status
294
+ */
260
295
  declare function statusPluginStatusFunction(args: {
261
296
  documentLoader: any;
262
297
  suite: any;
@@ -267,7 +302,8 @@ declare function statusPluginStatusFunction(args: {
267
302
  }): StatusMethod;
268
303
  /**
269
304
  * Function that can be used together with @digitalbazar/vc and @digitialcredentials/vc
270
- * @param args
305
+ * @param args - Configuration options for status verification
306
+ * @returns Function for checking credential status
271
307
  */
272
308
  declare function vcLibCheckStatusFunction(args: {
273
309
  mandatoryCredentialStatus?: boolean;
@@ -282,6 +318,11 @@ declare function vcLibCheckStatusFunction(args: {
282
318
  verified: boolean;
283
319
  error?: any;
284
320
  }>;
321
+ /**
322
+ * Checks the status of a credential using its credential status information
323
+ * @param args - Parameters for credential status verification
324
+ * @returns Promise resolving to verification result with error details if any
325
+ */
285
326
  declare function checkStatusForCredential(args: {
286
327
  credential: StatusListCredential;
287
328
  documentLoader: any;
@@ -300,22 +341,61 @@ declare function simpleCheckStatusFromStatusListUrl(args: {
300
341
  type?: StatusListType | 'StatusList2021Entry';
301
342
  id?: string;
302
343
  statusListIndex: string;
303
- }): Promise<number | Status2021 | StatusOAuth | BitstringStatus>;
344
+ }): Promise<number | Status2021 | StatusOAuth>;
345
+ /**
346
+ * Checks the status at a specific index in a status list credential
347
+ * @param args - Parameters including credential and index to check
348
+ * @returns Promise resolving to status value at the specified index
349
+ */
304
350
  declare function checkStatusIndexFromStatusListCredential(args: {
305
351
  statusListCredential: StatusListCredential;
306
- statusPurpose?: StatusPurpose2021;
352
+ statusPurpose?: StatusPurpose2021 | string | string[];
307
353
  type?: StatusListType | 'StatusList2021Entry' | 'BitstringStatusListEntry';
308
354
  id?: string;
309
355
  statusListIndex: string | number;
310
- }): Promise<number | Status2021 | StatusOAuth | BitstringStatus>;
311
- declare function createNewStatusList(args: CreateNewStatusListFuncArgs, context: IAgentContext<(ICredentialPlugin | any) & IIdentifierResolution>): Promise<StatusListResult>;
312
- declare function updateStatusIndexFromStatusListCredential(args: UpdateStatusListIndexArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
313
- declare function statusListCredentialToDetails(args: {
314
- statusListCredential: StatusListCredential;
315
- correlationId?: string;
316
- driverType?: StatusListDriverType;
317
- }): Promise<StatusListResult>;
318
- declare function updateStatusListIndexFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
319
- declare function statusList2021ToVerifiableCredential(args: StatusList2021ToVerifiableCredentialArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListCredential>;
356
+ bitsPerStatus?: number;
357
+ }): Promise<number | Status2021 | StatusOAuth>;
358
+ declare function createNewStatusList(args: CreateNewStatusListFuncArgs, context: IAgentContext<(IVcdmCredentialPlugin | any) & IIdentifierResolution>): Promise<StatusListResult>;
359
+ /**
360
+ * Updates a status index in a status list credential
361
+ * @param args - Parameters for status update including credential and new value
362
+ * @param context - Agent context with required plugins
363
+ * @returns Promise resolving to updated status list details
364
+ */
365
+ declare function updateStatusIndexFromStatusListCredential(args: UpdateStatusListIndexArgs, context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
366
+ /**
367
+ * Extracts credential details from a status list credential
368
+ * @param statusListCredential - The status list credential to extract from
369
+ * @returns Promise resolving to extracted credential details
370
+ */
371
+ declare function extractCredentialDetails(statusListCredential: StatusListCredential): Promise<IExtractedCredentialDetails>;
372
+ declare function toStatusListDetails(args: IToDetailsFromCredentialArgs): Promise<StatusListResult & (IStatusList2021ImplementationResult | IOAuthStatusListImplementationResult | IBitstringStatusListImplementationResult)>;
373
+ declare function toStatusListDetails(args: IMergeDetailsWithEntityArgs): Promise<StatusListResult & (IStatusList2021ImplementationResult | IOAuthStatusListImplementationResult | IBitstringStatusListImplementationResult)>;
374
+ /**
375
+ * Creates a credential status object from status list and entry information
376
+ * @param args - Parameters including status list, entry, and index
377
+ * @returns Promise resolving to appropriate credential status type
378
+ */
379
+ declare function createCredentialStatusFromStatusList(args: {
380
+ statusList: StatusListEntity;
381
+ statusListEntry: IStatusListEntryEntity | IBitstringStatusListEntryEntity;
382
+ statusListIndex: number;
383
+ }): Promise<StatusList2021EntryCredentialStatus | StatusListOAuthEntryCredentialStatus | BitstringStatusListEntryCredentialStatus>;
384
+ /**
385
+ * Updates a status list using a base64 encoded list of statuses
386
+ * @param args - Parameters including encoded list and update details
387
+ * @param context - Agent context with required plugins
388
+ * @returns Promise resolving to updated status list details
389
+ */
390
+ declare function updateStatusListIndexFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
391
+ /**
392
+ * Converts a StatusList2021 to a verifiable credential
393
+ * @param args - Parameters for credential creation including issuer and encoded list
394
+ * @param context - Agent context with required plugins
395
+ * @returns Promise resolving to signed status list credential
396
+ */
397
+ declare function statusList2021ToVerifiableCredential(args: StatusList2021ToVerifiableCredentialArgs, context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>): Promise<StatusListCredential>;
398
+
399
+ declare function determineStatusListType(credential: StatusListCredential): StatusListType;
320
400
 
321
- export { type BaseCreateNewStatusListArgs, type BitstringStatus, type BitstringStatusListArgs, type BitstringStatusListEntryCredentialStatus, type BitstringStatusResult, 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 ToStatusListDetailsArgs, type UpdateBitstringStatusListArgs, type UpdateOAuthStatusListArgs, type UpdateStatusList2021Args, type UpdateStatusListFromEncodedListArgs, type UpdateStatusListFromStatusListCredentialArgs, type UpdateStatusListIndexArgs, checkStatusForCredential, checkStatusIndexFromStatusListCredential, createNewStatusList, fetchStatusListCredential, simpleCheckStatusFromStatusListUrl, statusList2021ToVerifiableCredential, statusListCredentialToDetails, statusPluginStatusFunction, updateStatusIndexFromStatusListCredential, updateStatusListIndexFromEncodedList, vcLibCheckStatusFunction };
401
+ 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 };