decode static method

SetLocalSecret? decode(
  1. Unpacker u
)

Implementation

static SetLocalSecret? decode(Unpacker u) {
  try {
    switch (u.unpackString()) {
      case null: return null;
      default: throw DecodeError();
    }
  } on FormatException {
    if (u.unpackMapLength() != 1) throw DecodeError();
    switch (u.unpackString()) {
      case "Password":
        return SetLocalSecretPassword(
          (Password.decode(u))!,
        );
      case "KeyAndSalt":
        if (u.unpackListLength() != 2) throw DecodeError();
        return SetLocalSecretKeyAndSalt(
          key: (SecretKey.decode(u))!,
          salt: (PasswordSalt.decode(u))!,
        );
      case null: return null;
      default: throw DecodeError();
    }
  }
}