@sphereon/ssi-sdk.vc-status-list 0.34.1-feature.SSISDK.26.RP.57 → 0.34.1-feature.SSISDK.44.finish.dcql.309

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/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.26.RP.57+9836fe9c",
4
+ "version": "0.34.1-feature.SSISDK.44.finish.dcql.309+dbfc561c",
5
5
  "source": "src/index.ts",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",
@@ -23,17 +23,18 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@4sure-tech/vc-bitstring-status-lists": "0.1.0-unstable.1",
26
- "@sd-jwt/core": "^0.9.2",
27
- "@sd-jwt/jwt-status-list": "^0.9.1",
28
- "@sd-jwt/sd-jwt-vc": "^0.9.2",
26
+ "@sd-jwt/core": "^0.15.0",
27
+ "@sd-jwt/jwt-status-list": "^0.15.0",
28
+ "@sd-jwt/sd-jwt-vc": "^0.15.1",
29
29
  "@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
30
- "@sphereon/oid4vci-common": "0.19.1-feature.SSISDK.13.32",
31
- "@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.26.RP.57+9836fe9c",
32
- "@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.SSISDK.26.RP.57+9836fe9c",
33
- "@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-feature.SSISDK.26.RP.57+9836fe9c",
34
- "@sphereon/ssi-sdk.credential-vcdm": "0.34.1-feature.SSISDK.26.RP.57+9836fe9c",
35
- "@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.26.RP.57+9836fe9c",
36
- "@sphereon/ssi-types": "0.34.1-feature.SSISDK.26.RP.57+9836fe9c",
30
+ "@sphereon/oid4vci-common": "0.19.1-next.220",
31
+ "@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.44.finish.dcql.309+dbfc561c",
32
+ "@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.SSISDK.44.finish.dcql.309+dbfc561c",
33
+ "@sphereon/ssi-sdk-ext.jwt-service": "0.34.1-feature.SSISDK.44.finish.dcql.309+dbfc561c",
34
+ "@sphereon/ssi-sdk.credential-vcdm": "0.34.1-feature.SSISDK.44.finish.dcql.309+dbfc561c",
35
+ "@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.44.finish.dcql.309+dbfc561c",
36
+ "@sphereon/ssi-sdk.data-store-types": "0.34.1-feature.SSISDK.44.finish.dcql.309+dbfc561c",
37
+ "@sphereon/ssi-types": "0.34.1-feature.SSISDK.44.finish.dcql.309+dbfc561c",
37
38
  "@sphereon/vc-status-list": "7.0.0-next.0",
38
39
  "@veramo/core": "4.2.0",
39
40
  "@veramo/credential-status": "4.2.0",
@@ -72,5 +73,5 @@
72
73
  "SSI",
73
74
  "StatusList2021"
74
75
  ],
75
- "gitHead": "9836fe9c1ba582b925c14e88fb09c43938edd9b2"
76
+ "gitHead": "dbfc561c168d680c69e1808dc13864d35573523c"
76
77
  }
@@ -6,6 +6,7 @@ import {
6
6
  DocumentFormat,
7
7
  type IIssuer,
8
8
  type StatusListCredential,
9
+ StatusListCredentialIdMode,
9
10
  StatusListType,
10
11
  } from '@sphereon/ssi-types'
11
12
 
@@ -60,6 +61,7 @@ export class StatusList2021Implementation implements IStatusList {
60
61
  statusList2021: {
61
62
  statusPurpose,
62
63
  indexingDirection: 'rightToLeft',
64
+ credentialIdMode: StatusListCredentialIdMode.ISSUANCE,
63
65
  },
64
66
  length,
65
67
  type: StatusListType.StatusList2021,
@@ -108,6 +110,7 @@ export class StatusList2021Implementation implements IStatusList {
108
110
  statusList2021: {
109
111
  statusPurpose: credentialSubject.statusPurpose,
110
112
  indexingDirection: 'rightToLeft',
113
+ credentialIdMode: StatusListCredentialIdMode.ISSUANCE,
111
114
  },
112
115
  length: statusList.length - 1,
113
116
  type: StatusListType.StatusList2021,
@@ -153,6 +156,7 @@ export class StatusList2021Implementation implements IStatusList {
153
156
  statusList2021: {
154
157
  statusPurpose: args.statusList2021.statusPurpose,
155
158
  indexingDirection: 'rightToLeft',
159
+ credentialIdMode: StatusListCredentialIdMode.ISSUANCE,
156
160
  },
157
161
  length: statusList.length,
158
162
  proofFormat: args.proofFormat ?? 'lds',
@@ -224,6 +228,7 @@ export class StatusList2021Implementation implements IStatusList {
224
228
  statusList2021: {
225
229
  indexingDirection: 'rightToLeft',
226
230
  statusPurpose,
231
+ credentialIdMode: StatusListCredentialIdMode.ISSUANCE,
227
232
  },
228
233
  }
229
234
  } else {
@@ -251,6 +256,7 @@ export class StatusList2021Implementation implements IStatusList {
251
256
  statusList2021: {
252
257
  indexingDirection: statusList2021Entity.indexingDirection,
253
258
  statusPurpose: statusList2021Entity.statusPurpose,
259
+ credentialIdMode: StatusListCredentialIdMode.ISSUANCE,
254
260
  },
255
261
  }
256
262
  }
@@ -2,20 +2,21 @@ import type { BitsPerStatus } from '@sd-jwt/jwt-status-list'
2
2
  import { StatusList } from '@sd-jwt/jwt-status-list'
3
3
  import { deflate, inflate } from 'pako'
4
4
 
5
- import * as mdoc from '@sphereon/kmp-mdoc-core'
5
+ import mdocPkg from '@sphereon/kmp-mdoc-core'
6
+ const { com, kotlin } = mdocPkg
6
7
 
7
8
  import base64url from 'base64url'
8
9
  import type { IRequiredContext, SignedStatusListData } from '../../types'
9
10
  import { type DecodedStatusListPayload, resolveIdentifier } from './common'
10
11
 
11
- export type IKey = mdoc.com.sphereon.crypto.IKey
12
- export type CborItem<T> = mdoc.com.sphereon.cbor.CborItem<T>
13
- export const CborByteString = mdoc.com.sphereon.cbor.CborByteString
14
- export type CborByteStringType = mdoc.com.sphereon.cbor.CborByteString
15
- export const CborUInt = mdoc.com.sphereon.cbor.CborUInt
16
- export type CborUIntType = mdoc.com.sphereon.cbor.CborUInt
17
- export const CborString = mdoc.com.sphereon.cbor.CborString
18
- export type CborStringType = mdoc.com.sphereon.cbor.CborString
12
+ export type IKey = mdocPkg.com.sphereon.crypto.IKey
13
+ export type CborItem<T> = mdocPkg.com.sphereon.cbor.CborItem<T>
14
+ export const CborByteString = mdocPkg.com.sphereon.cbor.CborByteString
15
+ export type CborByteStringType = mdocPkg.com.sphereon.cbor.CborByteString
16
+ export const CborUInt = mdocPkg.com.sphereon.cbor.CborUInt
17
+ export type CborUIntType = mdocPkg.com.sphereon.cbor.CborUInt
18
+ export const CborString = mdocPkg.com.sphereon.cbor.CborString
19
+ export type CborStringType = mdocPkg.com.sphereon.cbor.CborString
19
20
 
20
21
  // const cbor = cborpkg.com.sphereon.cbor
21
22
  // const kmp = cborpkg. mdoc.com.sphereon.kmp
@@ -45,28 +46,26 @@ export const createSignedCbor = async (
45
46
  const compressedList = deflate(encodeStatusList, { level: 9 })
46
47
  const compressedBytes = new Int8Array(compressedList)
47
48
 
48
- const statusListMap = new mdoc.com.sphereon.cbor.CborMap(
49
- mdoc.kotlin.collections.KtMutableMap.fromJsMap(
49
+ const statusListMap = new com.sphereon.cbor.CborMap(
50
+ kotlin.collections.KtMutableMap.fromJsMap(
50
51
  new Map<CborStringType, CborItem<any>>([
51
52
  [
52
- new mdoc.com.sphereon.cbor.CborString('bits'),
53
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(statusList.getBitsPerStatus())),
53
+ new com.sphereon.cbor.CborString('bits'),
54
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(statusList.getBitsPerStatus())),
54
55
  ],
55
- [new mdoc.com.sphereon.cbor.CborString('lst'), new mdoc.com.sphereon.cbor.CborByteString(compressedBytes)],
56
+ [new com.sphereon.cbor.CborString('lst'), new com.sphereon.cbor.CborByteString(compressedBytes)],
56
57
  ]),
57
58
  ),
58
59
  )
59
60
 
60
- const protectedHeader = new mdoc.com.sphereon.cbor.CborMap(
61
- mdoc.kotlin.collections.KtMutableMap.fromJsMap(
62
- new Map([
63
- [new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(16)), new mdoc.com.sphereon.cbor.CborString('statuslist+cwt')],
64
- ]), // "type"
61
+ const protectedHeader = new com.sphereon.cbor.CborMap(
62
+ kotlin.collections.KtMutableMap.fromJsMap(
63
+ new Map([[new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(16)), new com.sphereon.cbor.CborString('statuslist+cwt')]]), // "type"
65
64
  ),
66
65
  )
67
- const protectedHeaderEncoded = mdoc.com.sphereon.cbor.Cbor.encode(protectedHeader)
66
+ const protectedHeaderEncoded = com.sphereon.cbor.Cbor.encode(protectedHeader)
68
67
  const claimsMap = buildClaimsMap(id, issuerString, statusListMap, expiresAt)
69
- const claimsEncoded: Int8Array = mdoc.com.sphereon.cbor.Cbor.encode(claimsMap)
68
+ const claimsEncoded: Int8Array = com.sphereon.cbor.Cbor.encode(claimsMap)
70
69
 
71
70
  const signedCWT: string = await context.agent.keyManagerSign({
72
71
  keyRef: identifier.kmsKeyRef,
@@ -84,8 +83,8 @@ export const createSignedCbor = async (
84
83
  new CborByteString(claimsEncodedInt8),
85
84
  new CborByteString(signatureInt8),
86
85
  ]
87
- const cwtArray = new mdoc.com.sphereon.cbor.CborArray(mdoc.kotlin.collections.KtMutableList.fromJsArray(cwtArrayElements))
88
- const cwtEncoded = mdoc.com.sphereon.cbor.Cbor.encode(cwtArray)
86
+ const cwtArray = new com.sphereon.cbor.CborArray(kotlin.collections.KtMutableList.fromJsArray(cwtArrayElements))
87
+ const cwtEncoded = com.sphereon.cbor.Cbor.encode(cwtArray)
89
88
  const cwtBuffer = Buffer.from(cwtEncoded)
90
89
  return {
91
90
  statusListCredential: base64url.encode(cwtBuffer),
@@ -96,36 +95,36 @@ export const createSignedCbor = async (
96
95
  function buildClaimsMap(
97
96
  id: string,
98
97
  issuerString: string,
99
- statusListMap: mdoc.com.sphereon.cbor.CborMap<CborStringType, CborItem<any>>,
98
+ statusListMap: mdocPkg.com.sphereon.cbor.CborMap<CborStringType, CborItem<any>>,
100
99
  expiresAt?: Date,
101
100
  ) {
102
101
  const ttl = 65535 // FIXME figure out what value should be / come from and what the difference is with exp
103
102
  const claimsEntries: Array<[CborUIntType, CborItem<any>]> = [
104
- [new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.SUBJECT)), new mdoc.com.sphereon.cbor.CborString(id)], // "sub"
105
- [new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUER)), new mdoc.com.sphereon.cbor.CborString(issuerString)], // "iss"
103
+ [new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.SUBJECT)), new com.sphereon.cbor.CborString(id)], // "sub"
104
+ [new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUER)), new com.sphereon.cbor.CborString(issuerString)], // "iss"
106
105
  [
107
- new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUED_AT)),
108
- new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(Math.floor(Date.now() / 1000))), // "iat"
106
+ new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUED_AT)),
107
+ new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(Math.floor(Date.now() / 1000))), // "iat"
109
108
  ],
110
109
  ]
111
110
 
112
111
  if (expiresAt) {
113
112
  claimsEntries.push([
114
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.EXPIRATION)),
115
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(Math.floor(expiresAt.getTime() / 1000))), // "exp"
113
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.EXPIRATION)),
114
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(Math.floor(expiresAt.getTime() / 1000))), // "exp"
116
115
  ])
117
116
  }
118
117
 
119
118
  if (ttl) {
120
119
  claimsEntries.push([
121
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.TIME_TO_LIVE)),
122
- new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(ttl)), // "time to live"
120
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.TIME_TO_LIVE)),
121
+ new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(ttl)), // "time to live"
123
122
  ])
124
123
  }
125
124
 
126
- claimsEntries.push([new mdoc.com.sphereon.cbor.CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.STATUS_LIST)), statusListMap])
125
+ claimsEntries.push([new com.sphereon.cbor.CborUInt(com.sphereon.kmp.LongKMP.fromNumber(CWT_CLAIMS.STATUS_LIST)), statusListMap])
127
126
 
128
- const claimsMap = new mdoc.com.sphereon.cbor.CborMap(mdoc.kotlin.collections.KtMutableMap.fromJsMap(new Map(claimsEntries)))
127
+ const claimsMap = new com.sphereon.cbor.CborMap(kotlin.collections.KtMutableMap.fromJsMap(new Map(claimsEntries)))
129
128
  return claimsMap
130
129
  }
131
130
 
@@ -138,7 +137,7 @@ const getCborValueFromMap = <T>(map: Map<CborItem<any>, CborItem<any>>, key: num
138
137
  }
139
138
 
140
139
  const getCborOptionalValueFromMap = <T>(map: Map<CborItem<any>, CborItem<any>>, key: number): T | undefined | never => {
141
- const value = map.get(new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(key)))
140
+ const value = map.get(new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(key)))
142
141
  if (!value) {
143
142
  return undefined
144
143
  }
@@ -148,25 +147,25 @@ const getCborOptionalValueFromMap = <T>(map: Map<CborItem<any>, CborItem<any>>,
148
147
  export const decodeStatusListCWT = (cwt: string): DecodedStatusListPayload => {
149
148
  const encodedCbor = base64url.toBuffer(cwt)
150
149
  const encodedCborArray = new Int8Array(encodedCbor)
151
- const decodedCbor = mdoc.com.sphereon.cbor.Cbor.decode(encodedCborArray)
150
+ const decodedCbor = com.sphereon.cbor.Cbor.decode(encodedCborArray)
152
151
 
153
- if (!(decodedCbor instanceof mdoc.com.sphereon.cbor.CborArray)) {
152
+ if (!(decodedCbor instanceof com.sphereon.cbor.CborArray)) {
154
153
  throw new Error('Invalid CWT format: Expected a CBOR array')
155
154
  }
156
155
 
157
156
  const [, payload] = decodedCbor.value.asJsArrayView()
158
- if (!(payload instanceof mdoc.com.sphereon.cbor.CborByteString)) {
157
+ if (!(payload instanceof com.sphereon.cbor.CborByteString)) {
159
158
  throw new Error('Invalid payload format: Expected a CBOR ByteString')
160
159
  }
161
160
 
162
- const claims = mdoc.com.sphereon.cbor.Cbor.decode(payload.value)
163
- if (!(claims instanceof mdoc.com.sphereon.cbor.CborMap)) {
161
+ const claims = com.sphereon.cbor.Cbor.decode(payload.value)
162
+ if (!(claims instanceof com.sphereon.cbor.CborMap)) {
164
163
  throw new Error('Invalid claims format: Expected a CBOR map')
165
164
  }
166
165
 
167
166
  const claimsMap = claims.value.asJsMapView()
168
167
 
169
- const statusListMap = claimsMap.get(new CborUInt(mdoc.com.sphereon.kmp.LongKMP.fromNumber(65533))).value.asJsMapView()
168
+ const statusListMap = claimsMap.get(new CborUInt(com.sphereon.kmp.LongKMP.fromNumber(65533))).value.asJsMapView()
170
169
 
171
170
  const bits = Number(statusListMap.get(new CborString('bits')).value) as BitsPerStatus
172
171
  const decoded = new Uint8Array(statusListMap.get(new CborString('lst')).value)
@@ -1,4 +1,4 @@
1
+ import { BitstringStatusListCredentialUnsigned } from '@4sure-tech/vc-bitstring-status-lists'
1
2
  import { StatusListCredential } from '@sphereon/ssi-types'
2
- import { BitstringStatusListCredentialUnsigned } from '../../../../../vc-bitstring-status-lists'
3
3
 
4
4
  export type BitstringStatusListCredential = BitstringStatusListCredentialUnsigned & StatusListCredential
@@ -7,6 +7,7 @@ import {
7
7
  type IVerifiableCredential,
8
8
  type OrPromise,
9
9
  type StatusListCredential,
10
+ StatusListCredentialIdMode,
10
11
  StatusListDriverType,
11
12
  type StatusListIndexingDirection,
12
13
  StatusListType,
@@ -112,6 +113,7 @@ export interface StatusListResult {
112
113
  statusList2021?: {
113
114
  indexingDirection: StatusListIndexingDirection
114
115
  statusPurpose: StatusPurpose2021
116
+ credentialIdMode: StatusListCredentialIdMode
115
117
  }
116
118
  oauthStatusList?: {
117
119
  bitsPerStatus: number