KDFScrypt.fromCbor constructor

KDFScrypt.fromCbor(
  1. CborListValue<CborObject<Object?>> v
)

Implementation

factory KDFScrypt.fromCbor(CborListValue v) {
  final List<int> salt = v.rawValueAt(4);
  if (salt.length != _SecretStorageConst.saltLength) {
    throw ArgumentException.invalidOperationArguments(
      "KDFScrypt",
      name: "salt",
      reason: "Invalid salt bytes length.",
    );
  }
  final int dklen = v.rawValueAt(0);
  final int n = v.rawValueAt(1);
  final int r = v.rawValueAt(2);
  final int p = v.rawValueAt(3);

  return KDFScrypt(dklen: dklen, n: n, r: r, p: p, salt: salt);
}