@sphereon/ssi-sdk.mdl-mdoc
Version:
47 lines • 3.01 kB
TypeScript
import { com, Nullable } from '@sphereon/kmp-mdoc-core';
import { X509ValidationResult } from '@sphereon/ssi-sdk-ext.x509-utils';
import { IRequiredContext, VerifyCertificateChainArgs } from '../types/ImDLMdoc';
import CoseSign1Cbor = com.sphereon.crypto.cose.CoseSign1Cbor;
import ICoseKeyCbor = com.sphereon.crypto.cose.ICoseKeyCbor;
import ToBeSignedCbor = com.sphereon.crypto.cose.ToBeSignedCbor;
import IVerifySignatureResult = com.sphereon.crypto.generic.IVerifySignatureResult;
import ICoseCryptoCallbackJS = com.sphereon.crypto.ICoseCryptoCallbackJS;
import IKey = com.sphereon.crypto.IKey;
import IKeyInfo = com.sphereon.crypto.IKeyInfo;
import IX509ServiceJS = com.sphereon.crypto.IX509ServiceJS;
import IX509VerificationResult = com.sphereon.crypto.IX509VerificationResult;
import X509VerificationProfile = com.sphereon.crypto.X509VerificationProfile;
import LocalDateTimeKMP = com.sphereon.kmp.LocalDateTimeKMP;
export declare class CoseCryptoService implements ICoseCryptoCallbackJS {
private context?;
constructor(context?: IRequiredContext | undefined);
setContext(context: IRequiredContext): void;
signAsync(input: ToBeSignedCbor, requireX5Chain: Nullable<boolean>): Promise<Int8Array>;
verify1Async<CborType>(input: CoseSign1Cbor<CborType>, keyInfo: IKeyInfo<ICoseKeyCbor>, requireX5Chain: Nullable<boolean>): Promise<IVerifySignatureResult<ICoseKeyCbor>>;
resolvePublicKeyAsync<KT extends com.sphereon.crypto.IKey>(keyInfo: com.sphereon.crypto.IKeyInfo<KT>): Promise<com.sphereon.crypto.IResolvedKeyInfo<KT>>;
}
/**
* This class can be used for X509 validations.
* Either have an instance per trustedCerts and verification invocation or use a single instance and provide the trusted certs in the method argument
*
* The class is also registered with the low-level mDL/mdoc Kotlin Multiplatform library
* Next to the specific function for the library it exports a more powerful version of the same verification method as well
*/
export declare class X509CallbackService implements IX509ServiceJS {
private _trustedCerts?;
constructor(trustedCerts?: Array<string>);
/**
* A more powerful version of the method below. Allows to verify at a specific time and returns more information
* @param chain
* @param trustAnchors
* @param verificationTime
*/
verifyCertificateChain({ chain, trustAnchors, verificationTime, opts, }: VerifyCertificateChainArgs): Promise<X509ValidationResult>;
/**
* This method is the implementation used within the mDL/Mdoc library
*/
verifyCertificateChainJS<KeyType extends IKey>(chainDER: Nullable<Int8Array[]>, chainPEM: Nullable<string[]>, trustedCerts: Nullable<string[]>, verificationProfile?: X509VerificationProfile | undefined, verificationTime?: Nullable<LocalDateTimeKMP>): Promise<IX509VerificationResult<KeyType>>;
setTrustedCerts: (trustedCertsInPEM?: Array<string>) => void;
getTrustedCerts: () => string[] | undefined;
}
//# sourceMappingURL=index.d.ts.map