@sphereon/ssi-sdk.vc-status-list 0.34.1-feature.SSISDK.17.bitstring.sl.10 → 0.34.1-feature.SSISDK.17.bitstring.sl.11
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 +120 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -24
- package/dist/index.d.ts +33 -24
- package/dist/index.js +120 -21
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/functions.ts +31 -4
- package/src/impl/BitstringStatusListImplementation.ts +51 -5
- package/src/impl/IStatusList.ts +63 -2
- package/src/impl/OAuthStatusList.ts +44 -8
- package/src/impl/StatusList2021.ts +44 -9
- package/src/types/index.ts +28 -23
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
2
|
-
import { StatusListIndexingDirection, StatusPurpose2021, StatusListType, IIssuer, CredentialProofFormat, StatusListDriverType, StatusListCredential,
|
|
2
|
+
import { StatusListIndexingDirection, StatusPurpose2021, StatusListType, IIssuer, CredentialProofFormat, StatusListDriverType, StatusListCredential, ICredentialStatus, OrPromise, ICredential, IVerifiableCredential } from '@sphereon/ssi-types';
|
|
3
3
|
import { IPluginMethodMap, IAgentContext, ICredentialIssuer, ICredentialVerifier, IKeyManager, ICredentialPlugin, CredentialPayload } from '@veramo/core';
|
|
4
4
|
import { DataSource } from 'typeorm';
|
|
5
5
|
import { 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
8
|
import { BitstringStatusPurpose } from '@4sure-tech/vc-bitstring-status-lists';
|
|
9
|
+
import { IAddStatusListArgs, StatusListEntity, IStatusListEntryEntity, IBitstringStatusListEntryEntity } from '@sphereon/ssi-sdk.data-store';
|
|
9
10
|
import { StatusMethod } from 'credential-status';
|
|
10
11
|
|
|
11
12
|
declare enum StatusOAuth {
|
|
@@ -23,7 +24,7 @@ type StatusList2021Args = {
|
|
|
23
24
|
statusPurpose?: StatusPurpose2021;
|
|
24
25
|
};
|
|
25
26
|
type OAuthStatusListArgs = {
|
|
26
|
-
bitsPerStatus
|
|
27
|
+
bitsPerStatus: BitsPerStatus;
|
|
27
28
|
expiresAt?: Date;
|
|
28
29
|
};
|
|
29
30
|
type BitstringStatusListArgs = {
|
|
@@ -81,35 +82,38 @@ interface UpdateStatusListFromStatusListCredentialArgs {
|
|
|
81
82
|
value: number | Status2021 | StatusOAuth | BitstringStatus;
|
|
82
83
|
}
|
|
83
84
|
interface StatusListResult {
|
|
85
|
+
id: string;
|
|
84
86
|
encodedList: string;
|
|
85
|
-
|
|
86
|
-
length: number;
|
|
87
|
+
issuer: string | IIssuer;
|
|
87
88
|
type: StatusListType;
|
|
88
89
|
proofFormat: CredentialProofFormat;
|
|
89
|
-
|
|
90
|
+
length: number;
|
|
91
|
+
statusListCredential: StatusListCredential;
|
|
90
92
|
statuslistContentType: string;
|
|
91
|
-
issuer: string | IIssuer;
|
|
92
|
-
statusList2021?: StatusList2021Details;
|
|
93
|
-
oauthStatusList?: OAuthStatusDetails;
|
|
94
|
-
bitstringStatusList?: BitstringStatusDetails;
|
|
95
93
|
correlationId?: string;
|
|
96
94
|
driverType?: StatusListDriverType;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
indexingDirection: StatusListIndexingDirection;
|
|
101
|
-
statusPurpose?: StatusPurpose2021;
|
|
102
|
-
}
|
|
103
|
-
interface OAuthStatusDetails {
|
|
104
|
-
bitsPerStatus?: BitsPerStatus;
|
|
95
|
+
indexingDirection?: StatusListIndexingDirection;
|
|
96
|
+
statusPurpose?: StatusPurpose2021 | BitstringStatusPurpose | BitstringStatusPurpose[];
|
|
97
|
+
bitsPerStatus?: number;
|
|
105
98
|
expiresAt?: Date;
|
|
106
|
-
}
|
|
107
|
-
interface BitstringStatusDetails {
|
|
108
|
-
statusPurpose: BitstringStatusPurpose;
|
|
109
|
-
bitsPerStatus: number;
|
|
110
99
|
validFrom?: Date;
|
|
111
100
|
validUntil?: Date;
|
|
112
101
|
ttl?: number;
|
|
102
|
+
statusList2021?: {
|
|
103
|
+
indexingDirection: StatusListIndexingDirection;
|
|
104
|
+
statusPurpose: StatusPurpose2021;
|
|
105
|
+
};
|
|
106
|
+
oauthStatusList?: {
|
|
107
|
+
bitsPerStatus: number;
|
|
108
|
+
expiresAt?: Date;
|
|
109
|
+
};
|
|
110
|
+
bitstringStatusList?: {
|
|
111
|
+
statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[];
|
|
112
|
+
bitsPerStatus?: number;
|
|
113
|
+
validFrom?: Date;
|
|
114
|
+
validUntil?: Date;
|
|
115
|
+
ttl?: number;
|
|
116
|
+
};
|
|
113
117
|
}
|
|
114
118
|
interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
|
|
115
119
|
type: 'StatusList2021Entry';
|
|
@@ -296,7 +300,7 @@ declare function simpleCheckStatusFromStatusListUrl(args: {
|
|
|
296
300
|
}): Promise<number | Status2021 | StatusOAuth | BitstringStatus>;
|
|
297
301
|
declare function checkStatusIndexFromStatusListCredential(args: {
|
|
298
302
|
statusListCredential: StatusListCredential;
|
|
299
|
-
statusPurpose?: StatusPurpose2021;
|
|
303
|
+
statusPurpose?: StatusPurpose2021 | string | string[];
|
|
300
304
|
type?: StatusListType | 'StatusList2021Entry' | 'BitstringStatusListEntry';
|
|
301
305
|
id?: string;
|
|
302
306
|
statusListIndex: string | number;
|
|
@@ -309,8 +313,13 @@ declare function statusListCredentialToDetails({ correlationId, driverType, stat
|
|
|
309
313
|
correlationId?: string;
|
|
310
314
|
driverType?: StatusListDriverType;
|
|
311
315
|
bitsPerStatus?: number;
|
|
312
|
-
}): Promise<StatusListResult
|
|
316
|
+
}): Promise<StatusListResult & Partial<IAddStatusListArgs>>;
|
|
317
|
+
declare function createCredentialStatusFromStatusList(args: {
|
|
318
|
+
statusList: StatusListEntity;
|
|
319
|
+
statusListEntry: IStatusListEntryEntity | IBitstringStatusListEntryEntity;
|
|
320
|
+
statusListIndex: number;
|
|
321
|
+
}): Promise<StatusList2021EntryCredentialStatus | StatusListOAuthEntryCredentialStatus | BitstringStatusListEntryCredentialStatus>;
|
|
313
322
|
declare function updateStatusListIndexFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
314
323
|
declare function statusList2021ToVerifiableCredential(args: StatusList2021ToVerifiableCredentialArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListCredential>;
|
|
315
324
|
|
|
316
|
-
export { type BaseCreateNewStatusListArgs, type BitstringStatus, type BitstringStatusListArgs, type BitstringStatusListEntryCredentialStatus, 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 };
|
|
325
|
+
export { type BaseCreateNewStatusListArgs, type BitstringStatus, type BitstringStatusListArgs, type BitstringStatusListEntryCredentialStatus, 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, createCredentialStatusFromStatusList, createNewStatusList, fetchStatusListCredential, simpleCheckStatusFromStatusListUrl, statusList2021ToVerifiableCredential, statusListCredentialToDetails, statusPluginStatusFunction, updateStatusIndexFromStatusListCredential, updateStatusListIndexFromEncodedList, vcLibCheckStatusFunction };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
2
|
-
import { StatusListIndexingDirection, StatusPurpose2021, StatusListType, IIssuer, CredentialProofFormat, StatusListDriverType, StatusListCredential,
|
|
2
|
+
import { StatusListIndexingDirection, StatusPurpose2021, StatusListType, IIssuer, CredentialProofFormat, StatusListDriverType, StatusListCredential, ICredentialStatus, OrPromise, ICredential, IVerifiableCredential } from '@sphereon/ssi-types';
|
|
3
3
|
import { IPluginMethodMap, IAgentContext, ICredentialIssuer, ICredentialVerifier, IKeyManager, ICredentialPlugin, CredentialPayload } from '@veramo/core';
|
|
4
4
|
import { DataSource } from 'typeorm';
|
|
5
5
|
import { 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
8
|
import { BitstringStatusPurpose } from '@4sure-tech/vc-bitstring-status-lists';
|
|
9
|
+
import { IAddStatusListArgs, StatusListEntity, IStatusListEntryEntity, IBitstringStatusListEntryEntity } from '@sphereon/ssi-sdk.data-store';
|
|
9
10
|
import { StatusMethod } from 'credential-status';
|
|
10
11
|
|
|
11
12
|
declare enum StatusOAuth {
|
|
@@ -23,7 +24,7 @@ type StatusList2021Args = {
|
|
|
23
24
|
statusPurpose?: StatusPurpose2021;
|
|
24
25
|
};
|
|
25
26
|
type OAuthStatusListArgs = {
|
|
26
|
-
bitsPerStatus
|
|
27
|
+
bitsPerStatus: BitsPerStatus;
|
|
27
28
|
expiresAt?: Date;
|
|
28
29
|
};
|
|
29
30
|
type BitstringStatusListArgs = {
|
|
@@ -81,35 +82,38 @@ interface UpdateStatusListFromStatusListCredentialArgs {
|
|
|
81
82
|
value: number | Status2021 | StatusOAuth | BitstringStatus;
|
|
82
83
|
}
|
|
83
84
|
interface StatusListResult {
|
|
85
|
+
id: string;
|
|
84
86
|
encodedList: string;
|
|
85
|
-
|
|
86
|
-
length: number;
|
|
87
|
+
issuer: string | IIssuer;
|
|
87
88
|
type: StatusListType;
|
|
88
89
|
proofFormat: CredentialProofFormat;
|
|
89
|
-
|
|
90
|
+
length: number;
|
|
91
|
+
statusListCredential: StatusListCredential;
|
|
90
92
|
statuslistContentType: string;
|
|
91
|
-
issuer: string | IIssuer;
|
|
92
|
-
statusList2021?: StatusList2021Details;
|
|
93
|
-
oauthStatusList?: OAuthStatusDetails;
|
|
94
|
-
bitstringStatusList?: BitstringStatusDetails;
|
|
95
93
|
correlationId?: string;
|
|
96
94
|
driverType?: StatusListDriverType;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
indexingDirection: StatusListIndexingDirection;
|
|
101
|
-
statusPurpose?: StatusPurpose2021;
|
|
102
|
-
}
|
|
103
|
-
interface OAuthStatusDetails {
|
|
104
|
-
bitsPerStatus?: BitsPerStatus;
|
|
95
|
+
indexingDirection?: StatusListIndexingDirection;
|
|
96
|
+
statusPurpose?: StatusPurpose2021 | BitstringStatusPurpose | BitstringStatusPurpose[];
|
|
97
|
+
bitsPerStatus?: number;
|
|
105
98
|
expiresAt?: Date;
|
|
106
|
-
}
|
|
107
|
-
interface BitstringStatusDetails {
|
|
108
|
-
statusPurpose: BitstringStatusPurpose;
|
|
109
|
-
bitsPerStatus: number;
|
|
110
99
|
validFrom?: Date;
|
|
111
100
|
validUntil?: Date;
|
|
112
101
|
ttl?: number;
|
|
102
|
+
statusList2021?: {
|
|
103
|
+
indexingDirection: StatusListIndexingDirection;
|
|
104
|
+
statusPurpose: StatusPurpose2021;
|
|
105
|
+
};
|
|
106
|
+
oauthStatusList?: {
|
|
107
|
+
bitsPerStatus: number;
|
|
108
|
+
expiresAt?: Date;
|
|
109
|
+
};
|
|
110
|
+
bitstringStatusList?: {
|
|
111
|
+
statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[];
|
|
112
|
+
bitsPerStatus?: number;
|
|
113
|
+
validFrom?: Date;
|
|
114
|
+
validUntil?: Date;
|
|
115
|
+
ttl?: number;
|
|
116
|
+
};
|
|
113
117
|
}
|
|
114
118
|
interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
|
|
115
119
|
type: 'StatusList2021Entry';
|
|
@@ -296,7 +300,7 @@ declare function simpleCheckStatusFromStatusListUrl(args: {
|
|
|
296
300
|
}): Promise<number | Status2021 | StatusOAuth | BitstringStatus>;
|
|
297
301
|
declare function checkStatusIndexFromStatusListCredential(args: {
|
|
298
302
|
statusListCredential: StatusListCredential;
|
|
299
|
-
statusPurpose?: StatusPurpose2021;
|
|
303
|
+
statusPurpose?: StatusPurpose2021 | string | string[];
|
|
300
304
|
type?: StatusListType | 'StatusList2021Entry' | 'BitstringStatusListEntry';
|
|
301
305
|
id?: string;
|
|
302
306
|
statusListIndex: string | number;
|
|
@@ -309,8 +313,13 @@ declare function statusListCredentialToDetails({ correlationId, driverType, stat
|
|
|
309
313
|
correlationId?: string;
|
|
310
314
|
driverType?: StatusListDriverType;
|
|
311
315
|
bitsPerStatus?: number;
|
|
312
|
-
}): Promise<StatusListResult
|
|
316
|
+
}): Promise<StatusListResult & Partial<IAddStatusListArgs>>;
|
|
317
|
+
declare function createCredentialStatusFromStatusList(args: {
|
|
318
|
+
statusList: StatusListEntity;
|
|
319
|
+
statusListEntry: IStatusListEntryEntity | IBitstringStatusListEntryEntity;
|
|
320
|
+
statusListIndex: number;
|
|
321
|
+
}): Promise<StatusList2021EntryCredentialStatus | StatusListOAuthEntryCredentialStatus | BitstringStatusListEntryCredentialStatus>;
|
|
313
322
|
declare function updateStatusListIndexFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
314
323
|
declare function statusList2021ToVerifiableCredential(args: StatusList2021ToVerifiableCredentialArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListCredential>;
|
|
315
324
|
|
|
316
|
-
export { type BaseCreateNewStatusListArgs, type BitstringStatus, type BitstringStatusListArgs, type BitstringStatusListEntryCredentialStatus, 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 };
|
|
325
|
+
export { type BaseCreateNewStatusListArgs, type BitstringStatus, type BitstringStatusListArgs, type BitstringStatusListEntryCredentialStatus, 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, createCredentialStatusFromStatusList, createNewStatusList, fetchStatusListCredential, simpleCheckStatusFromStatusListUrl, statusList2021ToVerifiableCredential, statusListCredentialToDetails, statusPluginStatusFunction, updateStatusIndexFromStatusListCredential, updateStatusListIndexFromEncodedList, vcLibCheckStatusFunction };
|
package/dist/index.js
CHANGED
|
@@ -211,13 +211,14 @@ var StatusList2021Implementation = class {
|
|
|
211
211
|
encodedList,
|
|
212
212
|
proofFormat
|
|
213
213
|
}, context);
|
|
214
|
+
if (!("statusPurpose" in credentialSubject)) {
|
|
215
|
+
return Promise.reject(Error("statusPurpose is required in credentialSubject for StatusList2021"));
|
|
216
|
+
}
|
|
214
217
|
return {
|
|
215
218
|
statusListCredential: updatedCredential,
|
|
216
219
|
encodedList,
|
|
217
220
|
statusList2021: {
|
|
218
|
-
|
|
219
|
-
statusPurpose: credentialSubject.statusPurpose
|
|
220
|
-
} : {},
|
|
221
|
+
statusPurpose: credentialSubject.statusPurpose,
|
|
221
222
|
indexingDirection: "rightToLeft"
|
|
222
223
|
},
|
|
223
224
|
length: statusList.length - 1,
|
|
@@ -282,10 +283,12 @@ var StatusList2021Implementation = class {
|
|
|
282
283
|
const encodedList = getAssertedProperty("encodedList", credentialSubject);
|
|
283
284
|
const proofFormat = CredentialMapper2.detectDocumentType(statusListPayload) === DocumentFormat2.JWT ? "jwt" : "lds";
|
|
284
285
|
const statusPurpose = getAssertedProperty("statusPurpose", credentialSubject);
|
|
286
|
+
const indexingDirection = "rightToLeft";
|
|
285
287
|
const list = await StatusList.decode({
|
|
286
288
|
encodedList
|
|
287
289
|
});
|
|
288
290
|
return {
|
|
291
|
+
// Base implementation fields
|
|
289
292
|
id,
|
|
290
293
|
encodedList,
|
|
291
294
|
issuer,
|
|
@@ -294,18 +297,36 @@ var StatusList2021Implementation = class {
|
|
|
294
297
|
length: list.length,
|
|
295
298
|
statusListCredential: statusListPayload,
|
|
296
299
|
statuslistContentType: this.buildContentType(proofFormat),
|
|
300
|
+
correlationId: args.correlationId,
|
|
301
|
+
driverType: args.driverType,
|
|
302
|
+
// Flattened StatusList2021-specific fields
|
|
303
|
+
indexingDirection,
|
|
304
|
+
statusPurpose,
|
|
305
|
+
// Legacy nested structure for backward compatibility
|
|
297
306
|
statusList2021: {
|
|
298
|
-
indexingDirection
|
|
299
|
-
statusPurpose
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
307
|
+
indexingDirection,
|
|
308
|
+
statusPurpose,
|
|
309
|
+
// Optional fields from args
|
|
310
|
+
...args.correlationId && {
|
|
311
|
+
correlationId: args.correlationId
|
|
312
|
+
},
|
|
313
|
+
...args.driverType && {
|
|
314
|
+
driverType: args.driverType
|
|
315
|
+
}
|
|
306
316
|
}
|
|
307
317
|
};
|
|
308
318
|
}
|
|
319
|
+
async createCredentialStatus(args) {
|
|
320
|
+
const { statusList, statusListIndex } = args;
|
|
321
|
+
const statusList2021 = statusList;
|
|
322
|
+
return {
|
|
323
|
+
id: `${statusList.id}#${statusListIndex}`,
|
|
324
|
+
type: "StatusList2021Entry",
|
|
325
|
+
statusPurpose: statusList2021.statusPurpose ?? "revocation",
|
|
326
|
+
statusListIndex: "" + statusListIndex,
|
|
327
|
+
statusListCredential: statusList.id
|
|
328
|
+
};
|
|
329
|
+
}
|
|
309
330
|
async createVerifiableCredential(args, context) {
|
|
310
331
|
const identifier = await context.agent.identifierManagedGet({
|
|
311
332
|
identifier: typeof args.issuer === "string" ? args.issuer : args.issuer.id,
|
|
@@ -682,9 +703,6 @@ var OAuthStatusListImplementation = class {
|
|
|
682
703
|
statuslistContentType: this.buildContentType(proofFormat)
|
|
683
704
|
};
|
|
684
705
|
}
|
|
685
|
-
buildContentType(proofFormat) {
|
|
686
|
-
return `application/statuslist+${proofFormat === "cbor" ? "cwt" : "jwt"}`;
|
|
687
|
-
}
|
|
688
706
|
async checkStatusIndex(args) {
|
|
689
707
|
const { statusListCredential, statusListIndex } = args;
|
|
690
708
|
if (typeof statusListCredential !== "string") {
|
|
@@ -703,7 +721,10 @@ var OAuthStatusListImplementation = class {
|
|
|
703
721
|
const proofFormat = determineProofFormat(statusListPayload);
|
|
704
722
|
const decoded = proofFormat === "jwt" ? decodeStatusListJWT(statusListPayload) : decodeStatusListCWT(statusListPayload);
|
|
705
723
|
const { statusList, issuer, id, exp } = decoded;
|
|
724
|
+
const bitsPerStatus = statusList.getBitsPerStatus();
|
|
725
|
+
const expiresAt = exp ? new Date(exp * 1e3) : void 0;
|
|
706
726
|
return {
|
|
727
|
+
// Base implementation fields
|
|
707
728
|
id,
|
|
708
729
|
encodedList: statusList.compressStatusList(),
|
|
709
730
|
issuer,
|
|
@@ -712,12 +733,21 @@ var OAuthStatusListImplementation = class {
|
|
|
712
733
|
length: statusList.statusList.length,
|
|
713
734
|
statusListCredential: statusListPayload,
|
|
714
735
|
statuslistContentType: this.buildContentType(proofFormat),
|
|
736
|
+
correlationId: args.correlationId,
|
|
737
|
+
driverType: args.driverType,
|
|
738
|
+
// Flattened OAuth-specific fields
|
|
739
|
+
bitsPerStatus,
|
|
740
|
+
...expiresAt && {
|
|
741
|
+
expiresAt
|
|
742
|
+
},
|
|
743
|
+
// Legacy nested structure for backward compatibility
|
|
715
744
|
oauthStatusList: {
|
|
716
|
-
bitsPerStatus
|
|
717
|
-
...
|
|
718
|
-
expiresAt
|
|
745
|
+
bitsPerStatus,
|
|
746
|
+
...expiresAt && {
|
|
747
|
+
expiresAt
|
|
719
748
|
}
|
|
720
749
|
},
|
|
750
|
+
// Optional fields from args
|
|
721
751
|
...args.correlationId && {
|
|
722
752
|
correlationId: args.correlationId
|
|
723
753
|
},
|
|
@@ -726,6 +756,21 @@ var OAuthStatusListImplementation = class {
|
|
|
726
756
|
}
|
|
727
757
|
};
|
|
728
758
|
}
|
|
759
|
+
async createCredentialStatus(args) {
|
|
760
|
+
const { statusList, statusListIndex } = args;
|
|
761
|
+
const oauthStatusList = statusList;
|
|
762
|
+
return {
|
|
763
|
+
id: `${statusList.id}#${statusListIndex}`,
|
|
764
|
+
type: "OAuthStatusListEntry",
|
|
765
|
+
bitsPerStatus: oauthStatusList.bitsPerStatus,
|
|
766
|
+
statusListIndex: "" + statusListIndex,
|
|
767
|
+
statusListCredential: statusList.id,
|
|
768
|
+
expiresAt: oauthStatusList.expiresAt
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
buildContentType(proofFormat) {
|
|
772
|
+
return `application/statuslist+${proofFormat === "cbor" ? "cwt" : "jwt"}`;
|
|
773
|
+
}
|
|
729
774
|
async createSignedStatusList(proofFormat, context, statusList, issuerString, id, expiresAt, keyRef) {
|
|
730
775
|
switch (proofFormat) {
|
|
731
776
|
case "jwt": {
|
|
@@ -935,6 +980,7 @@ var BitstringStatusListImplementation = class {
|
|
|
935
980
|
const ttl = credSubject.ttl;
|
|
936
981
|
const statuslistLength = BitstreamStatusList.getStatusListLength(encodedList, bitsPerStatus);
|
|
937
982
|
return {
|
|
983
|
+
// Base implementation fields
|
|
938
984
|
id,
|
|
939
985
|
encodedList,
|
|
940
986
|
issuer,
|
|
@@ -943,13 +989,35 @@ var BitstringStatusListImplementation = class {
|
|
|
943
989
|
length: statuslistLength,
|
|
944
990
|
statusListCredential: statusListPayload,
|
|
945
991
|
statuslistContentType: this.buildContentType(proofFormat),
|
|
992
|
+
correlationId: args.correlationId,
|
|
993
|
+
driverType: args.driverType,
|
|
994
|
+
// Flattened Bitstring-specific fields
|
|
995
|
+
statusPurpose,
|
|
996
|
+
bitsPerStatus,
|
|
997
|
+
...validFrom && {
|
|
998
|
+
validFrom
|
|
999
|
+
},
|
|
1000
|
+
...validUntil && {
|
|
1001
|
+
validUntil
|
|
1002
|
+
},
|
|
1003
|
+
...ttl && {
|
|
1004
|
+
ttl
|
|
1005
|
+
},
|
|
1006
|
+
// Legacy nested structure for backward compatibility
|
|
946
1007
|
bitstringStatusList: {
|
|
947
1008
|
statusPurpose,
|
|
948
1009
|
bitsPerStatus,
|
|
949
|
-
validFrom
|
|
950
|
-
|
|
951
|
-
|
|
1010
|
+
...validFrom && {
|
|
1011
|
+
validFrom
|
|
1012
|
+
},
|
|
1013
|
+
...validUntil && {
|
|
1014
|
+
validUntil
|
|
1015
|
+
},
|
|
1016
|
+
...ttl && {
|
|
1017
|
+
ttl
|
|
1018
|
+
}
|
|
952
1019
|
},
|
|
1020
|
+
// Optional fields from args
|
|
953
1021
|
...args.correlationId && {
|
|
954
1022
|
correlationId: args.correlationId
|
|
955
1023
|
},
|
|
@@ -958,6 +1026,24 @@ var BitstringStatusListImplementation = class {
|
|
|
958
1026
|
}
|
|
959
1027
|
};
|
|
960
1028
|
}
|
|
1029
|
+
async createCredentialStatus(args) {
|
|
1030
|
+
const { statusList, statusListEntry, statusListIndex } = args;
|
|
1031
|
+
const isBitstringEntry = /* @__PURE__ */ __name((entry) => {
|
|
1032
|
+
return "statusPurpose" in entry;
|
|
1033
|
+
}, "isBitstringEntry");
|
|
1034
|
+
if (!isBitstringEntry(statusListEntry)) {
|
|
1035
|
+
throw new Error("Expected bitstring status list entry for bitstring status list");
|
|
1036
|
+
}
|
|
1037
|
+
const bitstringStatusList = statusList;
|
|
1038
|
+
return {
|
|
1039
|
+
id: `${statusList.id}#${statusListIndex}`,
|
|
1040
|
+
type: "BitstringStatusListEntry",
|
|
1041
|
+
statusPurpose: statusListEntry.statusPurpose,
|
|
1042
|
+
statusListIndex: "" + statusListIndex,
|
|
1043
|
+
statusListCredential: statusList.id,
|
|
1044
|
+
bitsPerStatus: bitstringStatusList.bitsPerStatus
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
961
1047
|
async createVerifiableCredential(args, context) {
|
|
962
1048
|
const identifier = await context.agent.identifierManagedGet({
|
|
963
1049
|
identifier: typeof args.issuer === "string" ? args.issuer : args.issuer.id,
|
|
@@ -1156,14 +1242,26 @@ async function statusListCredentialToDetails({ correlationId, driverType, status
|
|
|
1156
1242
|
statusListType = type.replace("Credential", "");
|
|
1157
1243
|
}
|
|
1158
1244
|
const implementation = getStatusListImplementation(statusListType);
|
|
1159
|
-
|
|
1245
|
+
const result = await implementation.toStatusListDetails({
|
|
1160
1246
|
statusListPayload: credential,
|
|
1161
1247
|
correlationId,
|
|
1162
1248
|
driverType,
|
|
1163
1249
|
bitsPerStatus
|
|
1164
1250
|
});
|
|
1251
|
+
return result;
|
|
1165
1252
|
}
|
|
1166
1253
|
__name(statusListCredentialToDetails, "statusListCredentialToDetails");
|
|
1254
|
+
async function createCredentialStatusFromStatusList(args) {
|
|
1255
|
+
const { statusList, statusListEntry, statusListIndex } = args;
|
|
1256
|
+
const statusListType = determineStatusListType(statusList.statusListCredential);
|
|
1257
|
+
const implementation = getStatusListImplementation(statusListType);
|
|
1258
|
+
return implementation.createCredentialStatus({
|
|
1259
|
+
statusList,
|
|
1260
|
+
statusListEntry,
|
|
1261
|
+
statusListIndex
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
__name(createCredentialStatusFromStatusList, "createCredentialStatusFromStatusList");
|
|
1167
1265
|
async function updateStatusListIndexFromEncodedList(args, context) {
|
|
1168
1266
|
const { type } = getAssertedValue("type", args);
|
|
1169
1267
|
const implementation = getStatusListImplementation(type);
|
|
@@ -1215,6 +1313,7 @@ export {
|
|
|
1215
1313
|
StatusOAuth,
|
|
1216
1314
|
checkStatusForCredential,
|
|
1217
1315
|
checkStatusIndexFromStatusListCredential,
|
|
1316
|
+
createCredentialStatusFromStatusList,
|
|
1218
1317
|
createNewStatusList,
|
|
1219
1318
|
fetchStatusListCredential,
|
|
1220
1319
|
simpleCheckStatusFromStatusListUrl,
|