KDFParam.fromJson constructor

KDFParam.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory KDFParam.fromJson(Map<String, dynamic> json) {
  final kdf = json["kdf"];
  final params = json["kdfparams"];
  switch (kdf) {
    case "scrypt":
      return KDFScrypt.fromJson(params);
    case "pbkdf2":
      return KDF2.fromJson(params);
    default:
      throw Web3SecretStorageDefinationV3Exception("Invalid kdf.", details: {
        "excepted": ["scrypt", "pbkdf2"].join(", "),
        "kdf": kdf
      });
  }
}