@sphereon/ssi-sdk.mdl-mdoc 0.34.1-feature.SSISDK.26.RP.55 → 0.34.1-feature.SSISDK.26.RP.58
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 +33 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -51
- package/dist/index.d.ts +50 -51
- package/dist/index.js +33 -30
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
- package/src/agent/mDLMdoc.ts +5 -4
- package/src/functions/index.ts +32 -31
- package/src/types/ImDLMdoc.ts +27 -26
package/dist/index.d.cts
CHANGED
|
@@ -1,54 +1,53 @@
|
|
|
1
1
|
import * as _sphereon_ssi_types from '@sphereon/ssi-types';
|
|
2
2
|
import { IPluginMethodMap, IAgentContext, IDIDManager, IResolver, IAgentPlugin } from '@veramo/core';
|
|
3
|
-
import
|
|
4
|
-
import { Nullable } from '@sphereon/kmp-mdoc-core';
|
|
3
|
+
import mdocPkg, { Nullable } from '@sphereon/kmp-mdoc-core';
|
|
5
4
|
import { PresentationDefinitionV2, PresentationSubmission } from '@sphereon/pex-models';
|
|
6
5
|
import { ISphereonKeyManager } from '@sphereon/ssi-sdk-ext.key-manager';
|
|
7
6
|
import { X509ValidationResult, SubjectAlternativeGeneralName, CertificateInfo } from '@sphereon/ssi-sdk-ext.x509-utils';
|
|
8
7
|
|
|
9
|
-
type IKey$1 =
|
|
10
|
-
type CoseSign1Json =
|
|
11
|
-
type CoseSign1Cbor<Any> =
|
|
12
|
-
type ICoseKeyCbor$1 =
|
|
13
|
-
type ICoseKeyJson =
|
|
14
|
-
type IKeyInfo<KT extends IKey$1 = IKey$1> =
|
|
15
|
-
type IVerifyResults<KT extends IKey$1> =
|
|
16
|
-
type IVerifySignatureResult<KT extends IKey$1> =
|
|
17
|
-
type DocumentJson =
|
|
18
|
-
type DocumentCbor =
|
|
19
|
-
declare const CborByteString: typeof
|
|
20
|
-
declare const CoseKeyCbor: typeof
|
|
21
|
-
declare const CoseCryptoServiceJS: typeof
|
|
8
|
+
type IKey$1 = mdocPkg.com.sphereon.crypto.IKey;
|
|
9
|
+
type CoseSign1Json = mdocPkg.com.sphereon.crypto.cose.CoseSign1Json;
|
|
10
|
+
type CoseSign1Cbor<Any> = mdocPkg.com.sphereon.crypto.cose.CoseSign1Cbor<Any>;
|
|
11
|
+
type ICoseKeyCbor$1 = mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor;
|
|
12
|
+
type ICoseKeyJson = mdocPkg.com.sphereon.crypto.cose.ICoseKeyJson;
|
|
13
|
+
type IKeyInfo<KT extends IKey$1 = IKey$1> = mdocPkg.com.sphereon.crypto.IKeyInfo<KT>;
|
|
14
|
+
type IVerifyResults<KT extends IKey$1> = mdocPkg.com.sphereon.crypto.generic.IVerifyResults<KT>;
|
|
15
|
+
type IVerifySignatureResult<KT extends IKey$1> = mdocPkg.com.sphereon.crypto.generic.IVerifySignatureResult<KT>;
|
|
16
|
+
type DocumentJson = mdocPkg.com.sphereon.mdoc.data.device.DocumentJson;
|
|
17
|
+
type DocumentCbor = mdocPkg.com.sphereon.mdoc.data.device.DocumentCbor;
|
|
18
|
+
declare const CborByteString: typeof mdocPkg.com.sphereon.cbor.CborByteString;
|
|
19
|
+
declare const CoseKeyCbor: typeof mdocPkg.com.sphereon.crypto.cose.CoseKeyCbor;
|
|
20
|
+
declare const CoseCryptoServiceJS: typeof mdocPkg.com.sphereon.crypto.CoseCryptoServiceJS;
|
|
22
21
|
declare const CoseJoseKeyMappingService: {
|
|
23
|
-
toJoseJwk(key:
|
|
24
|
-
toCoseKey(key:
|
|
25
|
-
getJoseX5c(key:
|
|
26
|
-
toJoseX5c(x5c:
|
|
27
|
-
toJwkKeyInfo(keyInfo:
|
|
28
|
-
toResolvedJwkKeyInfo(resolvedKeyInfo:
|
|
29
|
-
toCoseKeyInfo(keyInfo:
|
|
30
|
-
toResolvedCoseKeyInfo(resolvedKeyInfo:
|
|
31
|
-
isResolvedKeyInfo(keyInfo:
|
|
32
|
-
toResolvedKeyInfo<KeyType extends
|
|
33
|
-
toResolvedKeyInfoWithResolver<KeyType extends
|
|
34
|
-
getCoseX5chain(key:
|
|
35
|
-
toCoseX5chain(x5c:
|
|
22
|
+
toJoseJwk(key: mdocPkg.com.sphereon.crypto.IKey): mdocPkg.com.sphereon.crypto.jose.Jwk;
|
|
23
|
+
toCoseKey(key: mdocPkg.com.sphereon.crypto.IKey): mdocPkg.com.sphereon.crypto.cose.CoseKeyCbor;
|
|
24
|
+
getJoseX5c(key: mdocPkg.com.sphereon.crypto.IKey): mdocPkg.Nullable<Array<string>>;
|
|
25
|
+
toJoseX5c(x5c: mdocPkg.Nullable<Array<any>>): mdocPkg.Nullable<Array<string>>;
|
|
26
|
+
toJwkKeyInfo(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<any>): mdocPkg.com.sphereon.crypto.KeyInfo<mdocPkg.com.sphereon.crypto.jose.Jwk>;
|
|
27
|
+
toResolvedJwkKeyInfo(resolvedKeyInfo: mdocPkg.com.sphereon.crypto.IResolvedKeyInfo<any>): mdocPkg.com.sphereon.crypto.ResolvedKeyInfo<mdocPkg.com.sphereon.crypto.jose.Jwk>;
|
|
28
|
+
toCoseKeyInfo(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<any>): mdocPkg.com.sphereon.crypto.KeyInfo<mdocPkg.com.sphereon.crypto.cose.CoseKeyCbor>;
|
|
29
|
+
toResolvedCoseKeyInfo(resolvedKeyInfo: mdocPkg.com.sphereon.crypto.IResolvedKeyInfo<any>): mdocPkg.com.sphereon.crypto.ResolvedKeyInfo<mdocPkg.com.sphereon.crypto.cose.CoseKeyCbor>;
|
|
30
|
+
isResolvedKeyInfo(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<any>): boolean;
|
|
31
|
+
toResolvedKeyInfo<KeyType extends mdocPkg.com.sphereon.crypto.IKey>(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<any>, key?: mdocPkg.Nullable<KeyType>): mdocPkg.com.sphereon.crypto.ResolvedKeyInfo<KeyType>;
|
|
32
|
+
toResolvedKeyInfoWithResolver<KeyType extends mdocPkg.com.sphereon.crypto.IKey>(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<KeyType>, resolveCallback: mdocPkg.Nullable<(p0: mdocPkg.com.sphereon.crypto.IKeyInfo<KeyType>) => mdocPkg.com.sphereon.crypto.ResolvedKeyInfo<KeyType>>): mdocPkg.com.sphereon.crypto.ResolvedKeyInfo<KeyType>;
|
|
33
|
+
getCoseX5chain(key: mdocPkg.com.sphereon.crypto.IKey): mdocPkg.Nullable<mdocPkg.com.sphereon.cbor.CborArray<mdocPkg.com.sphereon.cbor.CborByteString>>;
|
|
34
|
+
toCoseX5chain(x5c: mdocPkg.Nullable<Array<any>>): mdocPkg.Nullable<mdocPkg.com.sphereon.cbor.CborArray<mdocPkg.com.sphereon.cbor.CborByteString>>;
|
|
36
35
|
};
|
|
37
|
-
declare const KeyInfo: typeof
|
|
38
|
-
declare const DateTimeUtils: typeof
|
|
39
|
-
declare const decodeFrom: typeof
|
|
40
|
-
declare const encodeTo: typeof
|
|
41
|
-
declare const Encoding: typeof
|
|
36
|
+
declare const KeyInfo: typeof mdocPkg.com.sphereon.crypto.KeyInfo;
|
|
37
|
+
declare const DateTimeUtils: typeof mdocPkg.com.sphereon.kmp.DateTimeUtils;
|
|
38
|
+
declare const decodeFrom: typeof mdocPkg.com.sphereon.kmp.decodeFrom;
|
|
39
|
+
declare const encodeTo: typeof mdocPkg.com.sphereon.kmp.encodeTo;
|
|
40
|
+
declare const Encoding: typeof mdocPkg.com.sphereon.kmp.Encoding;
|
|
42
41
|
declare const MdocValidations: {
|
|
43
|
-
fromDocumentAsync(document:
|
|
44
|
-
fromIssuerAuthAsync(issuerAuth:
|
|
45
|
-
withParamsAsync(issuerAuth?:
|
|
42
|
+
fromDocumentAsync(document: mdocPkg.com.sphereon.mdoc.data.device.DocumentCbor, keyInfo?: mdocPkg.Nullable<mdocPkg.com.sphereon.crypto.IKeyInfo<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>, trustedCerts?: mdocPkg.Nullable<Array<string>>, verificationTime?: mdocPkg.Nullable<mdocPkg.com.sphereon.kmp.LocalDateTimeKMP>, allowExpiredDocuments?: mdocPkg.Nullable<boolean>, dateTimeUtils?: mdocPkg.com.sphereon.kmp.DateTimeUtils, timeZoneId?: mdocPkg.Nullable<string>, clockSkewAllowedInSec?: number): Promise<mdocPkg.com.sphereon.crypto.generic.IVerifyResults<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>;
|
|
43
|
+
fromIssuerAuthAsync(issuerAuth: mdocPkg.com.sphereon.crypto.cose.CoseSign1Cbor<mdocPkg.com.sphereon.mdoc.data.mso.MobileSecurityObjectCbor>, keyInfo?: mdocPkg.Nullable<mdocPkg.com.sphereon.crypto.IKeyInfo<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>, trustedCerts?: mdocPkg.Nullable<Array<string>>, verificationTime?: mdocPkg.Nullable<mdocPkg.com.sphereon.kmp.LocalDateTimeKMP>, allowExpiredDocuments?: mdocPkg.Nullable<boolean>, dateTimeUtils?: mdocPkg.com.sphereon.kmp.DateTimeUtils, timeZoneId?: mdocPkg.Nullable<string>, clockSkewAllowedInSec?: number): Promise<mdocPkg.com.sphereon.crypto.generic.IVerifyResults<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>;
|
|
44
|
+
withParamsAsync(issuerAuth?: mdocPkg.Nullable<mdocPkg.com.sphereon.crypto.cose.CoseSign1Cbor<mdocPkg.com.sphereon.mdoc.data.mso.MobileSecurityObjectCbor>>, document?: mdocPkg.Nullable<mdocPkg.com.sphereon.mdoc.data.device.DocumentCbor>, mdocVerificationTypes?: mdocPkg.kotlin.collections.KtSet<mdocPkg.com.sphereon.mdoc.data.MdocVerification>, keyInfo?: mdocPkg.Nullable<mdocPkg.com.sphereon.crypto.IKeyInfo<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>, trustedCerts?: mdocPkg.Nullable<Array<string>>, verificationTime?: mdocPkg.Nullable<mdocPkg.com.sphereon.kmp.LocalDateTimeKMP>, allowExpiredDocuments?: mdocPkg.Nullable<boolean>, dateTimeUtils?: mdocPkg.com.sphereon.kmp.DateTimeUtils, timeZoneId?: mdocPkg.Nullable<string>, clockSkewAllowedInSec?: number): Promise<mdocPkg.com.sphereon.crypto.generic.IVerifyResults<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>;
|
|
46
45
|
};
|
|
47
|
-
declare const MdocOid4vpService: typeof
|
|
48
|
-
declare const Jwk: typeof
|
|
49
|
-
type DocumentDescriptorMatchResult =
|
|
50
|
-
type IOid4VPPresentationDefinition =
|
|
51
|
-
declare const Oid4VPPresentationSubmission: typeof
|
|
46
|
+
declare const MdocOid4vpService: typeof mdocPkg.com.sphereon.mdoc.oid4vp.MdocOid4vpServiceJs;
|
|
47
|
+
declare const Jwk: typeof mdocPkg.com.sphereon.crypto.jose.Jwk;
|
|
48
|
+
type DocumentDescriptorMatchResult = mdocPkg.com.sphereon.mdoc.oid4vp.DocumentDescriptorMatchResult;
|
|
49
|
+
type IOid4VPPresentationDefinition = mdocPkg.com.sphereon.mdoc.oid4vp.IOid4VPPresentationDefinition;
|
|
50
|
+
declare const Oid4VPPresentationSubmission: typeof mdocPkg.com.sphereon.mdoc.oid4vp.Oid4VPPresentationSubmission;
|
|
52
51
|
interface ImDLMdoc extends IPluginMethodMap {
|
|
53
52
|
x509VerifyCertificateChain(args: VerifyCertificateChainArgs, context: IRequiredContext): Promise<X509ValidationResult>;
|
|
54
53
|
x509GetCertificateInfo(args: GetX509CertificateInfoArgs, context: IRequiredContext): Promise<CertificateInfo[]>;
|
|
@@ -177,20 +176,20 @@ declare class MDLMdoc implements IAgentPlugin {
|
|
|
177
176
|
private x509GetCertificateInfo;
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
type ICoseKeyCbor =
|
|
181
|
-
type ToBeSignedCbor =
|
|
182
|
-
type ICoseCryptoCallbackJS =
|
|
183
|
-
type IKey =
|
|
184
|
-
type IX509ServiceJS =
|
|
185
|
-
type X509VerificationProfile =
|
|
186
|
-
type LocalDateTimeKMP =
|
|
179
|
+
type ICoseKeyCbor = mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor;
|
|
180
|
+
type ToBeSignedCbor = mdocPkg.com.sphereon.crypto.cose.ToBeSignedCbor;
|
|
181
|
+
type ICoseCryptoCallbackJS = mdocPkg.com.sphereon.crypto.ICoseCryptoCallbackJS;
|
|
182
|
+
type IKey = mdocPkg.com.sphereon.crypto.IKey;
|
|
183
|
+
type IX509ServiceJS = mdocPkg.com.sphereon.crypto.IX509ServiceJS;
|
|
184
|
+
type X509VerificationProfile = mdocPkg.com.sphereon.crypto.X509VerificationProfile;
|
|
185
|
+
type LocalDateTimeKMP = mdocPkg.com.sphereon.kmp.LocalDateTimeKMP;
|
|
187
186
|
declare class CoseCryptoService implements ICoseCryptoCallbackJS {
|
|
188
187
|
private context?;
|
|
189
188
|
constructor(context?: IRequiredContext | undefined);
|
|
190
189
|
setContext(context: IRequiredContext): void;
|
|
191
190
|
signAsync(input: ToBeSignedCbor, requireX5Chain: Nullable<boolean>): Promise<Int8Array>;
|
|
192
|
-
verify1Async<CborType>(input:
|
|
193
|
-
resolvePublicKeyAsync<KT extends
|
|
191
|
+
verify1Async<CborType>(input: mdocPkg.com.sphereon.crypto.cose.CoseSign1Cbor<CborType>, keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<ICoseKeyCbor>, requireX5Chain: Nullable<boolean>): Promise<mdocPkg.com.sphereon.crypto.generic.IVerifySignatureResult<ICoseKeyCbor>>;
|
|
192
|
+
resolvePublicKeyAsync<KT extends mdocPkg.com.sphereon.crypto.IKey>(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<KT>): Promise<mdocPkg.com.sphereon.crypto.IResolvedKeyInfo<KT>>;
|
|
194
193
|
}
|
|
195
194
|
/**
|
|
196
195
|
* This class can be used for X509 validations.
|
|
@@ -212,7 +211,7 @@ declare class X509CallbackService implements IX509ServiceJS {
|
|
|
212
211
|
/**
|
|
213
212
|
* This method is the implementation used within the mDL/Mdoc library
|
|
214
213
|
*/
|
|
215
|
-
verifyCertificateChainJS<KeyType extends IKey>(chainDER: Nullable<Int8Array[]>, chainPEM: Nullable<string[]>, trustedCerts: Nullable<string[]>, verificationProfile?: X509VerificationProfile | undefined, verificationTime?: Nullable<LocalDateTimeKMP>): Promise<
|
|
214
|
+
verifyCertificateChainJS<KeyType extends IKey>(chainDER: Nullable<Int8Array[]>, chainPEM: Nullable<string[]>, trustedCerts: Nullable<string[]>, verificationProfile?: X509VerificationProfile | undefined, verificationTime?: Nullable<LocalDateTimeKMP>): Promise<mdocPkg.com.sphereon.crypto.IX509VerificationResult<KeyType>>;
|
|
216
215
|
setTrustedCerts: (trustedCertsInPEM?: Array<string>) => void;
|
|
217
216
|
getTrustedCerts: () => string[] | undefined;
|
|
218
217
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,54 +1,53 @@
|
|
|
1
1
|
import * as _sphereon_ssi_types from '@sphereon/ssi-types';
|
|
2
2
|
import { IPluginMethodMap, IAgentContext, IDIDManager, IResolver, IAgentPlugin } from '@veramo/core';
|
|
3
|
-
import
|
|
4
|
-
import { Nullable } from '@sphereon/kmp-mdoc-core';
|
|
3
|
+
import mdocPkg, { Nullable } from '@sphereon/kmp-mdoc-core';
|
|
5
4
|
import { PresentationDefinitionV2, PresentationSubmission } from '@sphereon/pex-models';
|
|
6
5
|
import { ISphereonKeyManager } from '@sphereon/ssi-sdk-ext.key-manager';
|
|
7
6
|
import { X509ValidationResult, SubjectAlternativeGeneralName, CertificateInfo } from '@sphereon/ssi-sdk-ext.x509-utils';
|
|
8
7
|
|
|
9
|
-
type IKey$1 =
|
|
10
|
-
type CoseSign1Json =
|
|
11
|
-
type CoseSign1Cbor<Any> =
|
|
12
|
-
type ICoseKeyCbor$1 =
|
|
13
|
-
type ICoseKeyJson =
|
|
14
|
-
type IKeyInfo<KT extends IKey$1 = IKey$1> =
|
|
15
|
-
type IVerifyResults<KT extends IKey$1> =
|
|
16
|
-
type IVerifySignatureResult<KT extends IKey$1> =
|
|
17
|
-
type DocumentJson =
|
|
18
|
-
type DocumentCbor =
|
|
19
|
-
declare const CborByteString: typeof
|
|
20
|
-
declare const CoseKeyCbor: typeof
|
|
21
|
-
declare const CoseCryptoServiceJS: typeof
|
|
8
|
+
type IKey$1 = mdocPkg.com.sphereon.crypto.IKey;
|
|
9
|
+
type CoseSign1Json = mdocPkg.com.sphereon.crypto.cose.CoseSign1Json;
|
|
10
|
+
type CoseSign1Cbor<Any> = mdocPkg.com.sphereon.crypto.cose.CoseSign1Cbor<Any>;
|
|
11
|
+
type ICoseKeyCbor$1 = mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor;
|
|
12
|
+
type ICoseKeyJson = mdocPkg.com.sphereon.crypto.cose.ICoseKeyJson;
|
|
13
|
+
type IKeyInfo<KT extends IKey$1 = IKey$1> = mdocPkg.com.sphereon.crypto.IKeyInfo<KT>;
|
|
14
|
+
type IVerifyResults<KT extends IKey$1> = mdocPkg.com.sphereon.crypto.generic.IVerifyResults<KT>;
|
|
15
|
+
type IVerifySignatureResult<KT extends IKey$1> = mdocPkg.com.sphereon.crypto.generic.IVerifySignatureResult<KT>;
|
|
16
|
+
type DocumentJson = mdocPkg.com.sphereon.mdoc.data.device.DocumentJson;
|
|
17
|
+
type DocumentCbor = mdocPkg.com.sphereon.mdoc.data.device.DocumentCbor;
|
|
18
|
+
declare const CborByteString: typeof mdocPkg.com.sphereon.cbor.CborByteString;
|
|
19
|
+
declare const CoseKeyCbor: typeof mdocPkg.com.sphereon.crypto.cose.CoseKeyCbor;
|
|
20
|
+
declare const CoseCryptoServiceJS: typeof mdocPkg.com.sphereon.crypto.CoseCryptoServiceJS;
|
|
22
21
|
declare const CoseJoseKeyMappingService: {
|
|
23
|
-
toJoseJwk(key:
|
|
24
|
-
toCoseKey(key:
|
|
25
|
-
getJoseX5c(key:
|
|
26
|
-
toJoseX5c(x5c:
|
|
27
|
-
toJwkKeyInfo(keyInfo:
|
|
28
|
-
toResolvedJwkKeyInfo(resolvedKeyInfo:
|
|
29
|
-
toCoseKeyInfo(keyInfo:
|
|
30
|
-
toResolvedCoseKeyInfo(resolvedKeyInfo:
|
|
31
|
-
isResolvedKeyInfo(keyInfo:
|
|
32
|
-
toResolvedKeyInfo<KeyType extends
|
|
33
|
-
toResolvedKeyInfoWithResolver<KeyType extends
|
|
34
|
-
getCoseX5chain(key:
|
|
35
|
-
toCoseX5chain(x5c:
|
|
22
|
+
toJoseJwk(key: mdocPkg.com.sphereon.crypto.IKey): mdocPkg.com.sphereon.crypto.jose.Jwk;
|
|
23
|
+
toCoseKey(key: mdocPkg.com.sphereon.crypto.IKey): mdocPkg.com.sphereon.crypto.cose.CoseKeyCbor;
|
|
24
|
+
getJoseX5c(key: mdocPkg.com.sphereon.crypto.IKey): mdocPkg.Nullable<Array<string>>;
|
|
25
|
+
toJoseX5c(x5c: mdocPkg.Nullable<Array<any>>): mdocPkg.Nullable<Array<string>>;
|
|
26
|
+
toJwkKeyInfo(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<any>): mdocPkg.com.sphereon.crypto.KeyInfo<mdocPkg.com.sphereon.crypto.jose.Jwk>;
|
|
27
|
+
toResolvedJwkKeyInfo(resolvedKeyInfo: mdocPkg.com.sphereon.crypto.IResolvedKeyInfo<any>): mdocPkg.com.sphereon.crypto.ResolvedKeyInfo<mdocPkg.com.sphereon.crypto.jose.Jwk>;
|
|
28
|
+
toCoseKeyInfo(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<any>): mdocPkg.com.sphereon.crypto.KeyInfo<mdocPkg.com.sphereon.crypto.cose.CoseKeyCbor>;
|
|
29
|
+
toResolvedCoseKeyInfo(resolvedKeyInfo: mdocPkg.com.sphereon.crypto.IResolvedKeyInfo<any>): mdocPkg.com.sphereon.crypto.ResolvedKeyInfo<mdocPkg.com.sphereon.crypto.cose.CoseKeyCbor>;
|
|
30
|
+
isResolvedKeyInfo(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<any>): boolean;
|
|
31
|
+
toResolvedKeyInfo<KeyType extends mdocPkg.com.sphereon.crypto.IKey>(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<any>, key?: mdocPkg.Nullable<KeyType>): mdocPkg.com.sphereon.crypto.ResolvedKeyInfo<KeyType>;
|
|
32
|
+
toResolvedKeyInfoWithResolver<KeyType extends mdocPkg.com.sphereon.crypto.IKey>(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<KeyType>, resolveCallback: mdocPkg.Nullable<(p0: mdocPkg.com.sphereon.crypto.IKeyInfo<KeyType>) => mdocPkg.com.sphereon.crypto.ResolvedKeyInfo<KeyType>>): mdocPkg.com.sphereon.crypto.ResolvedKeyInfo<KeyType>;
|
|
33
|
+
getCoseX5chain(key: mdocPkg.com.sphereon.crypto.IKey): mdocPkg.Nullable<mdocPkg.com.sphereon.cbor.CborArray<mdocPkg.com.sphereon.cbor.CborByteString>>;
|
|
34
|
+
toCoseX5chain(x5c: mdocPkg.Nullable<Array<any>>): mdocPkg.Nullable<mdocPkg.com.sphereon.cbor.CborArray<mdocPkg.com.sphereon.cbor.CborByteString>>;
|
|
36
35
|
};
|
|
37
|
-
declare const KeyInfo: typeof
|
|
38
|
-
declare const DateTimeUtils: typeof
|
|
39
|
-
declare const decodeFrom: typeof
|
|
40
|
-
declare const encodeTo: typeof
|
|
41
|
-
declare const Encoding: typeof
|
|
36
|
+
declare const KeyInfo: typeof mdocPkg.com.sphereon.crypto.KeyInfo;
|
|
37
|
+
declare const DateTimeUtils: typeof mdocPkg.com.sphereon.kmp.DateTimeUtils;
|
|
38
|
+
declare const decodeFrom: typeof mdocPkg.com.sphereon.kmp.decodeFrom;
|
|
39
|
+
declare const encodeTo: typeof mdocPkg.com.sphereon.kmp.encodeTo;
|
|
40
|
+
declare const Encoding: typeof mdocPkg.com.sphereon.kmp.Encoding;
|
|
42
41
|
declare const MdocValidations: {
|
|
43
|
-
fromDocumentAsync(document:
|
|
44
|
-
fromIssuerAuthAsync(issuerAuth:
|
|
45
|
-
withParamsAsync(issuerAuth?:
|
|
42
|
+
fromDocumentAsync(document: mdocPkg.com.sphereon.mdoc.data.device.DocumentCbor, keyInfo?: mdocPkg.Nullable<mdocPkg.com.sphereon.crypto.IKeyInfo<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>, trustedCerts?: mdocPkg.Nullable<Array<string>>, verificationTime?: mdocPkg.Nullable<mdocPkg.com.sphereon.kmp.LocalDateTimeKMP>, allowExpiredDocuments?: mdocPkg.Nullable<boolean>, dateTimeUtils?: mdocPkg.com.sphereon.kmp.DateTimeUtils, timeZoneId?: mdocPkg.Nullable<string>, clockSkewAllowedInSec?: number): Promise<mdocPkg.com.sphereon.crypto.generic.IVerifyResults<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>;
|
|
43
|
+
fromIssuerAuthAsync(issuerAuth: mdocPkg.com.sphereon.crypto.cose.CoseSign1Cbor<mdocPkg.com.sphereon.mdoc.data.mso.MobileSecurityObjectCbor>, keyInfo?: mdocPkg.Nullable<mdocPkg.com.sphereon.crypto.IKeyInfo<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>, trustedCerts?: mdocPkg.Nullable<Array<string>>, verificationTime?: mdocPkg.Nullable<mdocPkg.com.sphereon.kmp.LocalDateTimeKMP>, allowExpiredDocuments?: mdocPkg.Nullable<boolean>, dateTimeUtils?: mdocPkg.com.sphereon.kmp.DateTimeUtils, timeZoneId?: mdocPkg.Nullable<string>, clockSkewAllowedInSec?: number): Promise<mdocPkg.com.sphereon.crypto.generic.IVerifyResults<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>;
|
|
44
|
+
withParamsAsync(issuerAuth?: mdocPkg.Nullable<mdocPkg.com.sphereon.crypto.cose.CoseSign1Cbor<mdocPkg.com.sphereon.mdoc.data.mso.MobileSecurityObjectCbor>>, document?: mdocPkg.Nullable<mdocPkg.com.sphereon.mdoc.data.device.DocumentCbor>, mdocVerificationTypes?: mdocPkg.kotlin.collections.KtSet<mdocPkg.com.sphereon.mdoc.data.MdocVerification>, keyInfo?: mdocPkg.Nullable<mdocPkg.com.sphereon.crypto.IKeyInfo<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>, trustedCerts?: mdocPkg.Nullable<Array<string>>, verificationTime?: mdocPkg.Nullable<mdocPkg.com.sphereon.kmp.LocalDateTimeKMP>, allowExpiredDocuments?: mdocPkg.Nullable<boolean>, dateTimeUtils?: mdocPkg.com.sphereon.kmp.DateTimeUtils, timeZoneId?: mdocPkg.Nullable<string>, clockSkewAllowedInSec?: number): Promise<mdocPkg.com.sphereon.crypto.generic.IVerifyResults<mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor>>;
|
|
46
45
|
};
|
|
47
|
-
declare const MdocOid4vpService: typeof
|
|
48
|
-
declare const Jwk: typeof
|
|
49
|
-
type DocumentDescriptorMatchResult =
|
|
50
|
-
type IOid4VPPresentationDefinition =
|
|
51
|
-
declare const Oid4VPPresentationSubmission: typeof
|
|
46
|
+
declare const MdocOid4vpService: typeof mdocPkg.com.sphereon.mdoc.oid4vp.MdocOid4vpServiceJs;
|
|
47
|
+
declare const Jwk: typeof mdocPkg.com.sphereon.crypto.jose.Jwk;
|
|
48
|
+
type DocumentDescriptorMatchResult = mdocPkg.com.sphereon.mdoc.oid4vp.DocumentDescriptorMatchResult;
|
|
49
|
+
type IOid4VPPresentationDefinition = mdocPkg.com.sphereon.mdoc.oid4vp.IOid4VPPresentationDefinition;
|
|
50
|
+
declare const Oid4VPPresentationSubmission: typeof mdocPkg.com.sphereon.mdoc.oid4vp.Oid4VPPresentationSubmission;
|
|
52
51
|
interface ImDLMdoc extends IPluginMethodMap {
|
|
53
52
|
x509VerifyCertificateChain(args: VerifyCertificateChainArgs, context: IRequiredContext): Promise<X509ValidationResult>;
|
|
54
53
|
x509GetCertificateInfo(args: GetX509CertificateInfoArgs, context: IRequiredContext): Promise<CertificateInfo[]>;
|
|
@@ -177,20 +176,20 @@ declare class MDLMdoc implements IAgentPlugin {
|
|
|
177
176
|
private x509GetCertificateInfo;
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
type ICoseKeyCbor =
|
|
181
|
-
type ToBeSignedCbor =
|
|
182
|
-
type ICoseCryptoCallbackJS =
|
|
183
|
-
type IKey =
|
|
184
|
-
type IX509ServiceJS =
|
|
185
|
-
type X509VerificationProfile =
|
|
186
|
-
type LocalDateTimeKMP =
|
|
179
|
+
type ICoseKeyCbor = mdocPkg.com.sphereon.crypto.cose.ICoseKeyCbor;
|
|
180
|
+
type ToBeSignedCbor = mdocPkg.com.sphereon.crypto.cose.ToBeSignedCbor;
|
|
181
|
+
type ICoseCryptoCallbackJS = mdocPkg.com.sphereon.crypto.ICoseCryptoCallbackJS;
|
|
182
|
+
type IKey = mdocPkg.com.sphereon.crypto.IKey;
|
|
183
|
+
type IX509ServiceJS = mdocPkg.com.sphereon.crypto.IX509ServiceJS;
|
|
184
|
+
type X509VerificationProfile = mdocPkg.com.sphereon.crypto.X509VerificationProfile;
|
|
185
|
+
type LocalDateTimeKMP = mdocPkg.com.sphereon.kmp.LocalDateTimeKMP;
|
|
187
186
|
declare class CoseCryptoService implements ICoseCryptoCallbackJS {
|
|
188
187
|
private context?;
|
|
189
188
|
constructor(context?: IRequiredContext | undefined);
|
|
190
189
|
setContext(context: IRequiredContext): void;
|
|
191
190
|
signAsync(input: ToBeSignedCbor, requireX5Chain: Nullable<boolean>): Promise<Int8Array>;
|
|
192
|
-
verify1Async<CborType>(input:
|
|
193
|
-
resolvePublicKeyAsync<KT extends
|
|
191
|
+
verify1Async<CborType>(input: mdocPkg.com.sphereon.crypto.cose.CoseSign1Cbor<CborType>, keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<ICoseKeyCbor>, requireX5Chain: Nullable<boolean>): Promise<mdocPkg.com.sphereon.crypto.generic.IVerifySignatureResult<ICoseKeyCbor>>;
|
|
192
|
+
resolvePublicKeyAsync<KT extends mdocPkg.com.sphereon.crypto.IKey>(keyInfo: mdocPkg.com.sphereon.crypto.IKeyInfo<KT>): Promise<mdocPkg.com.sphereon.crypto.IResolvedKeyInfo<KT>>;
|
|
194
193
|
}
|
|
195
194
|
/**
|
|
196
195
|
* This class can be used for X509 validations.
|
|
@@ -212,7 +211,7 @@ declare class X509CallbackService implements IX509ServiceJS {
|
|
|
212
211
|
/**
|
|
213
212
|
* This method is the implementation used within the mDL/Mdoc library
|
|
214
213
|
*/
|
|
215
|
-
verifyCertificateChainJS<KeyType extends IKey>(chainDER: Nullable<Int8Array[]>, chainPEM: Nullable<string[]>, trustedCerts: Nullable<string[]>, verificationProfile?: X509VerificationProfile | undefined, verificationTime?: Nullable<LocalDateTimeKMP>): Promise<
|
|
214
|
+
verifyCertificateChainJS<KeyType extends IKey>(chainDER: Nullable<Int8Array[]>, chainPEM: Nullable<string[]>, trustedCerts: Nullable<string[]>, verificationProfile?: X509VerificationProfile | undefined, verificationTime?: Nullable<LocalDateTimeKMP>): Promise<mdocPkg.com.sphereon.crypto.IX509VerificationResult<KeyType>>;
|
|
216
215
|
setTrustedCerts: (trustedCertsInPEM?: Array<string>) => void;
|
|
217
216
|
getTrustedCerts: () => string[] | undefined;
|
|
218
217
|
}
|
package/dist/index.js
CHANGED
|
@@ -2045,25 +2045,26 @@ var require_plugin_schema = __commonJS({
|
|
|
2045
2045
|
import { Loggers } from "@sphereon/ssi-types";
|
|
2046
2046
|
|
|
2047
2047
|
// src/agent/mDLMdoc.ts
|
|
2048
|
-
import
|
|
2048
|
+
import mdocPkg3 from "@sphereon/kmp-mdoc-core";
|
|
2049
2049
|
import { calculateJwkThumbprint as calculateJwkThumbprint2 } from "@sphereon/ssi-sdk-ext.key-utils";
|
|
2050
2050
|
import { getCertificateInfo as getCertificateInfo2, pemOrDerToX509Certificate as pemOrDerToX509Certificate2 } from "@sphereon/ssi-sdk-ext.x509-utils";
|
|
2051
2051
|
|
|
2052
2052
|
// src/functions/index.ts
|
|
2053
|
-
import
|
|
2053
|
+
import mdocPkg from "@sphereon/kmp-mdoc-core";
|
|
2054
2054
|
import { calculateJwkThumbprint, globalCrypto, verifyRawSignature } from "@sphereon/ssi-sdk-ext.key-utils";
|
|
2055
2055
|
import { derToPEM, getCertificateInfo, getSubjectDN, pemOrDerToX509Certificate, validateX509CertificateChain } from "@sphereon/ssi-sdk-ext.x509-utils";
|
|
2056
2056
|
import * as crypto from "crypto";
|
|
2057
2057
|
import { CryptoEngine, setEngine } from "pkijs";
|
|
2058
2058
|
import { fromString } from "uint8arrays/from-string";
|
|
2059
|
-
var
|
|
2060
|
-
var
|
|
2061
|
-
var
|
|
2062
|
-
var
|
|
2063
|
-
var
|
|
2064
|
-
var
|
|
2065
|
-
var
|
|
2066
|
-
var
|
|
2059
|
+
var { com } = mdocPkg;
|
|
2060
|
+
var CoseJoseKeyMappingService = com.sphereon.crypto.CoseJoseKeyMappingService;
|
|
2061
|
+
var KeyInfo = mdocPkg.com.sphereon.crypto.KeyInfo;
|
|
2062
|
+
var DateTimeUtils = mdocPkg.com.sphereon.kmp.DateTimeUtils;
|
|
2063
|
+
var decodeFrom = mdocPkg.com.sphereon.kmp.decodeFrom;
|
|
2064
|
+
var encodeTo = mdocPkg.com.sphereon.kmp.encodeTo;
|
|
2065
|
+
var Encoding = mdocPkg.com.sphereon.kmp.Encoding;
|
|
2066
|
+
var SignatureAlgorithm = mdocPkg.com.sphereon.crypto.generic.SignatureAlgorithm;
|
|
2067
|
+
var DefaultCallbacks = mdocPkg.com.sphereon.crypto.DefaultCallbacks;
|
|
2067
2068
|
var CoseCryptoService = class {
|
|
2068
2069
|
static {
|
|
2069
2070
|
__name(this, "CoseCryptoService");
|
|
@@ -2086,7 +2087,7 @@ var CoseCryptoService = class {
|
|
|
2086
2087
|
if (key == null) {
|
|
2087
2088
|
return Promise.reject(Error("No key present in keyInfo. This implementation cannot sign without a key!"));
|
|
2088
2089
|
}
|
|
2089
|
-
const resolvedKeyInfo =
|
|
2090
|
+
const resolvedKeyInfo = com.sphereon.crypto.ResolvedKeyInfo.Static.fromKeyInfo(keyInfo, key);
|
|
2090
2091
|
const jwkKeyInfo = CoseJoseKeyMappingService.toResolvedJwkKeyInfo(resolvedKeyInfo);
|
|
2091
2092
|
const kid = jwkKeyInfo.kid ?? calculateJwkThumbprint({
|
|
2092
2093
|
jwk: jwkKeyInfo.key.toJsonDTO()
|
|
@@ -2147,7 +2148,7 @@ var CoseCryptoService = class {
|
|
|
2147
2148
|
if (kid === null) {
|
|
2148
2149
|
kid = coseKeyInfo.key.getKidAsString(false);
|
|
2149
2150
|
}
|
|
2150
|
-
issuerCoseKey =
|
|
2151
|
+
issuerCoseKey = com.sphereon.crypto.cose.CoseKeyCbor.Static.fromDTO(coseKeyInfo.key);
|
|
2151
2152
|
}
|
|
2152
2153
|
const issuerCoseKeyInfo = new KeyInfo(kid, issuerCoseKey, coseKeyInfo.opts, coseKeyInfo.keyVisibility, issuerCoseKey.getSignatureAlgorithm() ?? coseKeyInfo.signatureAlgorithm, x5c, coseKeyInfo.kmsKeyRef, coseKeyInfo.kms, coseKeyInfo.keyType ?? issuerCoseKey.getKty());
|
|
2153
2154
|
const recalculatedToBeSigned = input.toBeSignedJson(issuerCoseKeyInfo, SignatureAlgorithm.Static.fromCose(coseAlg));
|
|
@@ -2267,22 +2268,24 @@ DefaultCallbacks.setCoseCryptoDefault(new CoseCryptoService());
|
|
|
2267
2268
|
DefaultCallbacks.setX509Default(new X509CallbackService());
|
|
2268
2269
|
|
|
2269
2270
|
// src/types/ImDLMdoc.ts
|
|
2270
|
-
import
|
|
2271
|
-
var
|
|
2272
|
-
var
|
|
2273
|
-
var
|
|
2274
|
-
var
|
|
2275
|
-
var
|
|
2276
|
-
var
|
|
2277
|
-
var
|
|
2278
|
-
var
|
|
2279
|
-
var
|
|
2280
|
-
var
|
|
2281
|
-
var
|
|
2282
|
-
var
|
|
2283
|
-
var
|
|
2271
|
+
import mdocPkg2 from "@sphereon/kmp-mdoc-core";
|
|
2272
|
+
var { com: com2 } = mdocPkg2;
|
|
2273
|
+
var CborByteString = com2.sphereon.cbor.CborByteString;
|
|
2274
|
+
var CoseKeyCbor = com2.sphereon.crypto.cose.CoseKeyCbor;
|
|
2275
|
+
var CoseCryptoServiceJS = com2.sphereon.crypto.CoseCryptoServiceJS;
|
|
2276
|
+
var CoseJoseKeyMappingService2 = com2.sphereon.crypto.CoseJoseKeyMappingService;
|
|
2277
|
+
var KeyInfo2 = com2.sphereon.crypto.KeyInfo;
|
|
2278
|
+
var DateTimeUtils2 = com2.sphereon.kmp.DateTimeUtils;
|
|
2279
|
+
var decodeFrom2 = com2.sphereon.kmp.decodeFrom;
|
|
2280
|
+
var encodeTo2 = com2.sphereon.kmp.encodeTo;
|
|
2281
|
+
var Encoding2 = com2.sphereon.kmp.Encoding;
|
|
2282
|
+
var MdocValidations = com2.sphereon.mdoc.data.MdocValidations;
|
|
2283
|
+
var MdocOid4vpService = com2.sphereon.mdoc.oid4vp.MdocOid4vpServiceJs;
|
|
2284
|
+
var Jwk = com2.sphereon.crypto.jose.Jwk;
|
|
2285
|
+
var Oid4VPPresentationSubmission = com2.sphereon.mdoc.oid4vp.Oid4VPPresentationSubmission;
|
|
2284
2286
|
|
|
2285
2287
|
// src/agent/mDLMdoc.ts
|
|
2288
|
+
var { com: com3 } = mdocPkg3;
|
|
2286
2289
|
var mdocSupportMethods = [
|
|
2287
2290
|
"x509VerifyCertificateChain",
|
|
2288
2291
|
"x509GetCertificateInfo",
|
|
@@ -2320,9 +2323,9 @@ var MDLMdoc = class {
|
|
|
2320
2323
|
async mdocOid4vpHolderPresent(args, _context) {
|
|
2321
2324
|
const { mdocs, presentationDefinition, trustAnchors, verifications, mdocHolderNonce, authorizationRequestNonce, responseUri, clientId } = args;
|
|
2322
2325
|
const oid4vpService = new MdocOid4vpService();
|
|
2323
|
-
const validate = /* @__PURE__ */ __name(async (
|
|
2326
|
+
const validate = /* @__PURE__ */ __name(async (mdoc) => {
|
|
2324
2327
|
try {
|
|
2325
|
-
const result = await MdocValidations.fromDocumentAsync(
|
|
2328
|
+
const result = await MdocValidations.fromDocumentAsync(mdoc, null, trustAnchors ?? this.trustAnchors, DateTimeUtils2.Static.DEFAULT.dateTimeLocal((verifications?.verificationTime?.getTime() ?? Date.now()) / 1e3), verifications?.allowExpiredDocuments);
|
|
2326
2329
|
if (result.error) {
|
|
2327
2330
|
console.log(JSON.stringify(result, null, 2));
|
|
2328
2331
|
}
|
|
@@ -2403,7 +2406,7 @@ var MDLMdoc = class {
|
|
|
2403
2406
|
*/
|
|
2404
2407
|
async mdocOid4vpRPVerify(args, _context) {
|
|
2405
2408
|
const { vp_token, presentation_submission, trustAnchors } = args;
|
|
2406
|
-
const deviceResponse =
|
|
2409
|
+
const deviceResponse = com3.sphereon.mdoc.data.device.DeviceResponseCbor.Static.cborDecode(decodeFrom2(vp_token, Encoding2.BASE64URL));
|
|
2407
2410
|
if (!deviceResponse.documents) {
|
|
2408
2411
|
return Promise.reject(Error(`No documents found in vp_token`));
|
|
2409
2412
|
}
|
|
@@ -2464,7 +2467,7 @@ var MDLMdoc = class {
|
|
|
2464
2467
|
async mdocVerifyIssuerSigned(args, context) {
|
|
2465
2468
|
const { input, keyInfo, requireX5Chain } = args;
|
|
2466
2469
|
const coseKeyInfo = keyInfo && CoseJoseKeyMappingService2.toCoseKeyInfo(keyInfo);
|
|
2467
|
-
const verification = await new CoseCryptoServiceJS(new CoseCryptoService(context)).verify1(
|
|
2470
|
+
const verification = await new CoseCryptoServiceJS(new CoseCryptoService(context)).verify1(com3.sphereon.crypto.cose.CoseSign1Json.Static.fromDTO(input).toCbor(), coseKeyInfo, requireX5Chain);
|
|
2468
2471
|
return {
|
|
2469
2472
|
...verification,
|
|
2470
2473
|
keyInfo
|