fromJSON static method
Creates an Encryption from its RWPM JSON representation.
If the encryption can't be parsed, a warning will be logged with warnings
.
Implementation
static Encryption? fromJSON(Map<String, dynamic>? json) {
if (json == null || json.isEmpty) {
return null;
}
String? algorithm = json["algorithm"];
if (algorithm == null || algorithm.isEmpty) {
return null;
}
return Encryption(
algorithm: algorithm,
compression: json["compression"],
// Fallback on [original-length] for legacy reasons
// See https://github.com/readium/webpub-manifest/pull/43
originalLength:
(json["originalLength"] ?? json["original-length"]) as int?,
profile: json["profile"],
scheme: json["scheme"]);
}