decrypt method
Decrypts the given data
encrypted with the license's content key.
Implementation
@override
Future<Try<ByteData, LcpException>> decrypt(ByteData data) async {
try {
// LCP lib crashes if we call decrypt on an empty ByteArray
if (data.lengthInBytes == 0) {
return Try.success(ByteData(0));
} else {
DrmContext context = _documents.getContext();
ByteData decryptedData = _lcpClient.decrypt(context, data);
return Try.success(decryptedData);
}
} on Exception catch (e) {
return Try.failure(LcpException.wrap(e));
}
}