createMdocCredential
function is an asynchronous method that generates a Mobile Document (mDoc) credential in compliance with the ISO/IEC 18013-5 and related standards.
privateKey
(string): is an RSA PEM key in String format, used to sign the credential.claims
(object): is an object that contains user or credential-related data (e.g., { first_name: "Joey" }
).validityInfo
(object): defines the credential’s validity period and expected updates:
signed
(Date): The timestamp when the credential was signed.validFrom
(Date): The date from which the credential becomes valid.validUntil
(Date): The date after which the credential is no longer valid.expectedUpdate
(Date, optional): When the credential is expected to be updated or refreshed.signAlg
(MDocSignerAlgorithm, optional): The signing algorithm to be used (e.g., RS256
).hashAlg
(MDocHashAlgorithm, optional): The hashing algorithm used to generate document digests.hasher
(Hasher, optional): A custom hashing implementation. If provided, it overrides the default hashing mechanism.randomGenerator
(RandomGenerator, optional): A custom random byte generator for cryptographic operations.deviceJwkKey
(JsonWebKey, optional): A JWK-formatted key representing the device’s authentication key.issuerCertificate
(Uint8Array, optional): The issuer’s X.509 certificate in binary format, used for trust validation.unprotectedHeader
(object, optional): Additional metadata to include in the credential’s unprotected JOSE header.Promise<ArrayBuffer>
: A promise that resolves to a data that is a single object, self-contained CBOR array as follows: