decryptAccessLog method

Future<DecryptedAccessLogDto> decryptAccessLog(
  1. String myId,
  2. AccessLogDto accessLogDto
)

Implementation

Future<DecryptedAccessLogDto> decryptAccessLog(String myId, AccessLogDto accessLogDto) async {
  final secret = (await this.crypto.decryptEncryptionKeys(myId, accessLogDto.encryptionKeys)).firstOrNull?.formatAsKey().fromHexString();
  if (secret == null) {
    throw FormatException("Cannot get encryption key fo ${accessLogDto.id} and hcp $myId");
  }
  final es = accessLogDto.encryptedSelf;
  return this.unmarshaller(accessLogDto, es != null ? base64.decoder.convert(es).decryptAES(secret) : null);
}