UNPKG

@m-doc/types

Version:

mdl implementation in typescript

57 lines (55 loc) 1.65 kB
declare const DOC_TYPE = "org.iso.18013.5.1.mDL"; declare const DEFAULT_NAMESPACE = "org.iso.18013.5.1"; interface JsonWebKey { crv?: string; d?: string; kty?: string; x: string; y: string; } interface CoseKey { '1': number; '-1': number; '-2': Uint8Array; '-3': Uint8Array; '-4'?: Uint8Array; } type DigestAlgorithm = 'SHA-256' | 'SHA-384' | 'SHA-512'; type OrPromise<T> = T | Promise<T>; type Hasher = (data: ArrayBuffer, alg: DigestAlgorithm) => OrPromise<ArrayBuffer>; type RandomGenerator = (length: number) => OrPromise<Uint8Array>; declare enum MDocStatus { OK = 0, GeneralError = 10, CBORDecodingError = 11, CBORValidationError = 12 } type DeviceKeyInfo = { deviceKey: CoseKey; }; type ValidityInfo = { signed: Date; validFrom: Date; validUntil: Date; expectedUpdate?: Date; }; type MSO = { docType: string; version: string; digestAlgorithm: DigestAlgorithm; valueDigests: Map<string, Map<number, ArrayBuffer>>; validityInfo: ValidityInfo; deviceKeyInfo?: DeviceKeyInfo; }; type SessionTranscript = { deviceEngagementBytes: ArrayBuffer | null; eReaderKeyBytes: ArrayBuffer | null; handover: string[]; }; type IssuerSignedItemParams<T extends unknown = unknown> = { digestID: number; random: ArrayBuffer; elementIdentifier: string; elementValue: T; }; export { type CoseKey, DEFAULT_NAMESPACE, DOC_TYPE, type DeviceKeyInfo, type DigestAlgorithm, type Hasher, type IssuerSignedItemParams, type JsonWebKey, MDocStatus, type MSO, type OrPromise, type RandomGenerator, type SessionTranscript, type ValidityInfo };