OathMechanism.fromJson constructor
Deserializes the specified Json into an object of the OathMechanism object.
Implementation
factory OathMechanism.fromJson(Map<String, dynamic> json,
[Account? account]) {
return OathMechanism(
json['id'],
json['mechanismUID'],
json['issuer'],
json['accountName'],
json['type'],
json['oathType'].toUpperCase() == 'HOTP'
? TokenType.HOTP
: TokenType.TOTP,
json['algorithm'],
json['secret'],
json['digits'] is String
? int.tryParse(json['digits'])
: json['digits'],
json['counter'] is String
? int.tryParse(json['counter'])
: json['counter'],
json['period'] is String
? int.tryParse(json['period'])
: json['period'],
json['timeAdded'],
account);
}