@sphereon/ssi-sdk.mdl-mdoc 0.34.1-feature.SSISDK.26.51 → 0.34.1-feature.SSISDK.26.RP.55

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.mdl-mdoc",
3
- "version": "0.34.1-feature.SSISDK.26.51+99d5c01e",
3
+ "version": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
4
4
  "source": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -30,11 +30,11 @@
30
30
  "@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
31
31
  "@sphereon/pex": "5.0.0-unstable.28",
32
32
  "@sphereon/pex-models": "^2.3.2",
33
- "@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.26.51+99d5c01e",
34
- "@sphereon/ssi-sdk-ext.key-utils": "0.34.1-feature.SSISDK.26.51+99d5c01e",
35
- "@sphereon/ssi-sdk-ext.x509-utils": "0.34.1-feature.SSISDK.26.51+99d5c01e",
36
- "@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.26.51+99d5c01e",
37
- "@sphereon/ssi-types": "0.34.1-feature.SSISDK.26.51+99d5c01e",
33
+ "@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
34
+ "@sphereon/ssi-sdk-ext.key-utils": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
35
+ "@sphereon/ssi-sdk-ext.x509-utils": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
36
+ "@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
37
+ "@sphereon/ssi-types": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
38
38
  "@veramo/core": "4.2.0",
39
39
  "@veramo/did-manager": "4.2.0",
40
40
  "@veramo/utils": "4.2.0",
@@ -49,12 +49,12 @@
49
49
  "devDependencies": {
50
50
  "@sphereon/oid4vci-client": "0.19.1-feature.SSISDK.13.32",
51
51
  "@sphereon/oid4vci-common": "0.19.1-feature.SSISDK.13.32",
52
- "@sphereon/ssi-express-support": "0.34.1-feature.SSISDK.26.51+99d5c01e",
53
- "@sphereon/ssi-sdk-ext.key-manager": "0.34.1-feature.SSISDK.26.51+99d5c01e",
54
- "@sphereon/ssi-sdk-ext.kms-local": "0.34.1-feature.SSISDK.26.51+99d5c01e",
55
- "@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.26.51+99d5c01e",
56
- "@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.26.51+99d5c01e",
57
- "@sphereon/ssi-sdk.public-key-hosting": "0.34.1-feature.SSISDK.26.51+99d5c01e",
52
+ "@sphereon/ssi-express-support": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
53
+ "@sphereon/ssi-sdk-ext.key-manager": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
54
+ "@sphereon/ssi-sdk-ext.kms-local": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
55
+ "@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
56
+ "@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
57
+ "@sphereon/ssi-sdk.public-key-hosting": "0.34.1-feature.SSISDK.26.RP.55+29260bdc",
58
58
  "@transmute/json-web-signature": "0.7.0-unstable.81",
59
59
  "@types/cors": "^2.8.17",
60
60
  "@types/express": "^4.17.21",
@@ -89,5 +89,5 @@
89
89
  "EBSI",
90
90
  "EBSI Authorization Client"
91
91
  ],
92
- "gitHead": "99d5c01e523013b800f1bb7f87a959393d64792b"
92
+ "gitHead": "29260bdcac297fcdfcb2bf2d2f51c31551571983"
93
93
  }
@@ -1,4 +1,4 @@
1
- import { com } from '@sphereon/kmp-mdoc-core'
1
+ import * as mdoc from '@sphereon/kmp-mdoc-core'
2
2
  import { calculateJwkThumbprint } from '@sphereon/ssi-sdk-ext.key-utils'
3
3
  import { CertificateInfo, getCertificateInfo, pemOrDerToX509Certificate, X509ValidationResult } from '@sphereon/ssi-sdk-ext.x509-utils'
4
4
  import { JWK } from '@sphereon/ssi-types'
@@ -121,7 +121,7 @@ export class MDLMdoc implements IAgentPlugin {
121
121
  presentationDefinition as IOid4VPPresentationDefinition,
122
122
  )
123
123
  const docsAndDescriptors: DocumentDescriptorMatchResult[] = []
124
- let lastError: com.sphereon.crypto.generic.IVerifyResults<com.sphereon.crypto.cose.ICoseKeyCbor> | undefined = undefined
124
+ let lastError: mdoc.com.sphereon.crypto.generic.IVerifyResults<mdoc.com.sphereon.crypto.cose.ICoseKeyCbor> | undefined = undefined
125
125
  for (let match of allMatches) {
126
126
  if (match.document) {
127
127
  const result = await validate(match.document)
@@ -194,7 +194,7 @@ export class MDLMdoc implements IAgentPlugin {
194
194
  */
195
195
  private async mdocOid4vpRPVerify(args: MdocOid4vpRPVerifyArgs, _context: IRequiredContext): Promise<MdocOid4vpRPVerifyResult> {
196
196
  const { vp_token, presentation_submission, trustAnchors } = args
197
- const deviceResponse = com.sphereon.mdoc.data.device.DeviceResponseCbor.Static.cborDecode(decodeFrom(vp_token, Encoding.BASE64URL))
197
+ const deviceResponse = mdoc.com.sphereon.mdoc.data.device.DeviceResponseCbor.Static.cborDecode(decodeFrom(vp_token, Encoding.BASE64URL))
198
198
  if (!deviceResponse.documents) {
199
199
  return Promise.reject(Error(`No documents found in vp_token`))
200
200
  }
@@ -252,7 +252,7 @@ export class MDLMdoc implements IAgentPlugin {
252
252
  const { input, keyInfo, requireX5Chain } = args
253
253
  const coseKeyInfo = keyInfo && CoseJoseKeyMappingService.toCoseKeyInfo(keyInfo)
254
254
  const verification = await new CoseCryptoServiceJS(new CoseCryptoService(context)).verify1(
255
- com.sphereon.crypto.cose.CoseSign1Json.Static.fromDTO(input).toCbor(),
255
+ mdoc.com.sphereon.crypto.cose.CoseSign1Json.Static.fromDTO(input).toCbor(),
256
256
  coseKeyInfo,
257
257
  requireX5Chain,
258
258
  )
@@ -1,4 +1,6 @@
1
- import { com, Nullable } from '@sphereon/kmp-mdoc-core'
1
+ import * as mdoc from '@sphereon/kmp-mdoc-core'
2
+ import { Nullable } from '@sphereon/kmp-mdoc-core'
3
+
2
4
  import { calculateJwkThumbprint, globalCrypto, verifyRawSignature } from '@sphereon/ssi-sdk-ext.key-utils'
3
5
  import {
4
6
  CertificateInfo,
@@ -16,24 +18,24 @@ import { Certificate, CryptoEngine, setEngine } from 'pkijs'
16
18
  import { fromString } from 'uint8arrays/from-string'
17
19
  import { IRequiredContext, VerifyCertificateChainArgs } from '../types/ImDLMdoc'
18
20
 
19
- type CoseKeyCbor = com.sphereon.crypto.cose.CoseKeyCbor
20
- type ICoseKeyCbor = com.sphereon.crypto.cose.ICoseKeyCbor
21
- type ToBeSignedCbor = com.sphereon.crypto.cose.ToBeSignedCbor
22
- const CoseJoseKeyMappingService = com.sphereon.crypto.CoseJoseKeyMappingService
23
- type SignatureAlgorithm = com.sphereon.crypto.generic.SignatureAlgorithm
24
- type ICoseCryptoCallbackJS = com.sphereon.crypto.ICoseCryptoCallbackJS
25
- type IKey = com.sphereon.crypto.IKey
26
- type IX509ServiceJS = com.sphereon.crypto.IX509ServiceJS
27
- type Jwk = com.sphereon.crypto.jose.Jwk
28
- const KeyInfo = com.sphereon.crypto.KeyInfo
29
- type X509VerificationProfile = com.sphereon.crypto.X509VerificationProfile
30
- const DateTimeUtils = com.sphereon.kmp.DateTimeUtils
31
- const decodeFrom = com.sphereon.kmp.decodeFrom
32
- const encodeTo = com.sphereon.kmp.encodeTo
33
- const Encoding = com.sphereon.kmp.Encoding
34
- type LocalDateTimeKMP = com.sphereon.kmp.LocalDateTimeKMP
35
- const SignatureAlgorithm = com.sphereon.crypto.generic.SignatureAlgorithm
36
- const DefaultCallbacks = com.sphereon.crypto.DefaultCallbacks
21
+ type CoseKeyCbor = mdoc.com.sphereon.crypto.cose.CoseKeyCbor
22
+ type ICoseKeyCbor = mdoc.com.sphereon.crypto.cose.ICoseKeyCbor
23
+ type ToBeSignedCbor = mdoc.com.sphereon.crypto.cose.ToBeSignedCbor
24
+ const CoseJoseKeyMappingService = mdoc.com.sphereon.crypto.CoseJoseKeyMappingService
25
+ type SignatureAlgorithm = mdoc.com.sphereon.crypto.generic.SignatureAlgorithm
26
+ type ICoseCryptoCallbackJS = mdoc.com.sphereon.crypto.ICoseCryptoCallbackJS
27
+ type IKey = mdoc.com.sphereon.crypto.IKey
28
+ type IX509ServiceJS = mdoc.com.sphereon.crypto.IX509ServiceJS
29
+ type Jwk = mdoc.com.sphereon.crypto.jose.Jwk
30
+ const KeyInfo = mdoc.com.sphereon.crypto.KeyInfo
31
+ type X509VerificationProfile = mdoc.com.sphereon.crypto.X509VerificationProfile
32
+ const DateTimeUtils = mdoc.com.sphereon.kmp.DateTimeUtils
33
+ const decodeFrom = mdoc.com.sphereon.kmp.decodeFrom
34
+ const encodeTo = mdoc.com.sphereon.kmp.encodeTo
35
+ const Encoding = mdoc.com.sphereon.kmp.Encoding
36
+ type LocalDateTimeKMP = mdoc.com.sphereon.kmp.LocalDateTimeKMP
37
+ const SignatureAlgorithm = mdoc.com.sphereon.crypto.generic.SignatureAlgorithm
38
+ const DefaultCallbacks = mdoc.com.sphereon.crypto.DefaultCallbacks
37
39
 
38
40
  export class CoseCryptoService implements ICoseCryptoCallbackJS {
39
41
  constructor(private context?: IRequiredContext) {}
@@ -53,8 +55,8 @@ export class CoseCryptoService implements ICoseCryptoCallbackJS {
53
55
  if (key == null) {
54
56
  return Promise.reject(Error('No key present in keyInfo. This implementation cannot sign without a key!'))
55
57
  }
56
- const resolvedKeyInfo = com.sphereon.crypto.ResolvedKeyInfo.Static.fromKeyInfo(keyInfo, key)
57
- const jwkKeyInfo: com.sphereon.crypto.ResolvedKeyInfo<Jwk> = CoseJoseKeyMappingService.toResolvedJwkKeyInfo(resolvedKeyInfo)
58
+ const resolvedKeyInfo = mdoc.com.sphereon.crypto.ResolvedKeyInfo.Static.fromKeyInfo(keyInfo, key)
59
+ const jwkKeyInfo: mdoc.com.sphereon.crypto.ResolvedKeyInfo<Jwk> = CoseJoseKeyMappingService.toResolvedJwkKeyInfo(resolvedKeyInfo)
58
60
 
59
61
  const kid = jwkKeyInfo.kid ?? calculateJwkThumbprint({ jwk: jwkKeyInfo.key.toJsonDTO() }) ?? jwkKeyInfo.key.getKidAsString(true)
60
62
  if (!kid) {
@@ -72,10 +74,10 @@ export class CoseCryptoService implements ICoseCryptoCallbackJS {
72
74
  }
73
75
 
74
76
  async verify1Async<CborType>(
75
- input: com.sphereon.crypto.cose.CoseSign1Cbor<CborType>,
76
- keyInfo: com.sphereon.crypto.IKeyInfo<ICoseKeyCbor>,
77
+ input: mdoc.com.sphereon.crypto.cose.CoseSign1Cbor<CborType>,
78
+ keyInfo: mdoc.com.sphereon.crypto.IKeyInfo<ICoseKeyCbor>,
77
79
  requireX5Chain: Nullable<boolean>,
78
- ): Promise<com.sphereon.crypto.generic.IVerifySignatureResult<ICoseKeyCbor>> {
80
+ ): Promise<mdoc.com.sphereon.crypto.generic.IVerifySignatureResult<ICoseKeyCbor>> {
79
81
  const getCertAndKey = async (
80
82
  x5c: Nullable<Array<string>>,
81
83
  ): Promise<{
@@ -126,7 +128,7 @@ export class CoseCryptoService implements ICoseCryptoCallbackJS {
126
128
  if (kid === null) {
127
129
  kid = coseKeyInfo.key.getKidAsString(false)
128
130
  }
129
- issuerCoseKey = com.sphereon.crypto.cose.CoseKeyCbor.Static.fromDTO(coseKeyInfo.key)
131
+ issuerCoseKey = mdoc.com.sphereon.crypto.cose.CoseKeyCbor.Static.fromDTO(coseKeyInfo.key)
130
132
  }
131
133
 
132
134
  const issuerCoseKeyInfo = new KeyInfo<CoseKeyCbor>(
@@ -154,12 +156,12 @@ export class CoseCryptoService implements ICoseCryptoCallbackJS {
154
156
  error: !valid,
155
157
  message: `Signature of '${issuerCert ? getSubjectDN(issuerCert).DN : kid}' was ${valid ? '' : 'in'}valid`,
156
158
  keyInfo: issuerCoseKeyInfo,
157
- } satisfies com.sphereon.crypto.generic.IVerifySignatureResult<ICoseKeyCbor>
159
+ } satisfies mdoc.com.sphereon.crypto.generic.IVerifySignatureResult<ICoseKeyCbor>
158
160
  }
159
161
 
160
- resolvePublicKeyAsync<KT extends com.sphereon.crypto.IKey>(
161
- keyInfo: com.sphereon.crypto.IKeyInfo<KT>,
162
- ): Promise<com.sphereon.crypto.IResolvedKeyInfo<KT>> {
162
+ resolvePublicKeyAsync<KT extends mdoc.com.sphereon.crypto.IKey>(
163
+ keyInfo: mdoc.com.sphereon.crypto.IKeyInfo<KT>,
164
+ ): Promise<mdoc.com.sphereon.crypto.IResolvedKeyInfo<KT>> {
163
165
  if (keyInfo.key) {
164
166
  return Promise.resolve(CoseJoseKeyMappingService.toResolvedKeyInfo(keyInfo, keyInfo.key))
165
167
  }
@@ -210,7 +212,7 @@ export class X509CallbackService implements IX509ServiceJS {
210
212
  trustedCerts: Nullable<string[]>,
211
213
  verificationProfile?: X509VerificationProfile | undefined,
212
214
  verificationTime?: Nullable<LocalDateTimeKMP>,
213
- ): Promise<com.sphereon.crypto.IX509VerificationResult<KeyType>> {
215
+ ): Promise<mdoc.com.sphereon.crypto.IX509VerificationResult<KeyType>> {
214
216
  const verificationAt = verificationTime ?? DateTimeUtils.Static.DEFAULT.dateTimeLocal()
215
217
  let chain: Array<string | Uint8Array> = []
216
218
  if (chainDER && chainDER.length > 0) {
@@ -236,7 +238,7 @@ export class X509CallbackService implements IX509ServiceJS {
236
238
  message: result.message,
237
239
  error: result.error,
238
240
  verificationTime: verificationAt,
239
- } satisfies com.sphereon.crypto.IX509VerificationResult<KeyType>
241
+ } satisfies mdoc.com.sphereon.crypto.IX509VerificationResult<KeyType>
240
242
  }
241
243
 
242
244
  setTrustedCerts = (trustedCertsInPEM?: Array<string>) => {
@@ -1,33 +1,33 @@
1
- import { com } from '@sphereon/kmp-mdoc-core'
1
+ import * as mdoc from '@sphereon/kmp-mdoc-core'
2
2
  import { PresentationDefinitionV2, PresentationSubmission } from '@sphereon/pex-models'
3
3
  import { ISphereonKeyManager } from '@sphereon/ssi-sdk-ext.key-manager'
4
4
  import { CertificateInfo, SubjectAlternativeGeneralName, X509ValidationResult } from '@sphereon/ssi-sdk-ext.x509-utils'
5
5
  import { IAgentContext, IDIDManager, IPluginMethodMap, IResolver } from '@veramo/core'
6
- export type IKey = com.sphereon.crypto.IKey
7
- export type CoseSign1Json = com.sphereon.crypto.cose.CoseSign1Json
8
- export type CoseSign1Cbor<Any> = com.sphereon.crypto.cose.CoseSign1Cbor<Any>
9
- export type ICoseKeyCbor = com.sphereon.crypto.cose.ICoseKeyCbor
10
- export type ICoseKeyJson = com.sphereon.crypto.cose.ICoseKeyJson
11
- export type IKeyInfo<KT extends IKey = IKey> = com.sphereon.crypto.IKeyInfo<KT>
12
- export type IVerifyResults<KT extends IKey> = com.sphereon.crypto.generic.IVerifyResults<KT>
13
- export type IVerifySignatureResult<KT extends IKey> = com.sphereon.crypto.generic.IVerifySignatureResult<KT>
14
- export type DocumentJson = com.sphereon.mdoc.data.device.DocumentJson
15
- export type DocumentCbor = com.sphereon.mdoc.data.device.DocumentCbor
16
- export const CborByteString = com.sphereon.cbor.CborByteString
17
- export const CoseKeyCbor = com.sphereon.crypto.cose.CoseKeyCbor
18
- export const CoseCryptoServiceJS = com.sphereon.crypto.CoseCryptoServiceJS
19
- export const CoseJoseKeyMappingService = com.sphereon.crypto.CoseJoseKeyMappingService
20
- export const KeyInfo = com.sphereon.crypto.KeyInfo
21
- export const DateTimeUtils = com.sphereon.kmp.DateTimeUtils
22
- export const decodeFrom = com.sphereon.kmp.decodeFrom
23
- export const encodeTo = com.sphereon.kmp.encodeTo
24
- export const Encoding = com.sphereon.kmp.Encoding
25
- export const MdocValidations = com.sphereon.mdoc.data.MdocValidations
26
- export const MdocOid4vpService = com.sphereon.mdoc.oid4vp.MdocOid4vpServiceJs
27
- export const Jwk = com.sphereon.crypto.jose.Jwk
28
- export type DocumentDescriptorMatchResult = com.sphereon.mdoc.oid4vp.DocumentDescriptorMatchResult
29
- export type IOid4VPPresentationDefinition = com.sphereon.mdoc.oid4vp.IOid4VPPresentationDefinition
30
- export const Oid4VPPresentationSubmission = com.sphereon.mdoc.oid4vp.Oid4VPPresentationSubmission
6
+ export type IKey = mdoc.com.sphereon.crypto.IKey
7
+ export type CoseSign1Json = mdoc.com.sphereon.crypto.cose.CoseSign1Json
8
+ export type CoseSign1Cbor<Any> = mdoc.com.sphereon.crypto.cose.CoseSign1Cbor<Any>
9
+ export type ICoseKeyCbor = mdoc.com.sphereon.crypto.cose.ICoseKeyCbor
10
+ export type ICoseKeyJson = mdoc.com.sphereon.crypto.cose.ICoseKeyJson
11
+ export type IKeyInfo<KT extends IKey = IKey> = mdoc.com.sphereon.crypto.IKeyInfo<KT>
12
+ export type IVerifyResults<KT extends IKey> = mdoc.com.sphereon.crypto.generic.IVerifyResults<KT>
13
+ export type IVerifySignatureResult<KT extends IKey> = mdoc.com.sphereon.crypto.generic.IVerifySignatureResult<KT>
14
+ export type DocumentJson = mdoc.com.sphereon.mdoc.data.device.DocumentJson
15
+ export type DocumentCbor = mdoc.com.sphereon.mdoc.data.device.DocumentCbor
16
+ export const CborByteString = mdoc.com.sphereon.cbor.CborByteString
17
+ export const CoseKeyCbor = mdoc.com.sphereon.crypto.cose.CoseKeyCbor
18
+ export const CoseCryptoServiceJS = mdoc.com.sphereon.crypto.CoseCryptoServiceJS
19
+ export const CoseJoseKeyMappingService = mdoc.com.sphereon.crypto.CoseJoseKeyMappingService
20
+ export const KeyInfo = mdoc.com.sphereon.crypto.KeyInfo
21
+ export const DateTimeUtils = mdoc.com.sphereon.kmp.DateTimeUtils
22
+ export const decodeFrom = mdoc.com.sphereon.kmp.decodeFrom
23
+ export const encodeTo = mdoc.com.sphereon.kmp.encodeTo
24
+ export const Encoding = mdoc.com.sphereon.kmp.Encoding
25
+ export const MdocValidations = mdoc.com.sphereon.mdoc.data.MdocValidations
26
+ export const MdocOid4vpService = mdoc.com.sphereon.mdoc.oid4vp.MdocOid4vpServiceJs
27
+ export const Jwk = mdoc.com.sphereon.crypto.jose.Jwk
28
+ export type DocumentDescriptorMatchResult = mdoc.com.sphereon.mdoc.oid4vp.DocumentDescriptorMatchResult
29
+ export type IOid4VPPresentationDefinition = mdoc.com.sphereon.mdoc.oid4vp.IOid4VPPresentationDefinition
30
+ export const Oid4VPPresentationSubmission = mdoc.com.sphereon.mdoc.oid4vp.Oid4VPPresentationSubmission
31
31
 
32
32
  export interface ImDLMdoc extends IPluginMethodMap {
33
33
  // TODO: Extract cert methods to its own plugin