@sphereon/ssi-sdk.vc-status-list 0.32.1-feature.IATAB2B.52.190 → 0.32.1-feature.MWALL.715.121

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.
Files changed (51) hide show
  1. package/dist/functions.d.ts +13 -13
  2. package/dist/functions.d.ts.map +1 -1
  3. package/dist/functions.js +109 -53
  4. package/dist/functions.js.map +1 -1
  5. package/dist/types/index.d.ts +33 -123
  6. package/dist/types/index.d.ts.map +1 -1
  7. package/dist/types/index.js +0 -12
  8. package/dist/types/index.js.map +1 -1
  9. package/package.json +5 -16
  10. package/src/functions.ts +159 -73
  11. package/src/types/index.ts +37 -142
  12. package/dist/impl/IStatusList.d.ts +0 -26
  13. package/dist/impl/IStatusList.d.ts.map +0 -1
  14. package/dist/impl/IStatusList.js +0 -3
  15. package/dist/impl/IStatusList.js.map +0 -1
  16. package/dist/impl/OAuthStatusList.d.ts +0 -21
  17. package/dist/impl/OAuthStatusList.d.ts.map +0 -1
  18. package/dist/impl/OAuthStatusList.js +0 -153
  19. package/dist/impl/OAuthStatusList.js.map +0 -1
  20. package/dist/impl/StatusList2021.d.ts +0 -16
  21. package/dist/impl/StatusList2021.d.ts.map +0 -1
  22. package/dist/impl/StatusList2021.js +0 -182
  23. package/dist/impl/StatusList2021.js.map +0 -1
  24. package/dist/impl/StatusListFactory.d.ts +0 -11
  25. package/dist/impl/StatusListFactory.d.ts.map +0 -1
  26. package/dist/impl/StatusListFactory.js +0 -32
  27. package/dist/impl/StatusListFactory.js.map +0 -1
  28. package/dist/impl/encoding/cbor.d.ts +0 -6
  29. package/dist/impl/encoding/cbor.d.ts.map +0 -1
  30. package/dist/impl/encoding/cbor.js +0 -140
  31. package/dist/impl/encoding/cbor.js.map +0 -1
  32. package/dist/impl/encoding/common.d.ts +0 -12
  33. package/dist/impl/encoding/common.d.ts.map +0 -1
  34. package/dist/impl/encoding/common.js +0 -26
  35. package/dist/impl/encoding/common.js.map +0 -1
  36. package/dist/impl/encoding/jwt.d.ts +0 -9
  37. package/dist/impl/encoding/jwt.d.ts.map +0 -1
  38. package/dist/impl/encoding/jwt.js +0 -74
  39. package/dist/impl/encoding/jwt.js.map +0 -1
  40. package/dist/utils.d.ts +0 -17
  41. package/dist/utils.d.ts.map +0 -1
  42. package/dist/utils.js +0 -88
  43. package/dist/utils.js.map +0 -1
  44. package/src/impl/IStatusList.ts +0 -42
  45. package/src/impl/OAuthStatusList.ts +0 -204
  46. package/src/impl/StatusList2021.ts +0 -236
  47. package/src/impl/StatusListFactory.ts +0 -34
  48. package/src/impl/encoding/cbor.ts +0 -171
  49. package/src/impl/encoding/common.ts +0 -25
  50. package/src/impl/encoding/jwt.ts +0 -80
  51. package/src/utils.ts +0 -95
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.32.1-feature.IATAB2B.52.190+ba7b1c04",
4
+ "version": "0.32.1-feature.MWALL.715.121+57a299ff",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -10,23 +10,14 @@
10
10
  "build:clean": "tsc --build --clean && tsc --build"
11
11
  },
12
12
  "dependencies": {
13
- "@sd-jwt/core": "^0.7.2",
14
- "@sd-jwt/jwt-status-list": "^0.9.1",
15
- "@sd-jwt/sd-jwt-vc": "^0.7.2",
16
- "@sphereon/kmp-cbor": "0.2.0-SNAPSHOT.25",
17
- "@sphereon/oid4vci-common": "0.16.1-feature.IATAB2B.52.345",
18
- "@sphereon/ssi-sdk-ext.did-utils": "0.27.0",
19
- "@sphereon/ssi-sdk-ext.identifier-resolution": "0.27.0",
20
- "@sphereon/ssi-sdk-ext.jwt-service": "0.27.0",
21
- "@sphereon/ssi-types": "0.32.1-feature.IATAB2B.52.190+ba7b1c04",
13
+ "@sphereon/ssi-sdk-ext.did-utils": "0.27.1-next.14",
14
+ "@sphereon/ssi-sdk-ext.identifier-resolution": "0.27.1-next.14",
15
+ "@sphereon/ssi-types": "0.32.1-feature.MWALL.715.121+57a299ff",
22
16
  "@sphereon/vc-status-list": "7.0.0-next.0",
23
17
  "@veramo/core": "4.2.0",
24
18
  "@veramo/credential-status": "4.2.0",
25
- "base64url": "^3.0.1",
26
19
  "credential-status": "^2.0.6",
27
20
  "debug": "^4.3.5",
28
- "jwt-decode": "^4.0.0",
29
- "pako": "^2.1.0",
30
21
  "typeorm": "^0.3.20",
31
22
  "uint8arrays": "^3.1.1"
32
23
  },
@@ -35,8 +26,6 @@
35
26
  "@babel/core": "^7.24.9",
36
27
  "@babel/preset-env": "^7.24.8",
37
28
  "@babel/preset-typescript": "^7.24.7",
38
- "@types/pako": "2.0.3",
39
- "@veramo/key-manager": "4.2.0",
40
29
  "typescript": "5.4.2"
41
30
  },
42
31
  "files": [
@@ -58,5 +47,5 @@
58
47
  "StatusList2021"
59
48
  ],
60
49
  "nx": {},
61
- "gitHead": "ba7b1c04da999658e9172c86331bc0d0da784562"
50
+ "gitHead": "57a299ff462f52b69fdcc5400cca68323cf10e64"
62
51
  }
package/src/functions.ts CHANGED
@@ -2,42 +2,40 @@ import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resoluti
2
2
  import {
3
3
  CredentialMapper,
4
4
  DocumentFormat,
5
- ProofFormat,
6
- StatusListCredential,
5
+ IIssuer,
6
+ OriginalVerifiableCredential,
7
7
  StatusListDriverType,
8
8
  StatusListType,
9
9
  StatusPurpose2021,
10
10
  } from '@sphereon/ssi-types'
11
- import { CredentialStatus, DIDDocument, IAgentContext, ICredentialPlugin, ProofFormat as VeramoProofFormat } from '@veramo/core'
12
11
 
13
- import { checkStatus } from '@sphereon/vc-status-list'
12
+ import { checkStatus, StatusList } from '@sphereon/vc-status-list'
13
+ import { CredentialStatus, DIDDocument, IAgentContext, ICredentialPlugin, ProofFormat } from '@veramo/core'
14
14
  import { CredentialJwtOrJSON, StatusMethod } from 'credential-status'
15
15
  import {
16
16
  CreateNewStatusListFuncArgs,
17
- Status2021,
18
17
  StatusList2021ToVerifiableCredentialArgs,
18
+ StatusListDetails,
19
19
  StatusListResult,
20
- StatusOAuth,
21
20
  UpdateStatusListFromEncodedListArgs,
22
- UpdateStatusListIndexArgs,
21
+ UpdateStatusListFromStatusListCredentialArgs,
23
22
  } from './types'
24
- import { assertValidProofType, determineStatusListType, getAssertedValue, getAssertedValues } from './utils'
25
- import { getStatusListImplementation } from './impl/StatusListFactory'
26
23
 
27
- export async function fetchStatusListCredential(args: { statusListCredential: string }): Promise<StatusListCredential> {
24
+ export async function fetchStatusListCredential(args: { statusListCredential: string }): Promise<OriginalVerifiableCredential> {
28
25
  const url = getAssertedValue('statusListCredential', args.statusListCredential)
29
26
  try {
30
27
  const response = await fetch(url)
31
28
  if (!response.ok) {
32
- throw Error(`Fetching status list ${url} resulted in an error: ${response.status} : ${response.statusText}`)
29
+ const error = `Fetching status list ${url} resulted in an error: ${response.status} : ${response.statusText}`
30
+ throw Error(error)
33
31
  }
34
32
  const responseAsText = await response.text()
35
33
  if (responseAsText.trim().startsWith('{')) {
36
- return JSON.parse(responseAsText) as StatusListCredential
34
+ return JSON.parse(responseAsText) as OriginalVerifiableCredential
37
35
  }
38
- return responseAsText as StatusListCredential
36
+ return responseAsText as OriginalVerifiableCredential
39
37
  } catch (error) {
40
- console.error(`Fetching status list ${url} resulted in an unexpected error: ${error instanceof Error ? error.message : JSON.stringify(error)}`)
38
+ console.log(`Fetching status list ${url} resulted in an unexpected error: ${error instanceof Error ? error.message : JSON.stringify(error)}`)
41
39
  throw error
42
40
  }
43
41
  }
@@ -54,7 +52,7 @@ export function statusPluginStatusFunction(args: {
54
52
  const result = await checkStatusForCredential({
55
53
  ...args,
56
54
  documentLoader: args.documentLoader,
57
- credential: credential as StatusListCredential,
55
+ credential: credential as OriginalVerifiableCredential,
58
56
  errorUnknownListType: args.errorUnknownListType,
59
57
  })
60
58
 
@@ -77,7 +75,7 @@ export function vcLibCheckStatusFunction(args: {
77
75
  }) {
78
76
  const { mandatoryCredentialStatus, verifyStatusListCredential, verifyMatchingIssuers, errorUnknownListType } = args
79
77
  return (args: {
80
- credential: StatusListCredential
78
+ credential: OriginalVerifiableCredential
81
79
  documentLoader: any
82
80
  suite: any
83
81
  }): Promise<{
@@ -95,7 +93,7 @@ export function vcLibCheckStatusFunction(args: {
95
93
  }
96
94
 
97
95
  export async function checkStatusForCredential(args: {
98
- credential: StatusListCredential
96
+ credential: OriginalVerifiableCredential
99
97
  documentLoader: any
100
98
  suite: any
101
99
  mandatoryCredentialStatus?: boolean
@@ -134,7 +132,7 @@ export async function simpleCheckStatusFromStatusListUrl(args: {
134
132
  type?: StatusListType | 'StatusList2021Entry'
135
133
  id?: string
136
134
  statusListIndex: string
137
- }): Promise<number | Status2021 | StatusOAuth> {
135
+ }): Promise<boolean> {
138
136
  return checkStatusIndexFromStatusListCredential({
139
137
  ...args,
140
138
  statusListCredential: await fetchStatusListCredential(args),
@@ -142,97 +140,163 @@ export async function simpleCheckStatusFromStatusListUrl(args: {
142
140
  }
143
141
 
144
142
  export async function checkStatusIndexFromStatusListCredential(args: {
145
- statusListCredential: StatusListCredential
143
+ statusListCredential: OriginalVerifiableCredential
146
144
  statusPurpose?: StatusPurpose2021
147
145
  type?: StatusListType | 'StatusList2021Entry'
148
146
  id?: string
149
147
  statusListIndex: string | number
150
- }): Promise<number | Status2021 | StatusOAuth> {
151
- const statusListType: StatusListType = determineStatusListType(args.statusListCredential)
152
- const implementation = getStatusListImplementation(statusListType)
153
- return implementation.checkStatusIndex(args)
148
+ }): Promise<boolean> {
149
+ const requestedType = getAssertedStatusListType(args.type?.replace('Entry', '') as StatusListType)
150
+ const uniform = CredentialMapper.toUniformCredential(args.statusListCredential)
151
+ const { issuer, type, credentialSubject, id } = uniform
152
+ getAssertedValue('issuer', issuer) // We are only checking the value here
153
+ getAssertedValue('credentialSubject', credentialSubject)
154
+ if (args.statusPurpose && 'statusPurpose' in credentialSubject) {
155
+ if (args.statusPurpose !== credentialSubject.statusPurpose) {
156
+ throw Error(
157
+ `Status purpose in StatusList credential with id ${id} and value ${credentialSubject.statusPurpose} does not match supplied purpose: ${args.statusPurpose}`,
158
+ )
159
+ }
160
+ } else if (args.id && args.id !== id) {
161
+ throw Error(`Status list id ${id} did not match required supplied id: ${args.id}`)
162
+ }
163
+ if (!type || !(type.includes(requestedType) || type.includes(requestedType + 'Credential'))) {
164
+ throw Error(`Credential type ${JSON.stringify(type)} does not contain requested type ${requestedType}`)
165
+ }
166
+ // @ts-ignore
167
+ const encodedList = getAssertedValue('encodedList', credentialSubject['encodedList'])
168
+
169
+ const statusList = await StatusList.decode({ encodedList })
170
+ const status = statusList.getStatus(typeof args.statusListIndex === 'number' ? args.statusListIndex : Number.parseInt(args.statusListIndex))
171
+ return status
154
172
  }
155
173
 
156
174
  export async function createNewStatusList(
157
175
  args: CreateNewStatusListFuncArgs,
158
176
  context: IAgentContext<ICredentialPlugin & IIdentifierResolution>,
159
177
  ): Promise<StatusListResult> {
160
- const { type } = getAssertedValues(args)
161
- const implementation = getStatusListImplementation(type)
162
- return implementation.createNewStatusList(args, context)
178
+ const length = args?.length ?? 250000
179
+ const proofFormat = args?.proofFormat ?? 'lds'
180
+ const { issuer, type, id } = getAssertedValues(args)
181
+ const correlationId = getAssertedValue('correlationId', args.correlationId)
182
+
183
+ const list = new StatusList({ length })
184
+ const encodedList = await list.encode()
185
+ const statusPurpose = args.statusPurpose ?? 'revocation'
186
+ const statusListCredential = await statusList2021ToVerifiableCredential(
187
+ {
188
+ ...args,
189
+ type,
190
+ proofFormat,
191
+ encodedList,
192
+ },
193
+ context,
194
+ )
195
+
196
+ return {
197
+ encodedList,
198
+ statusListCredential,
199
+ length,
200
+ type,
201
+ proofFormat,
202
+ id,
203
+ correlationId,
204
+ issuer,
205
+ statusPurpose,
206
+ indexingDirection: 'rightToLeft',
207
+ } as StatusListResult
163
208
  }
164
209
 
165
210
  export async function updateStatusIndexFromStatusListCredential(
166
- args: UpdateStatusListIndexArgs,
211
+ args: UpdateStatusListFromStatusListCredentialArgs,
167
212
  context: IAgentContext<ICredentialPlugin & IIdentifierResolution>,
168
- ): Promise<StatusListResult> {
169
- const credential = getAssertedValue('statusListCredential', args.statusListCredential)
170
- const statusListType: StatusListType = determineStatusListType(credential)
171
- const implementation = getStatusListImplementation(statusListType)
172
- return implementation.updateStatusListIndex(args, context)
213
+ ): Promise<StatusListDetails> {
214
+ return updateStatusListIndexFromEncodedList(
215
+ {
216
+ ...(await statusListCredentialToDetails(args)),
217
+ statusListIndex: args.statusListIndex,
218
+ value: args.value,
219
+ },
220
+ context,
221
+ )
173
222
  }
174
223
 
175
- // Keeping helper function for backward compatibility
176
224
  export async function statusListCredentialToDetails(args: {
177
- statusListCredential: StatusListCredential
225
+ statusListCredential: OriginalVerifiableCredential
178
226
  correlationId?: string
179
227
  driverType?: StatusListDriverType
180
- }): Promise<StatusListResult> {
228
+ }): Promise<StatusListDetails> {
181
229
  const credential = getAssertedValue('statusListCredential', args.statusListCredential)
182
-
183
- let statusListType: StatusListType | undefined
184
- const documentFormat = CredentialMapper.detectDocumentType(credential)
185
- if (documentFormat === DocumentFormat.JWT) {
186
- const [header] = credential.split('.')
187
- const decodedHeader = JSON.parse(Buffer.from(header, 'base64').toString())
188
-
189
- if (decodedHeader.typ === 'statuslist+jwt') {
190
- statusListType = StatusListType.OAuthStatusList
191
- }
192
- } else if (documentFormat === DocumentFormat.MSO_MDOC) {
193
- statusListType = StatusListType.OAuthStatusList
194
- // TODO check CBOR content?
230
+ const uniform = CredentialMapper.toUniformCredential(credential)
231
+ const { issuer, type, credentialSubject } = uniform
232
+ if (!type.includes('StatusList2021Credential')) {
233
+ throw Error('StatusList2021Credential type should be present in the Verifiable Credential')
195
234
  }
196
- if (!statusListType) {
197
- const uniform = CredentialMapper.toUniformCredential(credential)
198
- const type = uniform.type.find((t) => t.includes('StatusList2021') || t.includes('OAuth2StatusList'))
199
- if (!type) {
200
- throw new Error('Invalid status list credential type')
201
- }
202
- statusListType = type.replace('Credential', '') as StatusListType
235
+ const id = getAssertedValue('id', uniform.id)
236
+ // @ts-ignore
237
+ const { encodedList, statusPurpose } = credentialSubject
238
+ const proofFormat: ProofFormat = CredentialMapper.detectDocumentType(credential) === DocumentFormat.JWT ? 'jwt' : 'lds'
239
+ return {
240
+ id,
241
+ encodedList,
242
+ issuer,
243
+ type: StatusListType.StatusList2021,
244
+ proofFormat,
245
+ indexingDirection: 'rightToLeft',
246
+ length: (await StatusList.decode({ encodedList })).length,
247
+ statusPurpose,
248
+ statusListCredential: credential,
249
+ ...(args.correlationId && { correlationId: args.correlationId }),
250
+ ...(args.driverType && { driverType: args.driverType }),
203
251
  }
204
-
205
- const implementation = getStatusListImplementation(statusListType)
206
- return await implementation.toStatusListDetails({
207
- statusListPayload: credential,
208
- correlationId: args.correlationId,
209
- driverType: args.driverType,
210
- })
211
252
  }
212
253
 
213
254
  export async function updateStatusListIndexFromEncodedList(
214
255
  args: UpdateStatusListFromEncodedListArgs,
215
256
  context: IAgentContext<ICredentialPlugin & IIdentifierResolution>,
216
- ): Promise<StatusListResult> {
217
- const { type } = getAssertedValue('type', args)
218
- const implementation = getStatusListImplementation(type!)
219
- return implementation.updateStatusListFromEncodedList(args, context)
257
+ ): Promise<StatusListDetails> {
258
+ const { issuer, type, id } = getAssertedValues(args)
259
+ const proofFormat = args?.proofFormat ?? 'lds'
260
+ const origEncodedList = getAssertedValue('encodedList', args.encodedList)
261
+ const index = getAssertedValue('index', typeof args.statusListIndex === 'number' ? args.statusListIndex : Number.parseInt(args.statusListIndex))
262
+ const value = getAssertedValue('value', args.value)
263
+ const statusPurpose = getAssertedValue('statusPurpose', args.statusPurpose)
264
+
265
+ const statusList = await StatusList.decode({ encodedList: origEncodedList })
266
+ statusList.setStatus(index, value)
267
+ const encodedList = await statusList.encode()
268
+ const statusListCredential = await statusList2021ToVerifiableCredential(
269
+ {
270
+ ...args,
271
+ type,
272
+ proofFormat,
273
+ encodedList,
274
+ },
275
+ context,
276
+ )
277
+ return {
278
+ encodedList,
279
+ statusListCredential,
280
+ length: statusList.length - 1,
281
+ type,
282
+ proofFormat,
283
+ id,
284
+ issuer,
285
+ statusPurpose,
286
+ indexingDirection: 'rightToLeft',
287
+ }
220
288
  }
221
289
 
222
290
  export async function statusList2021ToVerifiableCredential(
223
291
  args: StatusList2021ToVerifiableCredentialArgs,
224
292
  context: IAgentContext<ICredentialPlugin & IIdentifierResolution>,
225
- ): Promise<StatusListCredential> {
293
+ ): Promise<OriginalVerifiableCredential> {
226
294
  const { issuer, id, type } = getAssertedValues(args)
227
295
  const identifier = await context.agent.identifierManagedGet({
228
296
  identifier: typeof issuer === 'string' ? issuer : issuer.id,
229
297
  vmRelationship: 'assertionMethod',
230
298
  offlineWhenNoDIDRegistered: true, // FIXME Fix identifier resolution for EBSI
231
299
  })
232
- const proofFormat: ProofFormat = args?.proofFormat ?? 'lds'
233
- assertValidProofType(StatusListType.StatusList2021, proofFormat)
234
- const veramoProofFormat: VeramoProofFormat = proofFormat as VeramoProofFormat
235
-
236
300
  const encodedList = getAssertedValue('encodedList', args.encodedList)
237
301
  const statusPurpose = getAssertedValue('statusPurpose', args.statusPurpose)
238
302
  const credential = {
@@ -252,9 +316,31 @@ export async function statusList2021ToVerifiableCredential(
252
316
  const verifiableCredential = await context.agent.createVerifiableCredential({
253
317
  credential,
254
318
  keyRef: identifier.kmsKeyRef,
255
- proofFormat: veramoProofFormat,
319
+ proofFormat: args.proofFormat ?? 'lds',
256
320
  fetchRemoteContexts: true,
257
321
  })
258
322
 
259
- return CredentialMapper.toWrappedVerifiableCredential(verifiableCredential as StatusListCredential).original as StatusListCredential
323
+ return CredentialMapper.toWrappedVerifiableCredential(verifiableCredential as OriginalVerifiableCredential).original
324
+ }
325
+
326
+ function getAssertedStatusListType(type?: StatusListType) {
327
+ const assertedType = type ?? StatusListType.StatusList2021
328
+ if (assertedType !== StatusListType.StatusList2021) {
329
+ throw Error(`StatusList type ${assertedType} is not supported (yet)`)
330
+ }
331
+ return assertedType
332
+ }
333
+
334
+ function getAssertedValue<T>(name: string, value: T): NonNullable<T> {
335
+ if (value === undefined || value === null) {
336
+ throw Error(`Missing required ${name} value`)
337
+ }
338
+ return value
339
+ }
340
+
341
+ function getAssertedValues(args: { issuer: string | IIssuer; id: string; type?: StatusListType }) {
342
+ const type = getAssertedStatusListType(args?.type)
343
+ const id = getAssertedValue('id', args.id)
344
+ const issuer = getAssertedValue('issuer', args.issuer)
345
+ return { id, issuer, type }
260
346
  }
@@ -4,9 +4,8 @@ import {
4
4
  ICredentialStatus,
5
5
  IIssuer,
6
6
  IVerifiableCredential,
7
+ OriginalVerifiableCredential,
7
8
  OrPromise,
8
- ProofFormat,
9
- StatusListCredential,
10
9
  StatusListCredentialIdMode,
11
10
  StatusListDriverType,
12
11
  StatusListIndexingDirection,
@@ -19,104 +18,58 @@ import {
19
18
  ICredentialIssuer,
20
19
  ICredentialPlugin,
21
20
  ICredentialVerifier,
22
- IKeyManager,
23
21
  IPluginMethodMap,
22
+ ProofFormat,
24
23
  } from '@veramo/core'
25
24
  import { DataSource } from 'typeorm'
26
- import { BitsPerStatus } from '@sd-jwt/jwt-status-list/dist'
27
- import { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc'
28
- import { StatusListOpts } from '@sphereon/oid4vci-common'
29
-
30
- export enum StatusOAuth {
31
- Valid = 0,
32
- Invalid = 1,
33
- Suspended = 2,
34
- }
35
-
36
- export enum Status2021 {
37
- Valid = 0,
38
- Invalid = 1,
39
- }
40
-
41
- export type StatusList2021Args = {
42
- indexingDirection: StatusListIndexingDirection
43
- statusPurpose?: StatusPurpose2021
44
- // todo: validFrom and validUntil
45
- }
46
25
 
47
- export type OAuthStatusListArgs = {
48
- bitsPerStatus?: BitsPerStatus
49
- expiresAt?: Date
50
- }
51
-
52
- export type BaseCreateNewStatusListArgs = {
53
- type: StatusListType
54
- id: string
55
- issuer: string | IIssuer
56
- correlationId?: string
26
+ export interface CreateNewStatusListFuncArgs extends Omit<StatusList2021ToVerifiableCredentialArgs, 'encodedList'> {
27
+ correlationId: string
57
28
  length?: number
58
- proofFormat?: ProofFormat
59
- keyRef?: string
60
- statusList2021?: StatusList2021Args
61
- oauthStatusList?: OAuthStatusListArgs
62
29
  }
63
30
 
64
- export type UpdateStatusList2021Args = {
65
- statusPurpose: StatusPurpose2021
31
+ export interface UpdateStatusListFromEncodedListArgs extends StatusList2021ToVerifiableCredentialArgs {
32
+ statusListIndex: number | string
33
+ value: boolean
66
34
  }
67
35
 
68
- export type UpdateOAuthStatusListArgs = {
69
- bitsPerStatus: BitsPerStatus
70
- expiresAt?: Date
36
+ export interface UpdateStatusListFromStatusListCredentialArgs {
37
+ statusListCredential: OriginalVerifiableCredential
38
+ keyRef?: string
39
+ statusListIndex: number | string
40
+ value: boolean
71
41
  }
72
42
 
73
- export interface UpdateStatusListFromEncodedListArgs {
43
+ export interface StatusList2021ToVerifiableCredentialArgs {
44
+ issuer: string | IIssuer
45
+ id: string
74
46
  type?: StatusListType
75
- statusListIndex: number | string
76
- value: boolean
47
+ statusPurpose: StatusPurpose2021
48
+ encodedList: string
77
49
  proofFormat?: ProofFormat
78
50
  keyRef?: string
79
- correlationId?: string
80
- encodedList: string
81
- issuer: string | IIssuer
82
- id: string
83
- statusList2021?: UpdateStatusList2021Args
84
- oauthStatusList?: UpdateOAuthStatusListArgs
85
- }
86
51
 
87
- export interface UpdateStatusListFromStatusListCredentialArgs {
88
- statusListCredential: StatusListCredential // | CompactJWT
89
- keyRef?: string
90
- statusListIndex: number | string
91
- value: number | Status2021 | StatusOAuth
52
+ // todo: validFrom and validUntil
92
53
  }
93
54
 
94
- export interface StatusListResult {
55
+ export interface StatusListDetails {
95
56
  encodedList: string
96
- statusListCredential: StatusListCredential
97
57
  length: number
98
58
  type: StatusListType
99
59
  proofFormat: ProofFormat
60
+ statusPurpose: StatusPurpose2021
100
61
  id: string
101
- statuslistContentType: string
102
62
  issuer: string | IIssuer
103
- statusList2021?: StatusList2021Details
104
- oauthStatusList?: OAuthStatusDetails
105
-
63
+ indexingDirection: StatusListIndexingDirection
64
+ statusListCredential: OriginalVerifiableCredential
106
65
  // These cannot be deduced from the VC, so they are present when callers pass in these values as params
107
66
  correlationId?: string
108
67
  driverType?: StatusListDriverType
109
68
  credentialIdMode?: StatusListCredentialIdMode
110
69
  }
111
70
 
112
- interface StatusList2021Details {
113
- indexingDirection: StatusListIndexingDirection
114
- statusPurpose?: StatusPurpose2021
115
- }
116
-
117
- interface OAuthStatusDetails {
118
- bitsPerStatus?: BitsPerStatus
119
- expiresAt?: Date
71
+ export interface StatusListResult extends StatusListDetails {
72
+ statusListCredential: OriginalVerifiableCredential
120
73
  }
121
74
 
122
75
  export interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
@@ -126,54 +79,6 @@ export interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
126
79
  statusListCredential: string
127
80
  }
128
81
 
129
- export interface StatusListOAuthEntryCredentialStatus extends ICredentialStatus {
130
- type: 'OAuthStatusListEntry'
131
- bitsPerStatus: number
132
- statusListIndex: string
133
- statusListCredential: string
134
- expiresAt?: Date
135
- }
136
-
137
- export interface StatusList2021ToVerifiableCredentialArgs {
138
- issuer: string | IIssuer
139
- id: string
140
- type?: StatusListType
141
- proofFormat?: ProofFormat
142
- keyRef?: string
143
- encodedList: string
144
- statusPurpose: StatusPurpose2021
145
- }
146
-
147
- export interface CreateStatusListArgs {
148
- issuer: string | IIssuer
149
- id: string
150
- proofFormat?: ProofFormat
151
- keyRef?: string
152
- correlationId?: string
153
- length?: number
154
- statusList2021?: StatusList2021Args
155
- oauthStatusList?: OAuthStatusListArgs
156
- }
157
-
158
- export interface UpdateStatusListIndexArgs {
159
- statusListCredential: StatusListCredential // | CompactJWT
160
- statusListIndex: number | string
161
- value: number | Status2021 | StatusOAuth
162
- keyRef?: string
163
- expiresAt?: Date
164
- }
165
-
166
- export interface CheckStatusIndexArgs {
167
- statusListCredential: StatusListCredential // | CompactJWT
168
- statusListIndex: string | number
169
- }
170
-
171
- export interface ToStatusListDetailsArgs {
172
- statusListPayload: StatusListCredential
173
- correlationId?: string
174
- driverType?: StatusListDriverType
175
- }
176
-
177
82
  /**
178
83
  * The interface definition for a plugin that can add statuslist info to a credential
179
84
  *
@@ -190,7 +95,7 @@ export interface IStatusListPlugin extends IPluginMethodMap {
190
95
  *
191
96
  * @returns - The details of the newly created status list
192
97
  */
193
- slCreateStatusList(args: CreateNewStatusListArgs, context: IRequiredContext): Promise<StatusListResult>
98
+ slCreateStatusList(args: CreateNewStatusListArgs, context: IRequiredContext): Promise<StatusListDetails>
194
99
 
195
100
  /**
196
101
  * Ensures status list info like index and list id is added to a credential
@@ -204,36 +109,25 @@ export interface IStatusListPlugin extends IPluginMethodMap {
204
109
  */
205
110
  slAddStatusToCredential(args: IAddStatusToCredentialArgs, context: IRequiredContext): Promise<CredentialWithStatusSupport>
206
111
 
207
- slAddStatusToSdJwtCredential(args: IAddStatusToSdJwtCredentialArgs, context: IRequiredContext): Promise<SdJwtVcPayload>
208
-
209
112
  /**
210
113
  * Get the status list using the configured driver for the SL. Normally a correlationId or id should suffice. Optionally accepts a dbName/datasource
211
114
  * @param args
212
115
  * @param context
213
116
  */
214
- slGetStatusList(args: GetStatusListArgs, context: IRequiredContext): Promise<StatusListResult>
215
- }
216
-
217
- export type CreateNewStatusListFuncArgs = BaseCreateNewStatusListArgs
218
-
219
- export type CreateNewStatusListArgs = BaseCreateNewStatusListArgs & {
220
- dataSource?: OrPromise<DataSource>
221
- dbName?: string
222
- isDefault?: boolean
117
+ slGetStatusList(args: GetStatusListArgs, context: IRequiredContext): Promise<StatusListDetails>
223
118
  }
224
119
 
225
120
  export type IAddStatusToCredentialArgs = Omit<IIssueCredentialStatusOpts, 'dataSource'> & {
226
121
  credential: CredentialWithStatusSupport
227
122
  }
228
123
 
229
- export type IAddStatusToSdJwtCredentialArgs = Omit<IIssueCredentialStatusOpts, 'dataSource'> & {
230
- credential: SdJwtVcPayload
231
- }
232
-
233
124
  export interface IIssueCredentialStatusOpts {
234
125
  dataSource?: DataSource
235
- statusListOpts?: Array<StatusListOpts>
126
+
236
127
  credentialId?: string // An id to use for the credential. Normally should be set as the crdential.id value
128
+ statusListId?: string // Explicit status list to use. Determines the id from the credentialStatus object in the VC itself or uses the default otherwise
129
+ statusListIndex?: number | string
130
+ statusEntryCorrelationId?: string // An id to use for correlation. Can be the credential id, but also a business identifier. Will only be used for lookups/management
237
131
  value?: string
238
132
  }
239
133
 
@@ -244,12 +138,13 @@ export type GetStatusListArgs = {
244
138
  dbName?: string
245
139
  }
246
140
 
247
- export type CredentialWithStatusSupport = ICredential | CredentialPayload | IVerifiableCredential
248
-
249
- export type SignedStatusListData = {
250
- statusListCredential: StatusListCredential
251
- encodedList: string
141
+ export type CreateNewStatusListArgs = CreateNewStatusListFuncArgs & {
142
+ dataSource?: OrPromise<DataSource>
143
+ dbName?: string
144
+ isDefault?: boolean
252
145
  }
253
146
 
147
+ export type CredentialWithStatusSupport = ICredential | CredentialPayload | IVerifiableCredential
148
+
254
149
  export type IRequiredPlugins = ICredentialPlugin & IIdentifierResolution
255
- export type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution & IKeyManager & ICredentialPlugin>
150
+ export type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution>
@@ -1,26 +0,0 @@
1
- import { IAgentContext, ICredentialPlugin } from '@veramo/core';
2
- import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
3
- import { CheckStatusIndexArgs, CreateStatusListArgs, Status2021, StatusListResult, StatusOAuth, ToStatusListDetailsArgs, UpdateStatusListFromEncodedListArgs, UpdateStatusListIndexArgs } from '../types';
4
- export interface IStatusList {
5
- /**
6
- * Creates a new status list of the specific type
7
- */
8
- createNewStatusList(args: CreateStatusListArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
9
- /**
10
- * Updates a status at the given index in the status list
11
- */
12
- updateStatusListIndex(args: UpdateStatusListIndexArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
13
- /**
14
- * Updates a status list using a base64 encoded list of statuses
15
- */
16
- updateStatusListFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
17
- /**
18
- * Checks the status at a given index in the status list
19
- */
20
- checkStatusIndex(args: CheckStatusIndexArgs): Promise<number | Status2021 | StatusOAuth>;
21
- /**
22
- * Collects the status list details
23
- */
24
- toStatusListDetails(args: ToStatusListDetailsArgs): Promise<StatusListResult>;
25
- }
26
- //# sourceMappingURL=IStatusList.d.ts.map