@sphereon/ssi-sdk.vc-status-list 0.32.1-fix.160 → 0.32.1-next.113

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 +30 -115
  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 +3 -11
  10. package/src/functions.ts +159 -73
  11. package/src/types/index.ts +34 -132
  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 -20
  17. package/dist/impl/OAuthStatusList.d.ts.map +0 -1
  18. package/dist/impl/OAuthStatusList.js +0 -147
  19. package/dist/impl/OAuthStatusList.js.map +0 -1
  20. package/dist/impl/StatusList2021.d.ts +0 -15
  21. package/dist/impl/StatusList2021.d.ts.map +0 -1
  22. package/dist/impl/StatusList2021.js +0 -170
  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 -196
  46. package/src/impl/StatusList2021.ts +0 -223
  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-fix.160+61781f48",
4
+ "version": "0.32.1-next.113+5b666268",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -10,20 +10,14 @@
10
10
  "build:clean": "tsc --build --clean && tsc --build"
11
11
  },
12
12
  "dependencies": {
13
- "@sd-jwt/jwt-status-list": "^0.9.1",
14
- "@sphereon/kmp-cbor": "0.2.0-SNAPSHOT.25",
15
13
  "@sphereon/ssi-sdk-ext.did-utils": "0.27.0",
16
14
  "@sphereon/ssi-sdk-ext.identifier-resolution": "0.27.0",
17
- "@sphereon/ssi-sdk-ext.jwt-service": "0.27.0",
18
- "@sphereon/ssi-types": "0.32.1-fix.160+61781f48",
15
+ "@sphereon/ssi-types": "0.32.1-next.113+5b666268",
19
16
  "@sphereon/vc-status-list": "7.0.0-next.0",
20
17
  "@veramo/core": "4.2.0",
21
18
  "@veramo/credential-status": "4.2.0",
22
- "base64url": "^3.0.1",
23
19
  "credential-status": "^2.0.6",
24
20
  "debug": "^4.3.5",
25
- "jwt-decode": "^4.0.0",
26
- "pako": "^2.1.0",
27
21
  "typeorm": "^0.3.20",
28
22
  "uint8arrays": "^3.1.1"
29
23
  },
@@ -32,8 +26,6 @@
32
26
  "@babel/core": "^7.24.9",
33
27
  "@babel/preset-env": "^7.24.8",
34
28
  "@babel/preset-typescript": "^7.24.7",
35
- "@types/pako": "2.0.3",
36
- "@veramo/key-manager": "4.2.0",
37
29
  "typescript": "5.4.2"
38
30
  },
39
31
  "files": [
@@ -55,5 +47,5 @@
55
47
  "StatusList2021"
56
48
  ],
57
49
  "nx": {},
58
- "gitHead": "61781f48e7a0ae4621b18557d4dc37603c51c37c"
50
+ "gitHead": "5b666268b482b6a08a6edc00b4b713faf69247e1"
59
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,13 +4,12 @@ import {
4
4
  ICredentialStatus,
5
5
  IIssuer,
6
6
  IVerifiableCredential,
7
+ OriginalVerifiableCredential,
7
8
  OrPromise,
8
- ProofFormat,
9
9
  StatusListCredentialIdMode,
10
10
  StatusListDriverType,
11
11
  StatusListIndexingDirection,
12
12
  StatusListType,
13
- StatusListCredential,
14
13
  StatusPurpose2021,
15
14
  } from '@sphereon/ssi-types'
16
15
  import {
@@ -19,101 +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
-
28
- export enum StatusOAuth {
29
- Valid = 0,
30
- Invalid = 1,
31
- Suspended = 2,
32
- }
33
-
34
- export enum Status2021 {
35
- Valid = 0,
36
- Invalid = 1,
37
- }
38
-
39
- export type StatusList2021Args = {
40
- indexingDirection: StatusListIndexingDirection
41
- statusPurpose?: StatusPurpose2021
42
- // todo: validFrom and validUntil
43
- }
44
-
45
- export type OAuthStatusListArgs = {
46
- bitsPerStatus?: BitsPerStatus
47
- expiresAt?: Date
48
- }
49
25
 
50
- export type BaseCreateNewStatusListArgs = {
51
- type: StatusListType
52
- id: string
53
- issuer: string | IIssuer
54
- correlationId?: string
26
+ export interface CreateNewStatusListFuncArgs extends Omit<StatusList2021ToVerifiableCredentialArgs, 'encodedList'> {
27
+ correlationId: string
55
28
  length?: number
56
- proofFormat?: ProofFormat
57
- keyRef?: string
58
- statusList2021?: StatusList2021Args
59
- oauthStatusList?: OAuthStatusListArgs
60
29
  }
61
30
 
62
- export type UpdateStatusList2021Args = {
63
- statusPurpose: StatusPurpose2021
31
+ export interface UpdateStatusListFromEncodedListArgs extends StatusList2021ToVerifiableCredentialArgs {
32
+ statusListIndex: number | string
33
+ value: boolean
64
34
  }
65
35
 
66
- export type UpdateOAuthStatusListArgs = {
67
- bitsPerStatus: BitsPerStatus
68
- expiresAt?: Date
36
+ export interface UpdateStatusListFromStatusListCredentialArgs {
37
+ statusListCredential: OriginalVerifiableCredential
38
+ keyRef?: string
39
+ statusListIndex: number | string
40
+ value: boolean
69
41
  }
70
42
 
71
- export interface UpdateStatusListFromEncodedListArgs {
43
+ export interface StatusList2021ToVerifiableCredentialArgs {
44
+ issuer: string | IIssuer
45
+ id: string
72
46
  type?: StatusListType
73
- statusListIndex: number | string
74
- value: boolean
47
+ statusPurpose: StatusPurpose2021
48
+ encodedList: string
75
49
  proofFormat?: ProofFormat
76
50
  keyRef?: string
77
- correlationId?: string
78
- encodedList: string
79
- issuer: string | IIssuer
80
- id: string
81
- statusList2021?: UpdateStatusList2021Args
82
- oauthStatusList?: UpdateOAuthStatusListArgs
83
- }
84
51
 
85
- export interface UpdateStatusListFromStatusListCredentialArgs {
86
- statusListCredential: StatusListCredential // | CompactJWT
87
- keyRef?: string
88
- statusListIndex: number | string
89
- value: number | Status2021 | StatusOAuth
52
+ // todo: validFrom and validUntil
90
53
  }
91
54
 
92
- export interface StatusListResult {
55
+ export interface StatusListDetails {
93
56
  encodedList: string
94
- statusListCredential: StatusListCredential // | CompactJWT
95
57
  length: number
96
58
  type: StatusListType
97
59
  proofFormat: ProofFormat
60
+ statusPurpose: StatusPurpose2021
98
61
  id: string
99
62
  issuer: string | IIssuer
100
- statusList2021?: StatusList2021Details
101
- oauthStatusList?: OAuthStatusDetails
102
-
63
+ indexingDirection: StatusListIndexingDirection
64
+ statusListCredential: OriginalVerifiableCredential
103
65
  // These cannot be deduced from the VC, so they are present when callers pass in these values as params
104
66
  correlationId?: string
105
67
  driverType?: StatusListDriverType
106
68
  credentialIdMode?: StatusListCredentialIdMode
107
69
  }
108
70
 
109
- interface StatusList2021Details {
110
- indexingDirection: StatusListIndexingDirection
111
- statusPurpose?: StatusPurpose2021
112
- }
113
-
114
- interface OAuthStatusDetails {
115
- bitsPerStatus?: BitsPerStatus
116
- expiresAt?: Date
71
+ export interface StatusListResult extends StatusListDetails {
72
+ statusListCredential: OriginalVerifiableCredential
117
73
  }
118
74
 
119
75
  export interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
@@ -123,54 +79,6 @@ export interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
123
79
  statusListCredential: string
124
80
  }
125
81
 
126
- export interface StatusListOAuthEntryCredentialStatus extends ICredentialStatus {
127
- type: 'OAuthStatusListEntry'
128
- bitsPerStatus: number
129
- statusListIndex: string
130
- statusListCredential: string
131
- expiresAt?: Date
132
- }
133
-
134
- export interface StatusList2021ToVerifiableCredentialArgs {
135
- issuer: string | IIssuer
136
- id: string
137
- type?: StatusListType
138
- proofFormat?: ProofFormat
139
- keyRef?: string
140
- encodedList: string
141
- statusPurpose: StatusPurpose2021
142
- }
143
-
144
- export interface CreateStatusListArgs {
145
- issuer: string | IIssuer
146
- id: string
147
- proofFormat?: ProofFormat
148
- keyRef?: string
149
- correlationId?: string
150
- length?: number
151
- statusList2021?: StatusList2021Args
152
- oauthStatusList?: OAuthStatusListArgs
153
- }
154
-
155
- export interface UpdateStatusListIndexArgs {
156
- statusListCredential: StatusListCredential // | CompactJWT
157
- statusListIndex: number | string
158
- value: number | Status2021 | StatusOAuth
159
- keyRef?: string
160
- expiresAt?: Date
161
- }
162
-
163
- export interface CheckStatusIndexArgs {
164
- statusListCredential: StatusListCredential // | CompactJWT
165
- statusListIndex: string | number
166
- }
167
-
168
- export interface ToStatusListDetailsArgs {
169
- statusListPayload: StatusListCredential
170
- correlationId?: string
171
- driverType?: StatusListDriverType
172
- }
173
-
174
82
  /**
175
83
  * The interface definition for a plugin that can add statuslist info to a credential
176
84
  *
@@ -187,7 +95,7 @@ export interface IStatusListPlugin extends IPluginMethodMap {
187
95
  *
188
96
  * @returns - The details of the newly created status list
189
97
  */
190
- slCreateStatusList(args: CreateNewStatusListArgs, context: IRequiredContext): Promise<StatusListResult>
98
+ slCreateStatusList(args: CreateNewStatusListArgs, context: IRequiredContext): Promise<StatusListDetails>
191
99
 
192
100
  /**
193
101
  * Ensures status list info like index and list id is added to a credential
@@ -206,15 +114,7 @@ export interface IStatusListPlugin extends IPluginMethodMap {
206
114
  * @param args
207
115
  * @param context
208
116
  */
209
- slGetStatusList(args: GetStatusListArgs, context: IRequiredContext): Promise<StatusListResult>
210
- }
211
-
212
- export type CreateNewStatusListFuncArgs = BaseCreateNewStatusListArgs
213
-
214
- export type CreateNewStatusListArgs = BaseCreateNewStatusListArgs & {
215
- dataSource?: OrPromise<DataSource>
216
- dbName?: string
217
- isDefault?: boolean
117
+ slGetStatusList(args: GetStatusListArgs, context: IRequiredContext): Promise<StatusListDetails>
218
118
  }
219
119
 
220
120
  export type IAddStatusToCredentialArgs = Omit<IIssueCredentialStatusOpts, 'dataSource'> & {
@@ -223,6 +123,7 @@ export type IAddStatusToCredentialArgs = Omit<IIssueCredentialStatusOpts, 'dataS
223
123
 
224
124
  export interface IIssueCredentialStatusOpts {
225
125
  dataSource?: DataSource
126
+
226
127
  credentialId?: string // An id to use for the credential. Normally should be set as the crdential.id value
227
128
  statusListId?: string // Explicit status list to use. Determines the id from the credentialStatus object in the VC itself or uses the default otherwise
228
129
  statusListIndex?: number | string
@@ -237,12 +138,13 @@ export type GetStatusListArgs = {
237
138
  dbName?: string
238
139
  }
239
140
 
240
- export type CredentialWithStatusSupport = ICredential | CredentialPayload | IVerifiableCredential
241
-
242
- export type SignedStatusListData = {
243
- statusListCredential: StatusListCredential
244
- encodedList: string
141
+ export type CreateNewStatusListArgs = CreateNewStatusListFuncArgs & {
142
+ dataSource?: OrPromise<DataSource>
143
+ dbName?: string
144
+ isDefault?: boolean
245
145
  }
246
146
 
147
+ export type CredentialWithStatusSupport = ICredential | CredentialPayload | IVerifiableCredential
148
+
247
149
  export type IRequiredPlugins = ICredentialPlugin & IIdentifierResolution
248
- export type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution & IKeyManager>
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"IStatusList.d.ts","sourceRoot":"","sources":["../../src/impl/IStatusList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,uBAAuB,EACvB,mCAAmC,EACnC,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,aAAa,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAE7I;;OAEG;IACH,qBAAqB,CAAC,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,aAAa,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAEpJ;;OAEG;IACH,+BAA+B,CAC7B,IAAI,EAAE,mCAAmC,EACzC,OAAO,EAAE,aAAa,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,GAChE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAE5B;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC,CAAA;IAExF;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAC9E"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IStatusList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IStatusList.js","sourceRoot":"","sources":["../../src/impl/IStatusList.ts"],"names":[],"mappings":""}