@sphereon/ssi-sdk.mdl-mdoc 0.34.1-feature.SSISDK.45.93 → 0.34.1-feature.SSISDK.46.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +29 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -50
- package/dist/index.d.ts +51 -50
- package/dist/index.js +11 -14
- package/dist/index.js.map +1 -1
- package/package.json +17 -17
- package/plugin.schema.json +1 -1
- package/src/agent/mDLMdoc.ts +2 -3
- package/src/functions/index.ts +28 -31
- package/src/types/ImDLMdoc.ts +13 -14
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.
|
|
3
|
+
"version": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@sphereon/did-auth-siop-adapter": "0.19.1-
|
|
29
|
+
"@sphereon/did-auth-siop-adapter": "0.19.1-next.2",
|
|
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.
|
|
34
|
-
"@sphereon/ssi-sdk-ext.key-utils": "0.34.1-feature.SSISDK.
|
|
35
|
-
"@sphereon/ssi-sdk-ext.x509-utils": "0.34.1-feature.SSISDK.
|
|
36
|
-
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.
|
|
37
|
-
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.
|
|
33
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
34
|
+
"@sphereon/ssi-sdk-ext.key-utils": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
35
|
+
"@sphereon/ssi-sdk-ext.x509-utils": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
36
|
+
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
37
|
+
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
38
38
|
"@veramo/core": "4.2.0",
|
|
39
39
|
"@veramo/did-manager": "4.2.0",
|
|
40
40
|
"@veramo/utils": "4.2.0",
|
|
41
|
-
"cross-fetch": "^
|
|
41
|
+
"cross-fetch": "^3.1.8",
|
|
42
42
|
"debug": "^4.3.5",
|
|
43
43
|
"did-resolver": "^4.1.0",
|
|
44
44
|
"multiformats": "9.9.0",
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"uuid": "^9.0.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@sphereon/oid4vci-client": "0.19.1-
|
|
51
|
-
"@sphereon/oid4vci-common": "0.19.1-
|
|
52
|
-
"@sphereon/ssi-express-support": "0.34.1-feature.SSISDK.
|
|
53
|
-
"@sphereon/ssi-sdk-ext.key-manager": "0.34.1-feature.SSISDK.
|
|
54
|
-
"@sphereon/ssi-sdk-ext.kms-local": "0.34.1-feature.SSISDK.
|
|
55
|
-
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.
|
|
56
|
-
"@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.
|
|
57
|
-
"@sphereon/ssi-sdk.public-key-hosting": "0.34.1-feature.SSISDK.
|
|
50
|
+
"@sphereon/oid4vci-client": "0.19.1-next.2",
|
|
51
|
+
"@sphereon/oid4vci-common": "0.19.1-next.2",
|
|
52
|
+
"@sphereon/ssi-express-support": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
53
|
+
"@sphereon/ssi-sdk-ext.key-manager": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
54
|
+
"@sphereon/ssi-sdk-ext.kms-local": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
55
|
+
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
56
|
+
"@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
57
|
+
"@sphereon/ssi-sdk.public-key-hosting": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
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": "
|
|
92
|
+
"gitHead": "f633961166543652ec09e4e194ed2bacbcb92602"
|
|
93
93
|
}
|
package/plugin.schema.json
CHANGED
package/src/agent/mDLMdoc.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const { com } = mdocPkg
|
|
1
|
+
import { com } from '@sphereon/kmp-mdoc-core'
|
|
3
2
|
import { calculateJwkThumbprint } from '@sphereon/ssi-sdk-ext.key-utils'
|
|
4
3
|
import { CertificateInfo, getCertificateInfo, pemOrDerToX509Certificate, X509ValidationResult } from '@sphereon/ssi-sdk-ext.x509-utils'
|
|
5
4
|
import { JWK } from '@sphereon/ssi-types'
|
|
@@ -122,7 +121,7 @@ export class MDLMdoc implements IAgentPlugin {
|
|
|
122
121
|
presentationDefinition as IOid4VPPresentationDefinition,
|
|
123
122
|
)
|
|
124
123
|
const docsAndDescriptors: DocumentDescriptorMatchResult[] = []
|
|
125
|
-
let lastError:
|
|
124
|
+
let lastError: com.sphereon.crypto.generic.IVerifyResults<com.sphereon.crypto.cose.ICoseKeyCbor> | undefined = undefined
|
|
126
125
|
for (let match of allMatches) {
|
|
127
126
|
if (match.document) {
|
|
128
127
|
const result = await validate(match.document)
|
package/src/functions/index.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const { com } = mdocPkg
|
|
3
|
-
import { Nullable } from '@sphereon/kmp-mdoc-core'
|
|
4
|
-
|
|
1
|
+
import { com, Nullable } from '@sphereon/kmp-mdoc-core'
|
|
5
2
|
import { calculateJwkThumbprint, globalCrypto, verifyRawSignature } from '@sphereon/ssi-sdk-ext.key-utils'
|
|
6
3
|
import {
|
|
7
4
|
CertificateInfo,
|
|
@@ -19,24 +16,24 @@ import { Certificate, CryptoEngine, setEngine } from 'pkijs'
|
|
|
19
16
|
import { fromString } from 'uint8arrays/from-string'
|
|
20
17
|
import { IRequiredContext, VerifyCertificateChainArgs } from '../types/ImDLMdoc'
|
|
21
18
|
|
|
22
|
-
type CoseKeyCbor =
|
|
23
|
-
type ICoseKeyCbor =
|
|
24
|
-
type ToBeSignedCbor =
|
|
19
|
+
type CoseKeyCbor = com.sphereon.crypto.cose.CoseKeyCbor
|
|
20
|
+
type ICoseKeyCbor = com.sphereon.crypto.cose.ICoseKeyCbor
|
|
21
|
+
type ToBeSignedCbor = com.sphereon.crypto.cose.ToBeSignedCbor
|
|
25
22
|
const CoseJoseKeyMappingService = com.sphereon.crypto.CoseJoseKeyMappingService
|
|
26
|
-
type SignatureAlgorithm =
|
|
27
|
-
type ICoseCryptoCallbackJS =
|
|
28
|
-
type IKey =
|
|
29
|
-
type IX509ServiceJS =
|
|
30
|
-
type Jwk =
|
|
31
|
-
const KeyInfo =
|
|
32
|
-
type X509VerificationProfile =
|
|
33
|
-
const DateTimeUtils =
|
|
34
|
-
const decodeFrom =
|
|
35
|
-
const encodeTo =
|
|
36
|
-
const Encoding =
|
|
37
|
-
type LocalDateTimeKMP =
|
|
38
|
-
const SignatureAlgorithm =
|
|
39
|
-
const DefaultCallbacks =
|
|
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
|
|
40
37
|
|
|
41
38
|
export class CoseCryptoService implements ICoseCryptoCallbackJS {
|
|
42
39
|
constructor(private context?: IRequiredContext) {}
|
|
@@ -57,7 +54,7 @@ export class CoseCryptoService implements ICoseCryptoCallbackJS {
|
|
|
57
54
|
return Promise.reject(Error('No key present in keyInfo. This implementation cannot sign without a key!'))
|
|
58
55
|
}
|
|
59
56
|
const resolvedKeyInfo = com.sphereon.crypto.ResolvedKeyInfo.Static.fromKeyInfo(keyInfo, key)
|
|
60
|
-
const jwkKeyInfo:
|
|
57
|
+
const jwkKeyInfo: com.sphereon.crypto.ResolvedKeyInfo<Jwk> = CoseJoseKeyMappingService.toResolvedJwkKeyInfo(resolvedKeyInfo)
|
|
61
58
|
|
|
62
59
|
const kid = jwkKeyInfo.kid ?? calculateJwkThumbprint({ jwk: jwkKeyInfo.key.toJsonDTO() }) ?? jwkKeyInfo.key.getKidAsString(true)
|
|
63
60
|
if (!kid) {
|
|
@@ -75,10 +72,10 @@ export class CoseCryptoService implements ICoseCryptoCallbackJS {
|
|
|
75
72
|
}
|
|
76
73
|
|
|
77
74
|
async verify1Async<CborType>(
|
|
78
|
-
input:
|
|
79
|
-
keyInfo:
|
|
75
|
+
input: com.sphereon.crypto.cose.CoseSign1Cbor<CborType>,
|
|
76
|
+
keyInfo: com.sphereon.crypto.IKeyInfo<ICoseKeyCbor>,
|
|
80
77
|
requireX5Chain: Nullable<boolean>,
|
|
81
|
-
): Promise<
|
|
78
|
+
): Promise<com.sphereon.crypto.generic.IVerifySignatureResult<ICoseKeyCbor>> {
|
|
82
79
|
const getCertAndKey = async (
|
|
83
80
|
x5c: Nullable<Array<string>>,
|
|
84
81
|
): Promise<{
|
|
@@ -157,12 +154,12 @@ export class CoseCryptoService implements ICoseCryptoCallbackJS {
|
|
|
157
154
|
error: !valid,
|
|
158
155
|
message: `Signature of '${issuerCert ? getSubjectDN(issuerCert).DN : kid}' was ${valid ? '' : 'in'}valid`,
|
|
159
156
|
keyInfo: issuerCoseKeyInfo,
|
|
160
|
-
} satisfies
|
|
157
|
+
} satisfies com.sphereon.crypto.generic.IVerifySignatureResult<ICoseKeyCbor>
|
|
161
158
|
}
|
|
162
159
|
|
|
163
|
-
resolvePublicKeyAsync<KT extends
|
|
164
|
-
keyInfo:
|
|
165
|
-
): Promise<
|
|
160
|
+
resolvePublicKeyAsync<KT extends com.sphereon.crypto.IKey>(
|
|
161
|
+
keyInfo: com.sphereon.crypto.IKeyInfo<KT>,
|
|
162
|
+
): Promise<com.sphereon.crypto.IResolvedKeyInfo<KT>> {
|
|
166
163
|
if (keyInfo.key) {
|
|
167
164
|
return Promise.resolve(CoseJoseKeyMappingService.toResolvedKeyInfo(keyInfo, keyInfo.key))
|
|
168
165
|
}
|
|
@@ -213,7 +210,7 @@ export class X509CallbackService implements IX509ServiceJS {
|
|
|
213
210
|
trustedCerts: Nullable<string[]>,
|
|
214
211
|
verificationProfile?: X509VerificationProfile | undefined,
|
|
215
212
|
verificationTime?: Nullable<LocalDateTimeKMP>,
|
|
216
|
-
): Promise<
|
|
213
|
+
): Promise<com.sphereon.crypto.IX509VerificationResult<KeyType>> {
|
|
217
214
|
const verificationAt = verificationTime ?? DateTimeUtils.Static.DEFAULT.dateTimeLocal()
|
|
218
215
|
let chain: Array<string | Uint8Array> = []
|
|
219
216
|
if (chainDER && chainDER.length > 0) {
|
|
@@ -239,7 +236,7 @@ export class X509CallbackService implements IX509ServiceJS {
|
|
|
239
236
|
message: result.message,
|
|
240
237
|
error: result.error,
|
|
241
238
|
verificationTime: verificationAt,
|
|
242
|
-
} satisfies
|
|
239
|
+
} satisfies com.sphereon.crypto.IX509VerificationResult<KeyType>
|
|
243
240
|
}
|
|
244
241
|
|
|
245
242
|
setTrustedCerts = (trustedCertsInPEM?: Array<string>) => {
|
package/src/types/ImDLMdoc.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
const { com } = mdocPkg
|
|
1
|
+
import { com } from '@sphereon/kmp-mdoc-core'
|
|
3
2
|
import { PresentationDefinitionV2, PresentationSubmission } from '@sphereon/pex-models'
|
|
4
3
|
import { ISphereonKeyManager } from '@sphereon/ssi-sdk-ext.key-manager'
|
|
5
4
|
import { CertificateInfo, SubjectAlternativeGeneralName, X509ValidationResult } from '@sphereon/ssi-sdk-ext.x509-utils'
|
|
6
5
|
import { IAgentContext, IDIDManager, IPluginMethodMap, IResolver } from '@veramo/core'
|
|
7
|
-
export type IKey =
|
|
8
|
-
export type CoseSign1Json =
|
|
9
|
-
export type CoseSign1Cbor<Any> =
|
|
10
|
-
export type ICoseKeyCbor =
|
|
11
|
-
export type ICoseKeyJson =
|
|
12
|
-
export type IKeyInfo<KT extends IKey = IKey> =
|
|
13
|
-
export type IVerifyResults<KT extends IKey> =
|
|
14
|
-
export type IVerifySignatureResult<KT extends IKey> =
|
|
15
|
-
export type DocumentJson =
|
|
16
|
-
export type DocumentCbor =
|
|
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
|
|
17
16
|
export const CborByteString = com.sphereon.cbor.CborByteString
|
|
18
17
|
export const CoseKeyCbor = com.sphereon.crypto.cose.CoseKeyCbor
|
|
19
18
|
export const CoseCryptoServiceJS = com.sphereon.crypto.CoseCryptoServiceJS
|
|
@@ -26,8 +25,8 @@ export const Encoding = com.sphereon.kmp.Encoding
|
|
|
26
25
|
export const MdocValidations = com.sphereon.mdoc.data.MdocValidations
|
|
27
26
|
export const MdocOid4vpService = com.sphereon.mdoc.oid4vp.MdocOid4vpServiceJs
|
|
28
27
|
export const Jwk = com.sphereon.crypto.jose.Jwk
|
|
29
|
-
export type DocumentDescriptorMatchResult =
|
|
30
|
-
export type IOid4VPPresentationDefinition =
|
|
28
|
+
export type DocumentDescriptorMatchResult = com.sphereon.mdoc.oid4vp.DocumentDescriptorMatchResult
|
|
29
|
+
export type IOid4VPPresentationDefinition = com.sphereon.mdoc.oid4vp.IOid4VPPresentationDefinition
|
|
31
30
|
export const Oid4VPPresentationSubmission = com.sphereon.mdoc.oid4vp.Oid4VPPresentationSubmission
|
|
32
31
|
|
|
33
32
|
export interface ImDLMdoc extends IPluginMethodMap {
|