@sphereon/ssi-sdk.vc-status-list 0.34.1-feature.SSISDK.17.bitstring.sl.14 → 0.34.1-feature.SSISDK.17.bitstring.sl.16
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 +15 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -8
- package/dist/index.d.ts +50 -8
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/functions.ts +56 -1
- package/src/impl/BitstringStatusListImplementation.ts +5 -0
- package/src/impl/OAuthStatusList.ts +5 -0
- package/src/impl/StatusList2021.ts +5 -0
- package/src/types/index.ts +0 -14
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.vc-status-list",
|
|
3
3
|
"description": "Sphereon SSI-SDK plugin for Status List management, like StatusList2021.",
|
|
4
|
-
"version": "0.34.1-feature.SSISDK.17.bitstring.sl.
|
|
4
|
+
"version": "0.34.1-feature.SSISDK.17.bitstring.sl.16+6964608d",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"@sphereon/ssi-sdk-ext.did-utils": "0.29.0",
|
|
32
32
|
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.29.0",
|
|
33
33
|
"@sphereon/ssi-sdk-ext.jwt-service": "0.29.0",
|
|
34
|
-
"@sphereon/ssi-sdk.credential-vcdm": "0.34.1-feature.SSISDK.17.bitstring.sl.
|
|
35
|
-
"@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.17.bitstring.sl.
|
|
36
|
-
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.17.bitstring.sl.
|
|
34
|
+
"@sphereon/ssi-sdk.credential-vcdm": "0.34.1-feature.SSISDK.17.bitstring.sl.16+6964608d",
|
|
35
|
+
"@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.17.bitstring.sl.16+6964608d",
|
|
36
|
+
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.17.bitstring.sl.16+6964608d",
|
|
37
37
|
"@sphereon/vc-status-list": "7.0.0-next.0",
|
|
38
38
|
"@veramo/core": "4.2.0",
|
|
39
39
|
"@veramo/credential-status": "4.2.0",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"SSI",
|
|
73
73
|
"StatusList2021"
|
|
74
74
|
],
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "6964608dcd10f9cc0935ef31e7dec85fb4fe55fd"
|
|
76
76
|
}
|
package/src/functions.ts
CHANGED
|
@@ -36,6 +36,11 @@ import {
|
|
|
36
36
|
IStatusList2021ImplementationResult,
|
|
37
37
|
} from './impl/IStatusList'
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Fetches a status list credential from a URL
|
|
41
|
+
* @param args - Object containing the status list credential URL
|
|
42
|
+
* @returns Promise resolving to the fetched StatusListCredential
|
|
43
|
+
*/
|
|
39
44
|
export async function fetchStatusListCredential(args: { statusListCredential: string }): Promise<StatusListCredential> {
|
|
40
45
|
const url = getAssertedValue('statusListCredential', args.statusListCredential)
|
|
41
46
|
try {
|
|
@@ -54,6 +59,11 @@ export async function fetchStatusListCredential(args: { statusListCredential: st
|
|
|
54
59
|
}
|
|
55
60
|
}
|
|
56
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Creates a status checking function for credential-status plugin
|
|
64
|
+
* @param args - Configuration options for status verification
|
|
65
|
+
* @returns StatusMethod function for checking credential status
|
|
66
|
+
*/
|
|
57
67
|
export function statusPluginStatusFunction(args: {
|
|
58
68
|
documentLoader: any
|
|
59
69
|
suite: any
|
|
@@ -79,7 +89,8 @@ export function statusPluginStatusFunction(args: {
|
|
|
79
89
|
|
|
80
90
|
/**
|
|
81
91
|
* Function that can be used together with @digitalbazar/vc and @digitialcredentials/vc
|
|
82
|
-
* @param args
|
|
92
|
+
* @param args - Configuration options for status verification
|
|
93
|
+
* @returns Function for checking credential status
|
|
83
94
|
*/
|
|
84
95
|
export function vcLibCheckStatusFunction(args: {
|
|
85
96
|
mandatoryCredentialStatus?: boolean
|
|
@@ -106,6 +117,11 @@ export function vcLibCheckStatusFunction(args: {
|
|
|
106
117
|
}
|
|
107
118
|
}
|
|
108
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Checks the status of a credential using its credential status information
|
|
122
|
+
* @param args - Parameters for credential status verification
|
|
123
|
+
* @returns Promise resolving to verification result with error details if any
|
|
124
|
+
*/
|
|
109
125
|
export async function checkStatusForCredential(args: {
|
|
110
126
|
credential: StatusListCredential
|
|
111
127
|
documentLoader: any
|
|
@@ -153,6 +169,11 @@ export async function simpleCheckStatusFromStatusListUrl(args: {
|
|
|
153
169
|
})
|
|
154
170
|
}
|
|
155
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Checks the status at a specific index in a status list credential
|
|
174
|
+
* @param args - Parameters including credential and index to check
|
|
175
|
+
* @returns Promise resolving to status value at the specified index
|
|
176
|
+
*/
|
|
156
177
|
export async function checkStatusIndexFromStatusListCredential(args: {
|
|
157
178
|
statusListCredential: StatusListCredential
|
|
158
179
|
statusPurpose?: StatusPurpose2021 | string | string[]
|
|
@@ -175,6 +196,12 @@ export async function createNewStatusList(
|
|
|
175
196
|
return implementation.createNewStatusList(args, context)
|
|
176
197
|
}
|
|
177
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Updates a status index in a status list credential
|
|
201
|
+
* @param args - Parameters for status update including credential and new value
|
|
202
|
+
* @param context - Agent context with required plugins
|
|
203
|
+
* @returns Promise resolving to updated status list details
|
|
204
|
+
*/
|
|
178
205
|
export async function updateStatusIndexFromStatusListCredential(
|
|
179
206
|
args: UpdateStatusListIndexArgs,
|
|
180
207
|
context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,
|
|
@@ -185,6 +212,11 @@ export async function updateStatusIndexFromStatusListCredential(
|
|
|
185
212
|
return implementation.updateStatusListIndex(args, context)
|
|
186
213
|
}
|
|
187
214
|
|
|
215
|
+
/**
|
|
216
|
+
* Extracts credential details from a status list credential
|
|
217
|
+
* @param statusListCredential - The status list credential to extract from
|
|
218
|
+
* @returns Promise resolving to extracted credential details
|
|
219
|
+
*/
|
|
188
220
|
export async function extractCredentialDetails(statusListCredential: StatusListCredential): Promise<IExtractedCredentialDetails> {
|
|
189
221
|
const statusListType = determineStatusListType(statusListCredential)
|
|
190
222
|
const implementation = getStatusListImplementation(statusListType)
|
|
@@ -199,6 +231,12 @@ export async function toStatusListDetails(
|
|
|
199
231
|
args: IMergeDetailsWithEntityArgs,
|
|
200
232
|
): Promise<StatusListResult & (IStatusList2021ImplementationResult | IOAuthStatusListImplementationResult | IBitstringStatusListImplementationResult)>
|
|
201
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Converts credential and metadata into detailed status list information
|
|
236
|
+
* Handles both CREATE/READ and UPDATE contexts based on input arguments
|
|
237
|
+
* @param args - Either credential-based args or entity-based args for merging
|
|
238
|
+
* @returns Promise resolving to complete status list details
|
|
239
|
+
*/
|
|
202
240
|
export async function toStatusListDetails(
|
|
203
241
|
args: IToDetailsFromCredentialArgs | IMergeDetailsWithEntityArgs,
|
|
204
242
|
): Promise<
|
|
@@ -217,6 +255,11 @@ export async function toStatusListDetails(
|
|
|
217
255
|
}
|
|
218
256
|
}
|
|
219
257
|
|
|
258
|
+
/**
|
|
259
|
+
* Creates a credential status object from status list and entry information
|
|
260
|
+
* @param args - Parameters including status list, entry, and index
|
|
261
|
+
* @returns Promise resolving to appropriate credential status type
|
|
262
|
+
*/
|
|
220
263
|
export async function createCredentialStatusFromStatusList(args: {
|
|
221
264
|
statusList: StatusListEntity
|
|
222
265
|
statusListEntry: IStatusListEntryEntity | IBitstringStatusListEntryEntity
|
|
@@ -236,6 +279,12 @@ export async function createCredentialStatusFromStatusList(args: {
|
|
|
236
279
|
})
|
|
237
280
|
}
|
|
238
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Updates a status list using a base64 encoded list of statuses
|
|
284
|
+
* @param args - Parameters including encoded list and update details
|
|
285
|
+
* @param context - Agent context with required plugins
|
|
286
|
+
* @returns Promise resolving to updated status list details
|
|
287
|
+
*/
|
|
239
288
|
export async function updateStatusListIndexFromEncodedList(
|
|
240
289
|
args: UpdateStatusListFromEncodedListArgs,
|
|
241
290
|
context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,
|
|
@@ -245,6 +294,12 @@ export async function updateStatusListIndexFromEncodedList(
|
|
|
245
294
|
return implementation.updateStatusListFromEncodedList(args, context)
|
|
246
295
|
}
|
|
247
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Converts a StatusList2021 to a verifiable credential
|
|
299
|
+
* @param args - Parameters for credential creation including issuer and encoded list
|
|
300
|
+
* @param context - Agent context with required plugins
|
|
301
|
+
* @returns Promise resolving to signed status list credential
|
|
302
|
+
*/
|
|
248
303
|
export async function statusList2021ToVerifiableCredential(
|
|
249
304
|
args: StatusList2021ToVerifiableCredentialArgs,
|
|
250
305
|
context: IAgentContext<IVcdmCredentialPlugin & IIdentifierResolution>,
|
|
@@ -298,6 +298,11 @@ export class BitstringStatusListImplementation implements IStatusList {
|
|
|
298
298
|
return statusList.getStatus(numIndex)
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
+
/**
|
|
302
|
+
* Performs the initial parsing of a StatusListCredential.
|
|
303
|
+
* This method handles expensive operations like JWT/CWT decoding once.
|
|
304
|
+
* It extracts all details available from the credential payload itself.
|
|
305
|
+
*/
|
|
301
306
|
async extractCredentialDetails(credential: StatusListCredential): Promise<IExtractedCredentialDetails> {
|
|
302
307
|
const uniform = CredentialMapper.toUniformCredential(credential)
|
|
303
308
|
const { issuer, credentialSubject } = uniform
|
|
@@ -165,6 +165,11 @@ export class OAuthStatusListImplementation implements IStatusList {
|
|
|
165
165
|
return statusList.getStatus(index)
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
/**
|
|
169
|
+
* Performs the initial parsing of a StatusListCredential.
|
|
170
|
+
* This method handles expensive operations like JWT/CWT decoding once.
|
|
171
|
+
* It extracts all details available from the credential payload itself.
|
|
172
|
+
*/
|
|
168
173
|
async extractCredentialDetails(credential: CompactJWT | CWT): Promise<IExtractedCredentialDetails> {
|
|
169
174
|
if (typeof credential !== 'string') {
|
|
170
175
|
return Promise.reject('statusListCredential must be a JWT or CWT string')
|
|
@@ -172,6 +172,11 @@ export class StatusList2021Implementation implements IStatusList {
|
|
|
172
172
|
return status ? Status2021.Invalid : Status2021.Valid
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Performs the initial parsing of a StatusListCredential.
|
|
177
|
+
* This method handles expensive operations like JWT/CWT decoding once.
|
|
178
|
+
* It extracts all details available from the credential payload itself.
|
|
179
|
+
*/
|
|
175
180
|
async extractCredentialDetails(credential: StatusListCredential): Promise<IExtractedCredentialDetails> {
|
|
176
181
|
const uniform = CredentialMapper.toUniformCredential(credential)
|
|
177
182
|
const { issuer, credentialSubject } = uniform
|
package/src/types/index.ts
CHANGED
|
@@ -109,20 +109,6 @@ export interface StatusListResult {
|
|
|
109
109
|
correlationId?: string
|
|
110
110
|
driverType?: StatusListDriverType
|
|
111
111
|
|
|
112
|
-
// Flattened StatusList2021 fields
|
|
113
|
-
indexingDirection?: StatusListIndexingDirection
|
|
114
|
-
statusPurpose?: StatusPurpose2021 | BitstringStatusPurpose | BitstringStatusPurpose[]
|
|
115
|
-
|
|
116
|
-
// Flattened OAuth fields
|
|
117
|
-
bitsPerStatus?: number
|
|
118
|
-
expiresAt?: Date
|
|
119
|
-
|
|
120
|
-
// Flattened Bitstring fields
|
|
121
|
-
validFrom?: Date
|
|
122
|
-
validUntil?: Date
|
|
123
|
-
ttl?: number
|
|
124
|
-
|
|
125
|
-
// Legacy nested structures for backward compatibility
|
|
126
112
|
statusList2021?: {
|
|
127
113
|
indexingDirection: StatusListIndexingDirection
|
|
128
114
|
statusPurpose: StatusPurpose2021
|