addCredential

@Blocking
fun addCredential(credential: String, deviceKeyId: String): String

Add a mobile credential to storage.

This function validates the mobile credential as per ISO 18013-5 including checking that the issuer of the credential is trusted by checking the corresponding issuer certificate is already stored by the SDK. Furthermore this function validates the relationship between the device key referenced by the deviceKeyId parameter by 1) checking it isn't already in use by being bound to another mobile credential stored by the SDK and 2) checking the device key matches the device key in the provided mobile credential.

Return

Id of the saved mobile credential

Parameters

credential

Base64 encoded string (with or without padding) containing a CBOR formatted mobile credential (ISO 18013-5 section 8.3.2.1.2.2 - IssuerSigned)

deviceKeyId

the Id of the deviceKey used to generate the mobile credential. A device key can be generated using generateDeviceKey

Throws